Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/rfc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Design documents and technical proposals, grouped by scope. Shared/cross-cutting
- [Build stage](stovepipe/steps/build.md) - Trigger-only stage and Stovepipe's URI-based BuildRunner contract
- [Buildsignal stage](stovepipe/steps/buildsignal.md) - Build polling, terminal status persistence, and the handoff to record
- [Record stage](stovepipe/steps/record.md) - Immutable validation facts keyed by `(queue, uri, project)`, monotonic last-green bookmark advancement and ref promotion, and the repository hook event. The analyze-stage handoff in that doc is design only
- [Fix tracking](stovepipe/fix-tracking.md) - How a custom repair executor reports asynchronous work and makes verified change links available in request history.
- [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
- [List API](stovepipe/list-api.md) - Queue-scoped request listing by acceptance time, immutable acceptance time in summaries, cursor pagination, and a portable time-to-request mapping
Expand Down
27 changes: 27 additions & 0 deletions doc/rfc/stovepipe/fix-tracking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Fix tracking

Stovepipe tracks three different facts: **the backend accepted work**, **a change is available for review**, and **the issue recovered**. Acceptance comes from the fixer's submission receipt. Availability comes from verifying a change against the backend. Recovery comes from later validation and issue tracking, not from a callback, a successful repair job, or a merged PR.

## From an issue opening to a reviewable change

| When | What Stovepipe retains | What the user sees |
|---|---|---|
| A registered executor accepts an issue opening | An `issue_repair` receipt with the executor's `fix_id`, and an association between that fix and the request. A fix can cover multiple openings or requests. | **Fix accepted** (`fix_submitted`), once per opening and executor. No link is promised. |
| The executor delivers `RecordFixResult` | An immutable report, then a fix-tracking task identifying that report. Without a callback, acceptance alone does not start polling. | No new history event: a callback is not evidence that a change exists. |
| The executor verifies a published or reused change | The first observation of its canonical URL, shared across all reports for the fix. | **Fix available** (`fix_available`), once per associated request, executor, fix and distinct URL. Other changes can still be pending. |

A callback can arrive before the submission receipt. The worker retains verified URLs even when no request is associated yet. Both sides write first, then read the other side: a new association checks for known URLs, and a new observation checks for associated requests. Replaying either step fills in missing history using the same event ID. It never rewrites **Fix accepted**. Read both events through the [request history API](request-history-api.md); `fix_available` is a history event, not a hook notification.

## Integrating a custom fixer

1. **Register and submit.** In host wiring, have `fixer.Factory.For` return a queue-local `Registration` with a stable ID and your `RepairExecutor`. Do not reuse that ID for another backend. `Submit` receives a batch and returns a `Submission` per accepted or deliberately skipped opening: return the backend run ID as `FixID`, or return a `SkipReason`, not both. Deduplicate backend submissions by issue opening across retries, even when the batch changes. If some items were accepted before an error, return their receipts alongside the error.
2. **Carry the run identity into each job.** A trusted callback producer calls `RecordFixResult` with the same `queue`, `executor_id`, and `fix_id` and an executor-owned JSON object encoded in `result_json` (at most 256 KiB). No request ID is needed. Omit `report_id` for a single report; use a stable occurrence ID for each additional report. Include the backend identifiers needed to resolve that occurrence in the payload. Retry an uncertain delivery with the same identity and serialized payload: whitespace is compacted, but object keys are not reordered. A different payload for the same occurrence returns `ALREADY_EXISTS`; progress is not reported by overwriting it.
3. **Verify, don't resubmit.** Implement the optional `ResultTracker` on the same registered executor. `ObserveFix` must be read-only and safe to repeat concurrently. Resolve the *specific* run or child job named by the report, not the latest change on a branch. Return `pending` while publication is outstanding, not an error. Include all verified canonical HTTP(S) links for that report in `ChangeURLs`, even while pending, and mark reused links in `ExistingChangeURLs`. A dry run has no verified change to return. Return a dependency error when the lookup itself fails.

For example, a formatter accepts two issues from one request under `fix_id=run-42`. Its dispatcher sends an unnamed report; its two workers report `job/17/completed` and `job/18/completed`, **both under `run-42`**. Worker 17 can finish before the dispatcher reports. If its output is not yet published, `ObserveFix` returns `pending`; when the backend links job 17 to PR 81, that request gets a link to PR 81 without waiting for job 18. If job 18 finds the same PR, history still shows one link. A different PR gets its own entry.

## Retry and deployment boundaries

Each report has its own poll budget and terminal outcome (`succeeded`, `failed`, `skipped`, or `inconclusive`). One terminal report does not close the fix to later reports. Progress for the fix is versioned together so concurrent reports cannot erase each other's verified links. An unavailable tracker or an exhausted polling budget yields `inconclusive`; the dead-letter worker preserves verified links without calling the executor again.

The [reference host](../../../service/stovepipe/README.md) uses a no-op fixer and restricts the callback RPC to loopback. A custom host must authorize its executor workloads. Deploy the [storage schema](../../../stovepipe/extension/storage/README.md), RPC writers, and primary and dead-letter workers before enabling callbacks. In particular, drain workers that do not understand `report_id` before sending named reports: they interpret a named task as the unnamed report.
4 changes: 4 additions & 0 deletions doc/rfc/stovepipe/request-history-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Events are returned by `(timestamp_ms ASC, event_id ASC)`. URI histories are ord
| `build_analysis_abandoned` | `build_analysis_abandoned` | `build_id` |
| `validation_fact_recorded` | `validation_fact_recorded` | `fact_degree`, a breakage degree in [0, 1] |
| `project_facts_recorded` | `project_facts_recorded` | `project_fact_count`, an unsigned count |
| `fix_submitted`, `fix_submission_skipped`, `fix_submission_abandoned` | Corresponding fix payload | Opening `build_id`, `task_id`, `unit_id`, `executor_id`, and `fix_id` or `reason` as applicable |
| `fix_available` | `fix_available` | `executor_id`, `fix_id`, `change_url`, `reused` |

For `fix_available`, the event timestamp is when the link was recorded for this request, not when the change was created. See [Fix tracking](fix-tracking.md) for a callback arriving before request association.

Build IDs are ordinary strings, with empty meaning unavailable. Baseline metadata is not exposed in event data. Numeric payload presence distinguishes a recorded zero from unavailable metadata. The project-fact count uses protobuf `uint64` (a decimal string in JSON) to preserve precision across clients.

Expand Down
13 changes: 8 additions & 5 deletions doc/rfc/stovepipe/request-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Stovepipe retains an append-only request log for each validation request. Its in
- `build_analysis_completed`;
- `issues_reconciled`;
- `fix_submitted`;
- `fix_available`;
- `fix_submission_skipped`;
- `fix_submission_abandoned`.

Expand All @@ -34,7 +35,7 @@ State changes alone are insufficient. A request remains processing while a build
An occurrence belongs in the request log only when it is either:

1. a durable `Request.State` transition; or
2. an asynchronous durable milestone explaining validation, issue reconciliation, or a repair submission for the request.
2. an asynchronous durable milestone explaining validation, issue reconciliation, or the acceptance or availability of a fix for the request.

The following remain with their owning entities, metrics, or structured logs:

Expand Down Expand Up @@ -137,15 +138,16 @@ State entries retain the selected baseline URI when known, including an empty UR
| `issue_tracking_abandoned` | Issue tracking stopped before completing a pass; existing issue changes remain, but reconciliation may be incomplete. This is not a validation verdict. | Build ID metadata and event retention time |
| `build_analysis_completed` | Issue analysis for the winning terminal build completed and its detected issues were persisted. | Build ID, first retained completion's issue count, and event retention time |
| `issues_reconciled` | A final issue-tracking pass completed, including any deliberate suppression of absent-issue closure. | Build ID, closure mode, and event retention time |
| `fix_submitted` | An identified repair attempt was durably associated with a build issue. It does not imply a patch exists or the issue recovered. | Build, task, unit, and fix IDs and event retention time |
| `fix_submission_skipped` | No eligible open issue existed for the build. | Build ID, bounded reason, and event retention time |
| `fix_submitted` | An identified repair attempt was durably associated with a build issue. It does not imply a patch exists or the issue recovered. | Build, task, unit, executor, and fix IDs and event retention time |
| `fix_available` | A published or reused change has been verified for a fix associated with this request. It does not indicate recovery. | Executor ID, fix ID, canonical change URL, reused flag and event retention time |
| `fix_submission_skipped` | The executor deliberately skipped an issue opening. | Opening build, task, unit, executor ID, skip reason, and event retention time |
| `fix_submission_abandoned` | Repair processing stopped without a durable fix ID; external acceptance remains unknown. | Build ID, bounded reason, and event retention time |

Build running and unchanged polls are not retained. Trigger and terminal result explain the request outcome without turning polling into an unbounded log. Individual project facts remain outside the vocabulary; one batch-completion event summarizes their durable recording. Its `project_fact_count` and `broken_project_fact_count` metadata contain the total and the number with degree above zero, counted from persisted facts after their indexes are durable. Project completion projection requires both counts and assigns them together in `RequestSummary` from the retained event.

`build_analysis_completed` and `issues_reconciled` use the build ID as their occurrence key. Per-item `fix_submitted`, `fix_submission_skipped`, and `fix_submission_abandoned` events use a digest of opening build, task, unit, and executor identity, retaining the verbatim fix ID or skip reason and executor ID in metadata. Existing issue-tracking abandonment uses a digest of the failed notification ID to fit the storage key limit. The materializer prefixes each key with its event kind, and request identity scopes all entries. Replays retain the first stored timestamp.

Analysis and repair events do not advance Request state or alter validation facts. Analysis completion is retained only when the Request records the analyzed terminal build as its winning outcome, immediately before the final issue-tracking handoff. Its issue count and timestamp are an immutable snapshot of the first retained completion, including zero for an empty result. Retries still persist detected issues and publish the handoff, but reuse that snapshot if later detector results differ; count discrepancies are logged rather than treated as history conflicts. Other semantic conflicts remain errors. `issues_reconciled` records closure mode `reconciled`, `suppressed_cancelled`, or `suppressed_task_wide_issue`; suppression does not mean reconciliation failed. Skipped repair uses reason `no_eligible_issue`; abandoned repair uses `acceptance_unknown`. Raw dependency errors remain in operational logs.
Analysis and repair events do not advance Request state or alter validation facts. Analysis completion is retained only when the Request records the analyzed terminal build as its winning outcome, immediately before the final issue-tracking handoff. Its issue count and timestamp are an immutable snapshot of the first retained completion, including zero for an empty result. Retries still persist detected issues and publish the handoff, but reuse that snapshot if later detector results differ; count discrepancies are logged rather than treated as history conflicts. Other semantic conflicts remain errors. `issues_reconciled` records closure mode `reconciled`, `suppressed_cancelled`, or `suppressed_task_wide_issue`; suppression does not mean reconciliation failed. Skipped repair retains the executor’s skip reason; abandoned repair uses `acceptance_unknown`. Raw dependency errors remain in operational logs.

### Evolution

Expand Down Expand Up @@ -238,7 +240,8 @@ The `project_facts_recorded` and `record_abandoned` events project completion of
| Build analysis DLQ | Retain `build_analysis_abandoned` without rerunning detection or changing validation state. | One stable event per build deduplicates recovery deliveries; only state reads and history retention retry. |
| Issue tracking DLQ | Protect the current cursor from delayed writes, retain its issue history and `issue_tracking_abandoned`, then mark the pass abandoned. | A stable hash of the notification ID deduplicates the event. Recovery retains accepted issue changes and never processes the remaining range. |
| Issue tracking | Finalize the durable checkpoint, then retain `issues_reconciled`. | Reconstruct history from the finalized checkpoint before it can be replaced by another pass. |
| Fix | Retain each executor disposition, then retain its submitted or skipped event. | Restore every durable disposition event before skipping that item for that executor. |
| Fix | Retain the submitted or skipped event for each durable disposition. Associate accepted fixes with the request and record any already verified links. | Repeat the association and history writes without resubmitting. |
| Fix tracking | Retain new verified URLs on the fix, then append `fix_available` for each associated request. | Reuse the occurrence keyed by executor, fix ID and URL within the request. Redelivery and dead-letter recovery can restore missing history without replacing it; see [Fix tracking](fix-tracking.md). |
| Fix DLQ | Repair submitted or skipped history from current durable state, or retain `fix_submission_abandoned` when acceptance is unknown. | Only read sources and retain history; never call the executor or change issue state. |
| Reconciler | CAS an unrecoverable non-terminal Request to failed, then retain failed. | An existing terminal Request is repaired from its persisted outcome without relabeling it. |

Expand Down
2 changes: 2 additions & 0 deletions doc/rfc/stovepipe/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The pipeline is a queue-driven chain of small, single-purpose controllers, in th

The [build issue observation](steps/buildanalysis.md) branch runs alongside this chain. It accumulates issues while builds run and performs final analysis after build completion. Repository recording follows successful project analysis. DLQ recovery retains failure or abandonment history without resuming the normal workflow. The reference host wires a no-op detector; deployments supply a real detector factory.

When a build opens an issue, a registered fixer can submit repair work. [Fix tracking](fix-tracking.md) describes the separate, callback-driven path from backend acceptance to a verified change in request history. Neither step changes the validation verdict.

`projectanalysis` resolves project status and issue attribution after final build issues are durable. It does not start another build; project-scoped revalidation remains a [future design](#future-project-scoped-revalidation).

## What Stovepipe is agnostic about
Expand Down
Loading