From 9cf403def167d08e170d28ff5c20ff39da77f2f1 Mon Sep 17 00:00:00 2001 From: "prath.shenoy" Date: Wed, 16 Sep 2026 18:56:58 +0000 Subject: [PATCH] doc(stovepipe): Add status lookup RFC **What**: - Define repository and project validation lookup semantics. - Specify staged rollout, consistency, completion, and pagination behavior. **Why**: - Establish a stable public contract before implementation begins. - Separate generic validation status behavior from repository-specific integrations. --- doc/rfc/index.md | 1 + .../get-project-status-by-uri-api.md | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 doc/rfc/stovepipe/get-project-status-by-uri-api.md diff --git a/doc/rfc/index.md b/doc/rfc/index.md index 11dcb60d..1b25b63a 100644 --- a/doc/rfc/index.md +++ b/doc/rfc/index.md @@ -33,6 +33,7 @@ Design documents and technical proposals, grouped by scope. Shared/cross-cutting - [Record stage](stovepipe/steps/record.md) - Immutable validation facts keyed by `(queue, uri, project)`, monotonic last-green bookmark advancement and ref promotion, and the deferred hook-event and analyze handoffs - [Request Log](stovepipe/request-log.md) - Append-only request lifecycle log, durable source context, idempotent storage, and reliable write and repair paths - [Request History API](stovepipe/request-history-api.md) - Queue-scoped request-ID and URI lookup, public projection, materialization decision, ordering, and retention +- [GetProjectStatusByURI API](stovepipe/get-project-status-by-uri-api.md) - Queue-scoped current validation lookup for a commit, with repository and future project-level results ## Runway diff --git a/doc/rfc/stovepipe/get-project-status-by-uri-api.md b/doc/rfc/stovepipe/get-project-status-by-uri-api.md new file mode 100644 index 00000000..5901cfc9 --- /dev/null +++ b/doc/rfc/stovepipe/get-project-status-by-uri-api.md @@ -0,0 +1,87 @@ +# Stovepipe GetProjectStatusByURI API + +## Summary + +`GetProjectStatusByURI` exposes the current validation status for one exact commit URI in a queue. The response identifies the validation request, its baseline and lifecycle state, its whole-repository result when one has been recorded, and any project results the implementation exposes. + +A project is a consumer-defined deployable or consumable unit in the repository. The API does not define how projects are discovered, how validation work is selected, or how a project result is derived. Those are integration responsibilities outside this contract. + +The API is the durable source of truth for validation status. Lifecycle notifications are advisory: consumers can reconcile missed or duplicate notifications by querying this endpoint. + +## Contract + +The request and response fields have the following API-level meaning. The published protobuf is the authoritative field-level contract. + +| Request field | Required | Meaning | +| --- | --- | --- | +| `queue` | Yes | Identifies the queue in which to find the validation request. | +| `change_uri` | Yes | Identifies the exact commit URI under validation. | +| `projects` | Yes | Consumer-defined project IDs whose results are requested. At least one ID is required. | +| `page_size` | No | Limits one page of results for the requested projects. | +| `page_token` | No | Continues a previous page of results for the requested projects. | + +| Response field | Meaning | +| --- | --- | +| `request_id` | Identifies the resolved authoritative validation request. | +| `queue`, `change_uri`, `base_uri` | Return the validated scope and incremental-validation baseline. | +| `request_state` | Returns the request's public lifecycle state. | +| `updated_at_ms` | Records, in Unix milliseconds, the newest durable lifecycle or result record represented by the response. | +| `repository_breakage_degree` | Returns the whole-repository result when it is durably recorded. | +| `project_results_complete` | Indicates whether the implementation has durably finished producing results for the supplied project IDs. | +| `projects` | Returns recorded results for requested project IDs. | +| `next_page_token` | Continues requested-project result pagination when another page exists. | + +`request_state` is a stable public lifecycle vocabulary: `accepted`, `processing`, `succeeded`, `failed`, `cancelled`, or `superseded`. Clients must tolerate a future value. A terminal request state does not by itself mean that project results are complete. + +Repository and project breakage degrees are independent projections. A degree is on `[0.0, 1.0]`: `0.0` is green and any value above `0.0` is not green. An absent degree means no durable result exists; it must never be interpreted as green. The API does not derive one scope's degree from another scope's results. `updated_at_ms` is derived only from durable lifecycle and result records. + +| Response data | Durable source | +| --- | --- | +| Request identity, baseline, and lifecycle | Validation request | +| Repository breakage degree | Repository validation fact | +| Project results | Implementation-defined project-result records | +| Project completion and pagination | Project-result completion record and cursor | + +## Request Selection + +The lookup is queue-scoped. Stovepipe resolves `change_uri` through its request-URI mapping, loads the resulting request, and verifies that its queue and URI match the selector before reading validation facts. + +| Observed state | Result | +| --- | --- | +| No request-URI mapping | Not found | +| Mapping exists but the Request is not visible | Unavailable and retryable | +| Mapping and Request disagree | Internal consistency error | + +The initial request-URI mapping admits one request per `(queue, change_uri)`, so the endpoint returns one authoritative request. Revalidation support must introduce an explicit authoritative-request rule; it must not silently change this lookup's meaning. + +Queue, URI, request ID, and project ID comparisons are byte-exact and are limited to 255 bytes. An empty queue, URI, project list, or project ID is invalid. A request cannot contain duplicate project IDs. `page_size=0` selects the default of 50; the maximum is 200. Page tokens are opaque and bound to the selected request and requested project list. + +## Project Results and Pagination + +The caller supplies the project IDs for which it wants recorded results. The API does not define project discovery, validation selection, or attribution. A project absent from the response has no universal meaning and consumers must not infer that it is green. + +The response includes only results for the supplied project IDs, in the supplied order, and paginates that list. An implementation may record results for every requested project, only requested projects with a non-green result, or another documented subset. + +Each project result is an immutable validation fact keyed by queue, commit URI, and project ID. A result must identify the selected request. `project_results_complete` is false until the implementation has durably finished producing results for the supplied project IDs; a completed empty set is valid. + +Callers use `project_results_complete`, rather than the presence or absence of an individual project result, to determine whether the implementation has finished producing results for the requested projects. `next_page_token` is empty only on the final page. A terminal lifecycle notification is emitted only after the repository result and any applicable project completion record are durable. If notification delivery fails, consumers can recover the same result through this endpoint. + +## Rollout + +The initial implementation returns request lifecycle and whole-repository result only. It returns an empty `projects` list and `project_results_complete=false` because it does not yet produce project results. Its `updated_at_ms` value is returned only after a durable lifecycle record reflects the request state in the response. + +A later implementation can add durable project results, completion recording, and pagination using its documented result-set semantics. The public response shape remains unchanged. + +## Errors and Authorization + +- Invalid selectors, an empty project list, an invalid project ID, duplicate project IDs, or malformed page tokens are user errors. +- An unknown queue-scoped commit URI is not found. +- A request-URI mapping whose Request is not visible is retryable. +- A mapping and Request that disagree, a result belonging to another request, or a completion record with a missing project result is an internal consistency error. +- Authorization follows the queue policy applied to other Stovepipe reads. A commit URI or request ID does not bypass queue access control. + +## Testing + +The initial implementation must test request selection, queue isolation, the request visibility race, absent versus green repository facts, lifecycle projection, and invalid selectors. + +The project-result rollout additionally tests requested-project filtering, pagination and token binding, incomplete versus completed results, duplicate delivery, recovery after a partial write, and an unknown future lifecycle value.