From f2c22ad9057c4fc66843d188ffcc82562097ae2f Mon Sep 17 00:00:00 2001 From: REPPL <77722411+REPPL@users.noreply.github.com> Date: Wed, 2 Dec 2026 22:35:39 +0000 Subject: [PATCH 01/11] chore: record how the release cut stops re-running reviews and waiting at its freeze Assisted-by: Claude:claude-opus-5-5 --- ...2612022235231317-fix-iss-2612022218233502-by-carrying.md | 6 ++++++ ...12022235359298-fix-iss-2612022218224985-with-a-freeze.md | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 .abcd/work/decisions/dcn-2612022235231317-fix-iss-2612022218233502-by-carrying.md create mode 100644 .abcd/work/decisions/dcn-2612022235359298-fix-iss-2612022218224985-with-a-freeze.md diff --git a/.abcd/work/decisions/dcn-2612022235231317-fix-iss-2612022218233502-by-carrying.md b/.abcd/work/decisions/dcn-2612022235231317-fix-iss-2612022218233502-by-carrying.md new file mode 100644 index 0000000000..73378e305a --- /dev/null +++ b/.abcd/work/decisions/dcn-2612022235231317-fix-iss-2612022218233502-by-carrying.md @@ -0,0 +1,6 @@ +--- +id: dcn-2612022235231317 +slug: fix-iss-2612022218233502-by-carrying +date: 2026-12-02 +--- +2026-12-02 — Fix iss-2612022218233502 by carrying receipts rather than re-keying the gate: abcd launch receipts --carry moves each required gate's receipt from the earlier commit its reviewer read to HEAD, rewriting its subject to HEAD and recording carriedFrom, only when no path that gate reads differs between the two commits as stored, and otherwise leaves it and names the changed paths so the reviewer re-reads only those; the protocol runs both reviews before the roll, the changelog payload through the practice run (launch ship --changelog-json --dry-run), so the roll happens once. A gate's reads are the tree less the working tier .abcd/work/; the docs-currency reviewer also reads none of the design record .abcd/development/ but its releases/ and release-gate/, and the cross-check reads neither docs/ nor the cut's own outputs (CHANGELOG.md, RELEASE.md, the archived release pages, the release digest, the catalog pin and the surface snapshot); any other gate reads the whole tree but the working tier. Grounds: the release job's derivation, the sha-keyed receipts, their attestation and receipt_gate stay exactly as they are, so launch receipts and the release job still read one receipt and cannot disagree, and a change to any path a gate reads still leaves its receipt uncarried; keying receipts to content digests would rework release.yml's trust chain and every scaffolded release workflow for the same effect, and accepting an earlier roll's receipt in launch receipts alone would make the local check answer differently from the release job. Reverse: remove --carry and the protocol's carry step; receipts already carried stay valid sha-keyed receipts diff --git a/.abcd/work/decisions/dcn-2612022235359298-fix-iss-2612022218224985-with-a-freeze.md b/.abcd/work/decisions/dcn-2612022235359298-fix-iss-2612022218224985-with-a-freeze.md new file mode 100644 index 0000000000..86aec3f4a8 --- /dev/null +++ b/.abcd/work/decisions/dcn-2612022235359298-fix-iss-2612022218224985-with-a-freeze.md @@ -0,0 +1,6 @@ +--- +id: dcn-2612022235359298 +slug: fix-iss-2612022218224985-with-a-freeze +date: 2026-12-02 +--- +2026-12-02 — Fix iss-2612022218224985 with a freeze note in the cutting copy's local tier rather than a field on the pushed reservation: abcd reserve rel-, when it reserves the release afresh, notes origin's default branch as its own fetch left it as the cut's freeze commit, and a renewal keeps the note; abcd launch ship names the freeze commit and the time since it was taken, and with --changelog-json, the practice run included, refuses before it writes anything when the cut's base on the default branch (HEAD's merge base with it) is not the freeze commit, unless --refreeze says why, which the report repeats. The wait named is the one between the reservation and the ship, because the time a cut is set for lives only in a decision's prose and no binary reads it. Grounds: the reservation's pushed shape is read by every peer's binary, and a field an older binary does not know risks reading as an unreadable reservation, which holds every merge; the release is cut from the copy that reserved it, which is where the note is; and refusing at the roll, not at the emit step, keeps the emit step writing nothing while still making a later default branch a deliberate, stated act. Reverse: stop writing the note; a ship that finds no note judges no freeze, as before From dbed67a61ef9da45c06ad1067ee8cd024cf618e3 Mon Sep 17 00:00:00 2001 From: REPPL <77722411+REPPL@users.noreply.github.com> Date: Thu, 3 Dec 2026 00:03:17 +0000 Subject: [PATCH 02/11] fix: carry a release receipt over a fix its gate does not read A receipt names the commit its reviewer read, so every fix a review asked for made a new content commit and left both receipts behind: the v0.18.0 cut rolled four times in 72 minutes and ran both reviews after each roll. `abcd launch receipts --carry ` moves each required gate's receipt from the commit its reviewer read to HEAD when no path that gate reads differs between the two, as git stores them, and otherwise leaves it and names the changed paths, which are all its reviewer reads again. The docs-currency review reads no design record but the archived release pages and the release-gate manifest; the brief cross-check reads no user page and none of the cut's own outputs; neither reads the working tier. A carried receipt is an ordinary receipt naming HEAD, with carriedFrom added, so the release job's derivation and gate are unchanged and still read one receipt: a change to any path a gate reads still leaves it behind. A carry never replaces a receipt and refuses a sha that names no earlier commit. The receipts protocol the emit step prints now runs both reviews before the roll, the changelog review reading the composed payload, whose prose the roll writes word for word, with the practice run checking it against the cut; a prose fix edits the payload, so the roll happens once and leaves no revert. It then carries the receipts to the roll. The release-gate runbook, the launch command page and the launch brief say the same. Resolves: iss-2612022218233502 Resolves: iss-2611060603323399 Assisted-by: Claude:claude-opus-5-5 --- .../brief/04-surfaces/04-launch.md | 36 +- .abcd/development/release-gate/README.md | 113 ++++-- .abcd/development/release/surface.json | 10 +- ...cut-prose-is-judged-only-after-the-roll.md | 2 + ...-a-release-cut-s-docs-reviews-run-after.md | 2 + commands/launch.md | 61 ++- docs/reference/cli/commands.md | 21 +- docs/reference/cli/commands/launch.json | 9 +- internal/core/launch/lockstep.go | 6 +- internal/core/lint/receiptcarry.go | 358 ++++++++++++++++++ internal/core/lint/receiptcarry_test.go | 270 +++++++++++++ internal/core/release/cutoutputs.go | 27 ++ internal/core/release/protocol.go | 34 +- internal/core/release/protocol_test.go | 47 ++- internal/surface/cli/launch_receipts.go | 94 ++++- .../surface/cli/launch_receipts_carry_test.go | 57 +++ 16 files changed, 1090 insertions(+), 57 deletions(-) rename .abcd/work/issues/{open => resolved}/iss-2611060603323399-cut-prose-is-judged-only-after-the-roll.md (81%) rename .abcd/work/issues/{open => resolved}/iss-2612022218233502-a-release-cut-s-docs-reviews-run-after.md (75%) create mode 100644 internal/core/lint/receiptcarry.go create mode 100644 internal/core/lint/receiptcarry_test.go create mode 100644 internal/core/release/cutoutputs.go create mode 100644 internal/surface/cli/launch_receipts_carry_test.go diff --git a/.abcd/development/brief/04-surfaces/04-launch.md b/.abcd/development/brief/04-surfaces/04-launch.md index 64372f5b85..aa83b1a7bc 100644 --- a/.abcd/development/brief/04-surfaces/04-launch.md +++ b/.abcd/development/brief/04-surfaces/04-launch.md @@ -175,11 +175,16 @@ gate, and an uncommitted change refuses the render. **The emit step ends with the receipts protocol.** After the cut's report, the render closes with a numbered checklist, composed in the core and carried in -the machine-readable report too: commit the roll, run each semantic gate the -release workflow requires against that commit, key every receipt to it, commit -the receipts on top of the roll, disposition every finding as fixed, invalid or -deferred and commit one open issue record per deferred finding after the -receipts, then prove the gate locally. The gate names come from the committed `release.yml`, the list the +the machine-readable report too: run each semantic gate the release workflow +requires before the roll, the changelog review reading the composed payload +itself, whose prose the roll writes word for word, with the practice run +checking it against the cut, and commit the fixes first, a prose fix in the +payload, so the roll happens once and leaves no revert (iss-2611060603323399); +key each receipt to the commit its reviewer read; roll; carry the receipts to +the roll and review again only what the carry names; commit the receipts on top +of the roll; disposition every finding as fixed, invalid or deferred, with one +open issue record per deferred finding committed before the roll or after the +receipts; then prove the gate locally. The gate names come from the committed `release.yml`, the list the release job enforces, so the checklist cannot ask for a gate the release does not require. A workflow that arms no semantic gate gets a checklist that says no receipt is required. @@ -201,6 +206,23 @@ receipt or issue-ledger change, because the release job reads the committed tree. It exits 0 when the gate would admit (or nothing is armed), 1 when it would refuse, and 2 on a structural fault. +**A receipt is carried, not reviewed again, over reads that did not change.** +The receipts sub-verb's carry, given the commit the receipts name, moves each +required gate's receipt from the commit its reviewer read to HEAD when no path that gate reads differs between +the two commits as git stores them, rewriting its subject to HEAD and naming the +commit read in `carriedFrom`; a gate whose reads changed keeps its receipt where +it was, and the report names each changed path for its reviewer to read +(iss-2612022218233502, dcn-2612022235231317). No gate reads the working tier; +the docs-currency reviewer reads none of the design record but the archived +release pages and the release-gate manifest; the brief cross-check reads +neither `docs/` nor the cut's own outputs; any other gate reads every path but +the working tier. A receipt already naming HEAD is never replaced. It exits 0 +when every receipt was carried, 1 when any was left, and 2 when the sha is not +an earlier commit this clone holds. The release job is unchanged: a carried +receipt names the content commit like any other, so the v0.18.0 cut's four +rolls, each running both reviews again, become one roll and a review of what +changed. + `commands/launch.md` carries the emit, compose and ingest orchestration over the `release-changelog-composer` agent, including the release page's retry loop. The deterministic emit alone is the cut the preview renders, read-only and @@ -1140,7 +1162,9 @@ Sub-verbs: none. Sub-verbs: none. -Flags: none. +| Flag | Type | +|---|---| +| `--carry` | string | ### `abcd launch reland` diff --git a/.abcd/development/release-gate/README.md b/.abcd/development/release-gate/README.md index d59da8e0ab..65ba95af35 100644 --- a/.abcd/development/release-gate/README.md +++ b/.abcd/development/release-gate/README.md @@ -150,13 +150,16 @@ against the exact commit to be tagged: ## Recording the semantic verdict -**A receipt names the commit its reviewer READ, and lives in a LATER commit** — -it can never sit in the tree of the commit it names, because adding it would -change that commit's sha. Under changelog-driven auto-release (adr-37) the -release branch is therefore the CHANGELOG roll (the release-content commit -the reviewers read), then the semantic receipts naming it, then, when a review -defers a finding, the captures: one open issue record per deferred finding, -committed after the receipts (see *Dispositions* below). On merge, the released tree carries the receipts, and `release.yml` derives +**A receipt names the commit its reviewer READ, or the commit it was carried +to over reads that did not change (see *Carrying a receipt* below), and lives +in a LATER commit** — it can never sit in the tree of the commit it names, +because adding it would change that commit's sha. Under changelog-driven +auto-release (adr-37) the release branch is therefore the CHANGELOG roll (the +release-content commit every receipt names), then the semantic receipts naming +it, then, when a review +defers a finding after the roll, its capture: one open issue record per deferred +finding, committed after the receipts (a finding deferred before the roll is +captured beside the fixes; see *Dispositions* below). On merge, the released tree carries the receipts, and `release.yml` derives the *content* commit from the **receipts directory** it carries — the receipts name the commit they gate, so `record-lint --derive-content-sha` reads the `.abcd/work/reviews//` entry on the released lineage and returns that `` @@ -358,12 +361,13 @@ Naming an older open record is correct when that record really is this finding: a defect already captured is deferred to the record that holds it, not captured twice. -**The captures land after the receipts.** A deferred entry's record is read from -the tree the release job checks out, so it is committed on the release branch in -a commit after the receipts commit, and the merge tree holds it. It cannot ride -in the roll: the reviewers read the roll before any finding exists, and the -receipts name the roll's sha. `abcd launch receipts` refuses while a capture, -like a receipt, is still uncommitted. +**The captures land on the release branch.** A deferred entry's record is read +from the tree the release job checks out, so it is committed on the release +branch and the merge tree holds it: before the roll, beside the fixes, when the +review ran before the roll, and in a commit after the receipts commit for a +finding made after it. A capture is in the working tier, which no gate reads, +so committing one never stops a receipt being carried. `abcd launch receipts` +refuses while a capture, like a receipt, is still uncommitted. **A record resolved before the merge.** A deferral may name an older open record that really is the finding. If a peer pull request, or an entry batched with the @@ -463,24 +467,81 @@ family + `gh` the binary provenance already uses). > away. Full forgery-prevention would need host-side signing at receipt > production — a later step if the threat model warrants it. +## Carrying a receipt + +A fix a review asks for makes a new content commit, and a receipt names the +commit its reviewer read, so without a carry every fix leaves every receipt +naming a commit the release does not end at, and every review runs again: the +v0.18.0 cut rolled its release commit four times in 72 minutes +(iss-2612022218233502). `abcd launch receipts --carry ` moves each required +gate's receipt from `.abcd/work/reviews//` to HEAD's directory when no path +that gate reads differs between `` and HEAD, as git stores the two +commits. The carried receipt names HEAD in `subject.digest.gitCommit` and the +commit its reviewer read in `carriedFrom`; everything else in it is kept. A +gate whose reads changed keeps its receipt where it was, and the report names +each changed path, so its reviewer reads only those and records its receipt for +HEAD. A receipt already naming HEAD is never replaced. It exits 0 when every +gate's receipt was carried, 1 when any was left, and 2 when `` is not the +full sha of an earlier commit this clone holds. + +What each gate reads ([dcn-2612022235231317](../../work/decisions/dcn-2612022235231317-fix-iss-2612022218233502-by-carrying.md)): + +- **No gate** reads the working tier, `.abcd/work/` — the receipts, the + captures and the decisions a cut writes after the reviews — or the receipts + directory. +- **`docs-currency-reviewer`** reads every other path except the design record, + `.abcd/development/`, of which it reads only `releases/` (the archived release + pages) and `release-gate/` (the manifest every receipt echoes). A brief fix + the cross-check asks for leaves its review standing. +- **`iss35-brief-surface-crosscheck`** reads every other path except `docs/` + and the cut's own outputs: `CHANGELOG.md`, `RELEASE.md`, + `.abcd/development/releases/`, the declared release digest, the catalog + (`.claude-plugin/marketplace.json`) and the surface snapshot. A docs fix, or a + roll that rewrites only the cut's own outputs, leaves its review standing. +- **Any other gate** reads every path but the working tier and the receipts. + +The release job is unchanged: a carried receipt is a receipt naming the content +commit, which the derivation, `receipt_gate` and the attestation read exactly as +they read one a reviewer wrote for it, and a change to any path a gate reads +still leaves its receipt behind. + ## Procedure -1. **Roll the changelog.** On a release branch, `abcd launch ship` composes the - dated section from the records that shipped; commit it. That commit is the - content commit, R: the commit the reviewers read and every receipt names. -2. **Review R.** Run the two semantic gates above against R in the harness. -3. **Capture each deferred finding** as its own open issue record with +1. **Review before the roll.** On a release branch, `abcd launch ship` emits the + cut and the composer writes the changelog payload. Run the two semantic gates + above against the commit the branch will roll from. The docs-currency + reviewer also reads the composed payload itself: its `entries` and + `press_release` are the prose the roll writes word for word. The practice + run, `abcd launch ship --changelog-json --dry-run`, checks the payload + against the cut and writes nothing. Commit each fix before the roll, and make + a prose fix in the payload, so the roll happens once and leaves no revert in + the history (iss-2611060603323399). +2. **Capture each deferred finding** as its own open issue record with `abcd capture`, one record per finding, so its id exists before its receipt - entry names it. -4. **Commit the receipts**, keyed to R's full sha at - `.abcd/work/reviews//.json`, each finding dispositioned `fixed`, - `invalid` or `deferred`, a deferred one with its `record`. -5. **Commit the captures** after the receipts, so the merge tree holds them. -6. **Run `abcd launch receipts`** on the release branch: the release job's + entry names it, and commit the captures with the fixes before the roll. +3. **Record the receipts** at `.abcd/work/reviews//.json`, keyed to + the full sha of the commit each reviewer read, each finding dispositioned + `fixed`, `invalid` or `deferred`, a deferred one with its `record`, and commit + them before the roll, whose pre-flight refuses a tree with uncommitted + changes. +4. **Roll the changelog.** `abcd launch ship --changelog-json ` writes the + dated section from the reviewed payload; commit it. That commit is the + content commit, R: the commit every receipt names once carried. +5. **Carry the receipts to R** with `abcd launch receipts --carry `. A gate + it leaves is reviewed again over the paths it names, and its receipt + recorded for R. The roll writes the changelog, the release page and the + catalog, which the docs-currency reviewer reads, so its review is left and + reads those few files again, as written, against the payload it read in the + practice run; the cross-check's is carried. +6. **Commit the carried receipts** on top of R, then the capture of any finding + made after the roll, so the merge tree holds it. A fix after this is a commit + on top, which becomes the content commit: carry the receipts to it the same + way. +7. **Run `abcd launch receipts`** on the release branch: the release job's receipt gate, run locally. Merge only when it exits 0. -7. **Open the pull request and enter the merge queue.** `ci.yml`'s required +8. **Open the pull request and enter the merge queue.** `ci.yml`'s required checks gate the merge. -8. **Auto-release tags after `verify` passes.** On the merge, `auto-release.yml` +9. **Auto-release tags after `verify` passes.** On the merge, `auto-release.yml` reads the new dated heading and calls `release.yml`, whose `verify` job arms `receipt_gate` fail-closed against R, derived from the receipts directory, alongside the deterministic gates, **before the tag** (adr-52). Its `tag` diff --git a/.abcd/development/release/surface.json b/.abcd/development/release/surface.json index 8bc1c1ecd3..1ad37a2196 100644 --- a/.abcd/development/release/surface.json +++ b/.abcd/development/release/surface.json @@ -3833,7 +3833,15 @@ "path": "abcd launch receipts", "hidden": false, "sentence": "Run the release job's semantic-receipt gate locally, before the merge: Writes nothing; refuses with exit 1 when the release job would refuse the receipts.", - "flags": [] + "flags": [ + { + "name": "carry", + "shorthand": "", + "type": "string", + "required": false, + "hidden": false + } + ] }, { "path": "abcd launch reland", diff --git a/.abcd/work/issues/open/iss-2611060603323399-cut-prose-is-judged-only-after-the-roll.md b/.abcd/work/issues/resolved/iss-2611060603323399-cut-prose-is-judged-only-after-the-roll.md similarity index 81% rename from .abcd/work/issues/open/iss-2611060603323399-cut-prose-is-judged-only-after-the-roll.md rename to .abcd/work/issues/resolved/iss-2611060603323399-cut-prose-is-judged-only-after-the-roll.md index c753eb5d7f..a27b923e91 100644 --- a/.abcd/work/issues/open/iss-2611060603323399-cut-prose-is-judged-only-after-the-roll.md +++ b/.abcd/work/issues/resolved/iss-2611060603323399-cut-prose-is-judged-only-after-the-roll.md @@ -13,6 +13,8 @@ refines: [iss-2612022218233502] remedy: "Give launch ship a prose-only review step on the changelog JSON before the roll, using the docs gate's reviewer on the payload, so a correction edits the payload and leaves no revert in the history." deferred_after: v0.16.2 deferral_reason: "The cost is process only: a round of prose findings costs a revert and a re-roll at the cut, and nothing a release ships is affected. The fix adds a review step to the cut and wants its own review, so it follows in the next cycle." +resolution: "Fixed with iss-2612022218233502, its wider case: the receipts protocol launch ship prints has the docs review read the composed changelog payload before the roll, with the practice run checking it against the cut, so a prose fix edits the payload and the roll happens once, leaving no revert." +impact: fix --- A cut's changelog and release page are judged only after the roll is committed, so each round of prose findings costs a revert and a re-roll; the v0.16.2 docs gate found 2 major and 9 minor overclaims after the first roll. launch ship cites records and nothing compares prose to code before the roll. diff --git a/.abcd/work/issues/open/iss-2612022218233502-a-release-cut-s-docs-reviews-run-after.md b/.abcd/work/issues/resolved/iss-2612022218233502-a-release-cut-s-docs-reviews-run-after.md similarity index 75% rename from .abcd/work/issues/open/iss-2612022218233502-a-release-cut-s-docs-reviews-run-after.md rename to .abcd/work/issues/resolved/iss-2612022218233502-a-release-cut-s-docs-reviews-run-after.md index c6681cdc07..8f68a294f4 100644 --- a/.abcd/work/issues/open/iss-2612022218233502-a-release-cut-s-docs-reviews-run-after.md +++ b/.abcd/work/issues/resolved/iss-2612022218233502-a-release-cut-s-docs-reviews-run-after.md @@ -10,6 +10,8 @@ origin: researcher-authored production_mode: hand-written found_at: "internal/core/release/protocol.go" remedy: "key the docs-currency and cross-check receipts to what was reviewed (each page's and the changelog payload's digest) rather than the roll commit's sha, accept a pre-run review whose pages are unchanged, and let launch ship take a reviewed changelog payload before the roll, so the roll happens once; this changes the documented rule at protocol.go:65-69 that keys a receipt to the release commit, so the protocol's text and its tests change with it" +resolution: "Fixed by carrying receipts: abcd launch receipts --carry moves each required gate's receipt to HEAD when no path that gate reads changed since its reviewer read it, and names the changed paths otherwise, so a fix re-runs only the review it touched; the receipts protocol runs both reviews before the roll, reading the composed changelog payload, so the roll happens once (dcn-2612022235231317)." +impact: additive --- A release cut's docs reviews run after the release commit is rolled and their receipts are keyed to that commit's sha (internal/core/release/protocol.go:65-69), so every fix a review asks for re-rolls the commit and orphans every receipt, and the reviews run again. The v0.18.0 cut rolled its release commit four times in 72 minutes, and its docs reviews and rolls took 04:07 to 06:58. diff --git a/commands/launch.md b/commands/launch.md index 2ced101a55..800578e570 100644 --- a/commands/launch.md +++ b/commands/launch.md @@ -1,7 +1,7 @@ --- name: launch description: "Preview the release cut, the launch bundle, its secret scan and the gates: Writes only its pre-flight report, to the local tier; refuses without --dry-run." -argument-hint: "[--dry-run [--deep-smoke] [--baseline ] [--fetch-baseline]] | ship [--changelog-json ] [--payload-dir ] [--allow-dirty] [--fetch-baseline] [--dry-run] | archive --out [--tag ] [--verify] [--repository ] | manifests --tree public|dev [--root ] | receipts | reland [] [--assisted-by :] | scaffold [--confirm] [--dependency-reauthor]" +argument-hint: "[--dry-run [--deep-smoke] [--baseline ] [--fetch-baseline]] | ship [--changelog-json ] [--payload-dir ] [--allow-dirty] [--fetch-baseline] [--dry-run] | archive --out [--tag ] [--verify] [--repository ] | manifests --tree public|dev [--root ] | receipts [--carry ] | reland [] [--assisted-by :] | scaffold [--confirm] [--dependency-reauthor]" block: people --- @@ -634,12 +634,20 @@ refused cut derives no version and lists no move. The ingest moves exactly this list, so relay it as what the write will change. The emit render ends with the **receipts protocol**, a numbered checklist the -binary composes from the committed `release.yml`: commit the roll, run each -semantic gate the release job requires against that commit, key every receipt -to its full sha, commit the receipts on top so the branch is the roll and then -the receipts naming it, disposition every finding a receipt records as fixed, -invalid or deferred and commit one open issue record per deferred finding after -the receipts, then run `launch receipts`. `--json` carries it as `receipts_protocol` +binary composes from the committed `release.yml`: run each semantic gate the +release job requires before the roll, the changelog review reading the composed +payload itself, whose `entries` and `press_release` the roll writes word for +word, with the practice run (`launch ship --changelog-json --dry-run`) +checking it against the cut, and commit the fixes first, a prose fix in the +payload, so the roll happens once; key each +receipt to the full sha of the commit its reviewer read and commit it before +the roll, whose pre-flight refuses uncommitted changes; roll; carry the +receipts to the roll with `launch receipts --carry ` and review again only +the paths it names; commit the receipts on top so the branch is the roll and +then the receipts naming it; disposition every finding a receipt records as +fixed, invalid or deferred, with one open issue record per deferred finding +committed before the roll or after the receipts; then run `launch receipts`. +`--json` carries it as `receipts_protocol` (`required_gates`, `steps`). Relay it with the cut; in a repository whose release workflow arms no semantic gate it says no receipt is required. @@ -1214,6 +1222,43 @@ Exit codes: an amend; nothing has merged. - **2** — a structural fault (the repository or its workflow could not be read). +### Carry the receipts instead of reviewing again + +A fix a review asks for, or the roll itself after a review before it, makes a new +content commit, and every receipt still names the commit its reviewer read. +Carry them rather than run every review again: + +```bash +"${CLAUDE_PLUGIN_ROOT}/abcd" launch receipts --carry --json +``` + +`` is the full sha the receipts name, the directory under +`.abcd/work/reviews/`. Each required gate's receipt moves to HEAD's directory +when no path that gate reads differs between `` and HEAD as git stores +them: its `subject.digest.gitCommit` becomes HEAD, `carriedFrom` names the +commit its reviewer read, and nothing else in it changes. A gate whose reads +changed keeps its receipt where it was, and its entry in `gates` names each +changed path (`changed`, then `more_changed` past fifty); have that gate's +reviewer read only those paths and record its receipt for HEAD. A receipt +already naming HEAD is never replaced. No gate reads the working tier +(`.abcd/work/`); the docs-currency reviewer reads none of the design record +(`.abcd/development/`) but its `releases/` and `release-gate/`; the brief +cross-check reads neither `docs/` nor the cut's own outputs (the changelog, the +release page, the archived release pages, the release digest, the catalog and +the surface snapshot); any other gate reads every path but the working tier. +The release job reads a carried receipt as it reads any receipt naming the +content commit; nothing about the gate changes. + +Exit codes: + +- **0** — every required gate's receipt now names HEAD (or `release.yml` arms no + semantic gate). Commit the receipts and run `launch receipts`. +- **1** — a gate's receipt was left: `reason` says why. Relay the paths to + review again, or the receipt to fix. +- **2** — `` is not the full sha of a commit this clone holds, is HEAD + itself, or the repository, its workflow or the record-lint config could not be + read. Nothing was moved. + ## Archive — the release's pinned plugin archive `archive` renders the plugin archive of the release the newest dated CHANGELOG @@ -1502,7 +1547,7 @@ plugin-root binary, and the plugin-root binary while it prints nothing. - An example call is `abcd launch manifests --tree public`. - What usually follows: - `abcd launch --dry-run`, to preview the rest of the release gates. -- `abcd launch receipts [flags]` +- `abcd launch receipts [--carry ] [flags]` - An example call is `abcd launch receipts`. - What usually follows: - `abcd launch --dry-run`, to preview the rest of the release gates. diff --git a/docs/reference/cli/commands.md b/docs/reference/cli/commands.md index c730d922f6..83a1c4d3d5 100644 --- a/docs/reference/cli/commands.md +++ b/docs/reference/cli/commands.md @@ -5910,7 +5910,26 @@ abcd launch manifests --tree public Run the release job's semantic-receipt gate locally, before the merge: Writes nothing; refuses with exit 1 when the release job would refuse the receipts. -**Usage:** `abcd launch receipts` +**Usage:** `abcd launch receipts [--carry ] [flags]` + +Run the release job's receipt gate on this branch before the merge. + +With --carry , carry the receipts instead: each required gate's receipt under +.abcd/work/reviews// moves to HEAD, its subject rewritten to HEAD and carriedFrom +naming the commit its reviewer read, when no path that gate reads differs between +and HEAD as git stores them. A gate whose reads changed keeps its receipt where it was, and +the report names each changed path, so its reviewer reads only those. No gate reads the +working tier (.abcd/work/); the docs-currency reviewer reads none of the design record +(.abcd/development/) but its releases/ and release-gate/; the brief cross-check reads +neither docs/ nor the cut's own outputs (the changelog, the release page, the archived +release pages, the release digest, the catalog and the surface snapshot); any other gate +reads every path but the working tier. A receipt already naming HEAD is never replaced. + +**Flags:** + +``` + --carry string the full sha the receipts name: move each gate's receipt to HEAD when nothing that gate reads changed since +``` **Example:** diff --git a/docs/reference/cli/commands/launch.json b/docs/reference/cli/commands/launch.json index 1254884cdc..bfb35e44ac 100644 --- a/docs/reference/cli/commands/launch.json +++ b/docs/reference/cli/commands/launch.json @@ -100,8 +100,13 @@ { "path": "abcd launch receipts", "sentence": "Run the release job's semantic-receipt gate locally, before the merge: Writes nothing; refuses with exit 1 when the release job would refuse the receipts.", - "usage": "abcd launch receipts [flags]", - "flags": [], + "usage": "abcd launch receipts [--carry ] [flags]", + "flags": [ + { + "name": "carry", + "type": "string" + } + ], "inputs": [], "example": "abcd launch receipts", "next": [ diff --git a/internal/core/launch/lockstep.go b/internal/core/launch/lockstep.go index ffa0697f24..be357a02a3 100644 --- a/internal/core/launch/lockstep.go +++ b/internal/core/launch/lockstep.go @@ -60,10 +60,14 @@ type LockstepResult struct { ExitCode int `json:"exit_code"` // 0 ok, 1 drift, 2 unreadable } +// CatalogFile is the plugin catalog: the secondary version location, and the +// file a cut pins its plugin archive into. +const CatalogFile = ".claude-plugin/marketplace.json" + // Pinned secondary locations (adr-20 table). The primary is read from // version-location.json so an adr-19 relocation is absorbed without edits. const ( - marketplaceFile = ".claude-plugin/marketplace.json" + marketplaceFile = CatalogFile secondaryVersionPointer = "/plugins/0/version" secondaryChangelogPtr = "/plugins/0/changelog" changelogVersionPointer = "/plugins/0/changelog/version" diff --git a/internal/core/lint/receiptcarry.go b/internal/core/lint/receiptcarry.go new file mode 100644 index 0000000000..9e6c5a1f0a --- /dev/null +++ b/internal/core/lint/receiptcarry.go @@ -0,0 +1,358 @@ +package lint + +// receiptcarry.go — the receipt carry (iss-2612022218233502, +// dcn-2612022235231317): `abcd launch receipts --carry `. +// +// A receipt names the commit its reviewer read, and the release job admits a +// release only on receipts naming its content commit. Every fix a review asked +// for therefore made a new content commit and left every receipt naming the +// old one, though most of what each gate reads had not changed: the v0.18.0 +// cut rolled its release commit four times in 72 minutes and ran both reviews +// after each roll. +// +// The carry moves a gate's receipt from the commit its reviewer read to HEAD +// when no path that gate reads differs between the two commits as git stores +// them, and otherwise leaves it where it was and names the paths that did +// differ, which are all its reviewer has to read again. The release job's +// derivation, its gate and the receipts' shape are untouched: a carried +// receipt is a sha-keyed receipt naming HEAD, so `launch receipts` and the +// release job still read one receipt and cannot disagree, and a change to any +// path a gate reads still leaves that gate's receipt behind. + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "os" + "path" + "path/filepath" + "strconv" + "strings" + + "github.com/intentdriven/abcd/internal/core/jsonstrict" + "github.com/intentdriven/abcd/internal/fsutil" + "github.com/intentdriven/abcd/internal/gitutil" +) + +// The two gates abcd's own release requires, whose reads are narrower than +// the whole tree. A gate the carry does not know reads every path but the +// working tier, so a release workflow that names another gate loses nothing +// it read. +const ( + DocsCurrencyGate = "docs-currency-reviewer" + BriefCrosscheckGate = "iss35-brief-surface-crosscheck" +) + +const ( + // workingTierPrefix is the shared working tier: the receipts, the + // captures of deferred findings and the decisions a cut records. No + // reviewer reads it, and the cut writes to it after the reviews. + workingTierPrefix = ".abcd/work/" + // designRecordPrefix is the design record: the brief the cross-check + // judges, and the intents, decisions and plans behind it. The + // docs-currency reviewer judges user-facing text, which is none of it. + designRecordPrefix = ".abcd/development/" + // userDocsPrefix is the user documentation the docs-currency reviewer + // judges and the cross-check never reads. + userDocsPrefix = "docs/" +) + +// docsReadsInDesignRecord are the parts of the design record the +// docs-currency reviewer still reads: the archived release pages, which the +// cut writes from the release page it reviews, and the release-gate manifest, +// which every receipt echoes. +var docsReadsInDesignRecord = []string{".abcd/development/releases/", ".abcd/development/release-gate/"} + +// maxCarryChanged bounds the changed paths a gate's outcome lists; the rest +// are counted. +const maxCarryChanged = 50 + +// ReceiptCarry is what `launch receipts --carry` did for each required gate. +type ReceiptCarry struct { + // Gate is the release workflow's arming, read as `launch receipts` reads it. + Gate ReleaseGate `json:"release_gate"` + // From is the commit the receipts named, and To is HEAD, the commit a + // carried receipt names. + From string `json:"from"` + To string `json:"to"` + // Gates is each required gate's outcome, in the workflow's order. + Gates []GateCarry `json:"gates"` +} + +// GateCarry is one gate's outcome. +type GateCarry struct { + Gate string `json:"gate"` + // Carried reports that the gate's receipt now names To, at Path. + Carried bool `json:"carried"` + Path string `json:"path,omitempty"` + // Reason says why the receipt was left, or, beside Carried, what the + // carry could not finish (the old receipt left in place). + Reason string `json:"reason,omitempty"` + // Changed is each path the gate reads that differs between From and To, + // at most maxCarryChanged of them; MoreChanged counts the rest. + Changed []string `json:"changed,omitempty"` + MoreChanged int `json:"more_changed,omitempty"` +} + +// Complete reports that no required gate's receipt was left behind: every +// one was carried, or the workflow requires none. +func (c ReceiptCarry) Complete() bool { + for _, g := range c.Gates { + if !g.Carried { + return false + } + } + return true +} + +// gateReads reports, for gate, whether it reads the repository-relative path +// p. The receipts directory and the working tier are read by no gate; the +// docs-currency reviewer reads no design record but the archived release +// pages and the release-gate manifest; the cross-check reads no user page and +// none of the cut's own outputs (cutOutputs, a trailing slash naming a +// directory). Every other path is read by every gate. +func gateReads(gate, receiptsDir string, cutOutputs []string) func(string) bool { + under := func(p, dir string) bool { + dir = strings.TrimSuffix(dir, "/") + return p == dir || strings.HasPrefix(p, dir+"/") + } + anyGate := func(p string) bool { return !under(p, workingTierPrefix) && !under(p, receiptsDir) } + switch gate { + case DocsCurrencyGate: + return func(p string) bool { + if !anyGate(p) { + return false + } + if !under(p, designRecordPrefix) { + return true + } + for _, d := range docsReadsInDesignRecord { + if under(p, d) { + return true + } + } + return false + } + case BriefCrosscheckGate: + return func(p string) bool { + if !anyGate(p) || under(p, userDocsPrefix) { + return false + } + for _, o := range cutOutputs { + if under(p, o) { + return false + } + } + return true + } + } + return anyGate +} + +// CarryReceipts carries the receipts naming from to HEAD in root, gate by gate +// (see the file comment). cutOutputs are the paths the release cut writes +// (release.CutOutputs), which the cross-check does not read. +// +// It returns an error, moving nothing, when from is not the full sha of a +// commit this clone holds, when from is HEAD itself, or when the workflow, +// the record-lint config or git cannot be read. A gate whose receipt is +// absent, unreadable, names another commit or another gate, whose reads +// changed, or for which a receipt naming HEAD already exists, is left and +// says why; the carry never replaces a receipt. +func CarryReceipts(root, from string, cutOutputs []string) (ReceiptCarry, error) { + gate, err := ReadReleaseGate(root) + if err != nil { + return ReceiptCarry{}, err + } + c := ReceiptCarry{Gate: gate, Gates: []GateCarry{}} + if !receiptShaRe.MatchString(from) { + return c, fmt.Errorf("%q is not a full commit sha; carry from the sha the receipts name, the directory under %s", from, reviewsSubdir) + } + if typ, err := gitutil.RunCappedAsStored(root, maxGitAnswerBytes, "cat-file", "-t", from); err != nil || typ != "commit" { + return c, fmt.Errorf("%s names no commit this clone holds, so what its reviewer read cannot be compared", from) + } + head, err := gitutil.RunCappedAsStored(root, maxGitAnswerBytes, "rev-parse", "--verify", "HEAD^{commit}") + if err != nil { + return c, err + } + if head == from { + return c, fmt.Errorf("HEAD is %s, which the receipts already name; there is nothing to carry", from) + } + c.From, c.To = from, head + if !gate.Armed { + return c, nil + } + cfg, err := LoadConfig(filepath.Join(root, filepath.FromSlash(recordLintConfigPath))) + if err != nil { + return c, errors.New(ErrReceiptConfig.Error() + ": " + pathFree(err)) + } + dir := ArmReceiptGate(cfg, head, gate.Gates).Rules["receipt_gate"].ReceiptsDir + if dir == "" { + dir = reviewsSubdir + } + dir = path.Clean(filepath.ToSlash(dir)) + if err := containedRepoPath(dir); err != nil { + return c, fmt.Errorf("receipt_gate receipts_dir %s %s", quote(dir), err.Error()) + } + if err := resolvedInsideRoot(root, filepath.Join(root, filepath.FromSlash(dir))); err != nil { + return c, fmt.Errorf("receipt_gate receipts_dir %s %s", quote(dir), err.Error()) + } + changed, err := changedBetween(root, from, head) + if err != nil { + return c, err + } + r, err := os.OpenRoot(root) + if err != nil { + return c, err + } + defer r.Close() + for _, g := range gate.Gates { + c.Gates = append(c.Gates, carryGate(r, dir, g, from, head, changed, gateReads(g, dir, cutOutputs))) + } + return c, nil +} + +// changedBetween is every path that differs between the trees of from and to, +// read as git stores them, in git's order. Renames are two paths, the old and +// the new, so a moved file a gate reads is named on either side. +func changedBetween(root, from, to string) ([]string, error) { + out, err := gitutil.RunCappedAsStored(root, maxReceiptStatusBytes, + "diff", "--name-only", "-z", "--no-renames", "--no-ext-diff", "--no-textconv", from, to, "--") + if err != nil { + return nil, fmt.Errorf("comparing %s with HEAD: %w", from, err) + } + var paths []string + for _, p := range strings.Split(out, "\x00") { + if p != "" { + paths = append(paths, p) + } + } + return paths, nil +} + +// carryGate carries one gate's receipt, or says why it was left. +func carryGate(r *os.Root, dir, gate, from, to string, changed []string, reads func(string) bool) GateCarry { + out := GateCarry{Gate: gate} + if !receiptGateRe.MatchString(gate) { + out.Reason = "the gate name is not a safe path component" + return out + } + for _, p := range changed { + if !reads(p) { + continue + } + if len(out.Changed) < maxCarryChanged { + out.Changed = append(out.Changed, p) + } else { + out.MoreChanged++ + } + } + src := dir + "/" + from + "/" + gate + ".json" + dst := dir + "/" + to + "/" + gate + ".json" + data, err := fsutil.ReadGuardedInRoot(r, src, maxReceiptBytes) + switch { + case os.IsNotExist(err): + out.Reason = "no receipt at " + src + return out + case err != nil: + out.Reason = src + " cannot be read safely (" + guardedReason(err) + ")" + return out + } + if n := len(out.Changed) + out.MoreChanged; n > 0 { + out.Reason = "it reads " + strconv.Itoa(n) + " path(s) that changed since " + from + + "; its reviewer reads them and records its receipt for " + to + return out + } + if _, err := r.Lstat(dst); err == nil { + out.Reason = "a receipt already names " + to + " at " + dst + ", and a carry never replaces one" + return out + } else if !os.IsNotExist(err) { + out.Reason = dst + " cannot be checked (" + bareCause(err) + ")" + return out + } + carried, err := carriedReceipt(data, gate, from, to) + if err != nil { + out.Reason = "the receipt at " + src + " " + err.Error() + return out + } + if err := fsutil.WriteFileAtomicInRoot(r, dst, carried, 0o644); err != nil { + out.Reason = "writing " + dst + ": " + bareCause(err) + return out + } + out.Carried, out.Path = true, dst + if err := r.Remove(src); err != nil { + out.Reason = "the receipt for " + from + " could not be removed (" + bareCause(err) + "); remove " + src + " by hand" + return out + } + // The directory goes with its last receipt; one still holding another + // gate's receipt, or anything else, stays. + _ = r.Remove(dir + "/" + from) + return out +} + +// carriedReceipt is the receipt data rewritten to name to: its subject's +// gitCommit is to, and carriedFrom names the commit its reviewer read — the +// first one, when the receipt was carried before. The receipt must parse +// under the gate's own reading (no repeated key), name from, and attest gate; +// every other field is kept as it was. +func carriedReceipt(data []byte, gate, from, to string) ([]byte, error) { + if err := jsonstrict.NoDuplicateKeys(data); err != nil { + return nil, errors.New("is refused: " + err.Error()) + } + var rc receipt + if err := json.Unmarshal(data, &rc); err != nil { + return nil, errors.New("is malformed JSON: " + err.Error()) + } + if rc.Subject.Digest.GitCommit != from { + return nil, fmt.Errorf("names %s, not %s, so it is no review of %s", quote(rc.Subject.Digest.GitCommit), from, from) + } + if strings.TrimSpace(rc.Policy.Detector) != gate { + return nil, fmt.Errorf("attests detector %s, not %s", quote(rc.Policy.Detector), gate) + } + var top map[string]json.RawMessage + if err := json.Unmarshal(data, &top); err != nil { + return nil, errors.New("is malformed JSON: " + err.Error()) + } + subjectKey := foldKey(top, "subject") + var subject map[string]json.RawMessage + if err := json.Unmarshal(top[subjectKey], &subject); err != nil { + return nil, errors.New("has a subject that is not an object") + } + digestKey := foldKey(subject, "digest") + var digest map[string]json.RawMessage + if err := json.Unmarshal(subject[digestKey], &digest); err != nil { + return nil, errors.New("has a subject digest that is not an object") + } + digest[foldKey(digest, "gitCommit")] = json.RawMessage(strconv.Quote(to)) + var err error + if subject[digestKey], err = json.Marshal(digest); err != nil { + return nil, err + } + if top[subjectKey], err = json.Marshal(subject); err != nil { + return nil, err + } + if _, ok := top[foldKey(top, "carriedFrom")]; !ok { + top["carriedFrom"] = json.RawMessage(strconv.Quote(from)) + } + var buf bytes.Buffer + enc := json.NewEncoder(&buf) + enc.SetEscapeHTML(false) + enc.SetIndent("", " ") + if err := enc.Encode(top); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// foldKey is the key of m equal to name under Unicode case folding, as +// encoding/json binds one, or name itself when m has none. The receipt has +// passed the duplicate-key check, so there is at most one. +func foldKey(m map[string]json.RawMessage, name string) string { + for k := range m { + if strings.EqualFold(k, name) { + return k + } + } + return name +} diff --git a/internal/core/lint/receiptcarry_test.go b/internal/core/lint/receiptcarry_test.go new file mode 100644 index 0000000000..0c5a605756 --- /dev/null +++ b/internal/core/lint/receiptcarry_test.go @@ -0,0 +1,270 @@ +package lint_test + +import ( + "encoding/json" + "os" + "path/filepath" + "reflect" + "strings" + "testing" + + "github.com/intentdriven/abcd/internal/core/lint" + "github.com/intentdriven/abcd/internal/gittest" +) + +// The receipt carry (iss-2612022218233502): a review done at one commit still +// counts at a later one when nothing the gate reads differs between them, so a +// fix or a re-roll that leaves a gate's reads alone does not send that gate's +// review round again. + +const ( + docsGate = "docs-currency-reviewer" + crossGate = "iss35-brief-surface-crosscheck" +) + +// carryCutOutputs are the paths a fixture's cut writes, as the front door +// passes them. +var carryCutOutputs = []string{"CHANGELOG.md", "RELEASE.md", ".abcd/development/releases/", ".claude-plugin/marketplace.json"} + +// carryFixture is a release branch whose tip, the reviewed commit, carries a +// user page, code, a brief chapter and the cut's outputs, with a PROMOTE for +// each gate naming it in the working tree. It returns the reviewed commit. +func carryFixture(t *testing.T) (*gittest.Repo, string) { + t.Helper() + r, _ := releaseFixture(t) + r.Write("docs/guide.md", "a guide\n") + r.Write("internal/a/a.go", "package a\n") + r.Write(".abcd/development/brief/04-surfaces/01-a.md", "a chapter\n") + r.Write("RELEASE.md", "# 1.0.0\n") + r.Write(".claude-plugin/marketplace.json", "{}\n") + r.Commit("reviewed") + reviewed := r.Git("rev-parse", "HEAD") + writeReceipts(r, reviewed) + return r, reviewed +} + +// writeReceipts writes a PROMOTE for both gates naming commit. +func writeReceipts(r *gittest.Repo, commit string) { + dir := ".abcd/work/reviews/" + commit + "/" + r.Write(dir+docsGate+".json", promote(docsGate, commit)) + r.Write(dir+crossGate+".json", promote(crossGate, commit)) +} + +// advance commits a change to each path, leaving the receipts uncommitted as a +// re-roll leaves them, and returns the new HEAD. +func advance(t *testing.T, r *gittest.Repo, paths ...string) string { + t.Helper() + for _, p := range paths { + r.Write(p, "changed: "+p+"\n") + } + for _, p := range paths { + r.Git("add", "--", p) + } + r.Git("commit", "-m", "after the review") + return r.Git("rev-parse", "HEAD") +} + +func gateCarry(t *testing.T, c lint.ReceiptCarry, gate string) lint.GateCarry { + t.Helper() + for _, g := range c.Gates { + if g.Gate == gate { + return g + } + } + t.Fatalf("no outcome for gate %s in %+v", gate, c) + return lint.GateCarry{} +} + +func exists(t *testing.T, r *gittest.Repo, rel string) bool { + t.Helper() + _, err := os.Lstat(filepath.Join(r.Root(), filepath.FromSlash(rel))) + return err == nil +} + +// readCarried is the receipt at rel, decoded. +func readCarried(t *testing.T, r *gittest.Repo, rel string) map[string]any { + t.Helper() + data, err := os.ReadFile(filepath.Join(r.Root(), filepath.FromSlash(rel))) + if err != nil { + t.Fatal(err) + } + var m map[string]any + if err := json.Unmarshal(data, &m); err != nil { + t.Fatalf("carried receipt %s does not parse: %v\n%s", rel, err, data) + } + return m +} + +func subjectOf(m map[string]any) string { + s, _ := m["subject"].(map[string]any) + d, _ := s["digest"].(map[string]any) + c, _ := d["gitCommit"].(string) + return c +} + +func TestCarryReceiptsCarriesOnlyTheGateWhoseReadsAreUnchanged(t *testing.T) { + r, reviewed := carryFixture(t) + head := advance(t, r, "docs/guide.md") + + c, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs) + if err != nil { + t.Fatal(err) + } + if c.From != reviewed || c.To != head { + t.Errorf("carry from %s to %s, want %s to %s", c.From, c.To, reviewed, head) + } + cross := gateCarry(t, c, crossGate) + if !cross.Carried { + t.Fatalf("the cross-check reads no user page, so a docs fix must carry its receipt, got %+v", cross) + } + dst := ".abcd/work/reviews/" + head + "/" + crossGate + ".json" + m := readCarried(t, r, dst) + if subjectOf(m) != head || m["carriedFrom"] != reviewed { + t.Errorf("carried receipt must name %s and carry from %s, got subject %q carriedFrom %v", head, reviewed, subjectOf(m), m["carriedFrom"]) + } + if exists(t, r, ".abcd/work/reviews/"+reviewed+"/"+crossGate+".json") { + t.Errorf("a carried receipt is moved, not copied: the receipt for %s is still there", reviewed) + } + + docs := gateCarry(t, c, docsGate) + if docs.Carried || !reflect.DeepEqual(docs.Changed, []string{"docs/guide.md"}) { + t.Errorf("the docs review reads the page that changed: want it left, naming docs/guide.md, got %+v", docs) + } + if !exists(t, r, ".abcd/work/reviews/"+reviewed+"/"+docsGate+".json") || exists(t, r, ".abcd/work/reviews/"+head+"/"+docsGate+".json") { + t.Errorf("a receipt left uncarried stays where it was and nothing is written for %s", head) + } + if c.Complete() { + t.Errorf("a carry that left a gate is not complete") + } +} + +func TestCarryReceiptsCarriesNeitherGateOverACodeChange(t *testing.T) { + r, reviewed := carryFixture(t) + advance(t, r, "internal/a/a.go") + + c, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs) + if err != nil { + t.Fatal(err) + } + for _, gate := range []string{docsGate, crossGate} { + g := gateCarry(t, c, gate) + if g.Carried || !reflect.DeepEqual(g.Changed, []string{"internal/a/a.go"}) { + t.Errorf("every gate reads the code: %s must be left naming internal/a/a.go, got %+v", gate, g) + } + } +} + +func TestCarryReceiptsCarriesTheDocsReviewOverABriefFix(t *testing.T) { + r, reviewed := carryFixture(t) + head := advance(t, r, ".abcd/development/brief/04-surfaces/01-a.md") + + c, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs) + if err != nil { + t.Fatal(err) + } + if g := gateCarry(t, c, docsGate); !g.Carried { + t.Errorf("the docs review reads no brief chapter, so it must carry, got %+v", g) + } + if g := gateCarry(t, c, crossGate); g.Carried || !reflect.DeepEqual(g.Changed, []string{".abcd/development/brief/04-surfaces/01-a.md"}) { + t.Errorf("the cross-check reads the brief chapter that changed, got %+v", g) + } + if !exists(t, r, ".abcd/work/reviews/"+head+"/"+docsGate+".json") { + t.Errorf("the carried docs receipt must be written for %s", head) + } +} + +func TestCarryReceiptsCarriesTheCrossCheckOverTheRoll(t *testing.T) { + r, reviewed := carryFixture(t) + advance(t, r, "CHANGELOG.md", "RELEASE.md", ".claude-plugin/marketplace.json", ".abcd/development/releases/0.9.0.md") + + c, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs) + if err != nil { + t.Fatal(err) + } + if g := gateCarry(t, c, crossGate); !g.Carried { + t.Errorf("the cross-check reads none of the cut's own outputs, so a re-roll must carry it, got %+v", g) + } + want := []string{".abcd/development/releases/0.9.0.md", ".claude-plugin/marketplace.json", "CHANGELOG.md", "RELEASE.md"} + if g := gateCarry(t, c, docsGate); g.Carried || !reflect.DeepEqual(g.Changed, want) { + t.Errorf("the docs review reads the changelog and the release page: want it left naming %v, got %+v", want, g) + } +} + +func TestCarryReceiptsCarriesBothOverTheWorkingTierAndThenPasses(t *testing.T) { + r, reviewed := carryFixture(t) + rel, body := openIssue("iss-2612020000000001") + r.Write(rel, body) + r.Write(".abcd/work/decisions/dcn-2612020000000002-a.md", "a decision\n") + r.Git("add", "--", rel, ".abcd/work/decisions/") + r.Git("commit", "-m", "a capture and a decision") + head := r.Git("rev-parse", "HEAD") + + c, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs) + if err != nil { + t.Fatal(err) + } + if !c.Complete() { + t.Fatalf("no gate reads the working tier: both must carry, got %+v", c) + } + if exists(t, r, ".abcd/work/reviews/"+reviewed) { + t.Errorf("the emptied receipts directory of %s must go with its receipts", reviewed) + } + r.Commit("receipts") + check, err := lint.CheckReleaseReceipts(r.Root()) + if err != nil { + t.Fatal(err) + } + if !check.Pass || check.Commit != head { + t.Errorf("carried receipts must pass the release job's gate at %s, got %+v", head, check) + } +} + +func TestCarryReceiptsNeverOverwritesAReceipt(t *testing.T) { + r, reviewed := carryFixture(t) + head := advance(t, r, "docs/guide.md") + dst := ".abcd/work/reviews/" + head + "/" + crossGate + ".json" + own := strings.Replace(promote(crossGate, head), "claude-opus-4-8", "claude-opus-4-9", 1) + r.Write(dst, own) + + c, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs) + if err != nil { + t.Fatal(err) + } + if g := gateCarry(t, c, crossGate); g.Carried || !strings.Contains(g.Reason, "already") { + t.Errorf("a receipt already naming %s must stand, got %+v", head, g) + } + data, _ := os.ReadFile(filepath.Join(r.Root(), filepath.FromSlash(dst))) + if string(data) != own { + t.Errorf("the receipt already there was rewritten:\n%s", data) + } + if !exists(t, r, ".abcd/work/reviews/"+reviewed+"/"+crossGate+".json") { + t.Errorf("a receipt that was not carried must stay where it was") + } +} + +func TestCarryReceiptsLeavesAReceiptThatNamesAnotherCommit(t *testing.T) { + r, reviewed := carryFixture(t) + advance(t, r, "docs/guide.md") + other := strings.Repeat("a", 40) + r.Write(".abcd/work/reviews/"+reviewed+"/"+crossGate+".json", promote(crossGate, other)) + + c, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs) + if err != nil { + t.Fatal(err) + } + if g := gateCarry(t, c, crossGate); g.Carried || !strings.Contains(g.Reason, other) { + t.Errorf("a receipt naming %s is not a review of %s and must not carry, got %+v", other, reviewed, g) + } +} + +func TestCarryReceiptsRefusesAFromThatIsNotAnEarlierCommit(t *testing.T) { + r, reviewed := carryFixture(t) + for _, from := range []string{"HEAD", reviewed[:12], strings.Repeat("b", 40)} { + if _, err := lint.CarryReceipts(r.Root(), from, carryCutOutputs); err == nil { + t.Errorf("carry from %q must refuse: it names no commit by its full sha", from) + } + } + if _, err := lint.CarryReceipts(r.Root(), reviewed, carryCutOutputs); err == nil { + t.Errorf("carry from HEAD itself must refuse: there is nothing to carry") + } +} diff --git a/internal/core/release/cutoutputs.go b/internal/core/release/cutoutputs.go new file mode 100644 index 0000000000..eca90adca2 --- /dev/null +++ b/internal/core/release/cutoutputs.go @@ -0,0 +1,27 @@ +package release + +import ( + "github.com/intentdriven/abcd/internal/core/launch" + "github.com/intentdriven/abcd/internal/core/surface" +) + +// CutOutputs are the paths `abcd launch ship --changelog-json` writes in the +// repository at root, a trailing slash naming a directory: the changelog, the +// release page and the archive of the outgoing one, the release digest when +// the repository declares one, and the catalog pin and surface snapshot a +// plugin archive's pin rewrites. The receipt carry +// (lint.CarryReceipts, iss-2612022218233502) holds the brief cross-check to +// none of them, so a roll that changes only the cut's own outputs leaves its +// review standing. The intent records whose missed target a cut moves are +// not among them: the cross-check reads the design record they sit in. +func CutOutputs(root string) ([]string, error) { + out := []string{changelogFile, PageFile, ArchiveDir + "/", launch.CatalogFile, surface.SnapshotPath} + digest, err := declaredDigest(root) + if err != nil { + return nil, err + } + if digest != "" { + out = append(out, digest) + } + return out, nil +} diff --git a/internal/core/release/protocol.go b/internal/core/release/protocol.go index ce13368413..966eb02f1d 100644 --- a/internal/core/release/protocol.go +++ b/internal/core/release/protocol.go @@ -59,17 +59,33 @@ func ReceiptsProtocolFor(root string) (ReceiptsProtocol, error) { } default: p.Steps = []string{ - roll, - "Run each semantic gate `" + gate.Workflow + "` requires against the content commit: " + - strings.Join(gate.Gates, ", ") + ".", - "Record each PROMOTE receipt at `.abcd/work/reviews//.json`, keyed to the full " + - "sha of the content commit (`git rev-parse HEAD` right after step 1) — never the tag, " + - "and never the merge.", - "Commit the receipts on top: the release branch is the roll, then the receipts naming it. Amending " + - "the roll after this gives it a new sha and orphans every receipt.", + "Review before the roll. Run each semantic gate `" + gate.Workflow + "` requires against the commit " + + "the release branch will roll from: " + strings.Join(gate.Gates, ", ") + ". The review that reads " + + "the changelog reads the composed payload itself: its `entries` and `press_release` are the prose " + + "the roll writes word for word. The practice run (`abcd launch ship --changelog-json " + + "--dry-run`) checks the payload against the cut and writes nothing. Commit each fix a review " + + "asks for before the roll, and make a prose fix in the payload, so the roll happens once and " + + "leaves no revert in the history.", + "Record each PROMOTE receipt at `.abcd/work/reviews//.json`, keyed to the full sha of " + + "the commit its reviewer read, and commit the receipts before the roll, whose pre-flight refuses " + + "a tree with uncommitted changes.", + "Ingest the reviewed changelog (`abcd launch ship --changelog-json `) and commit the result " + + "on the release branch. That commit is the content commit: the commit every receipt names once " + + "carried. The release itself publishes from the tagged merge, not from this commit.", + "Carry the receipts to the content commit: `abcd launch receipts --carry `, with the sha the " + + "receipts name, moves each gate's receipt to `.abcd/work/reviews//.json` when " + + "nothing that gate reads changed since its reviewer read it, and otherwise leaves it and names the " + + "paths that changed. That gate's reviewer reads only those paths and records its receipt for the " + + "content commit (`git rev-parse HEAD`) — never the tag, and never the merge.", + "Commit the receipts on top: the release branch is the roll, then the receipts naming it. A fix " + + "after this is a commit on top of them, which becomes the content commit; carry the receipts to " + + "it with `--carry` and the sha they name, and only a gate whose reads the fix changed is " + + "reviewed again.", "Disposition every finding a receipt records as fixed, invalid or deferred. Capture each deferred " + "finding as its own open issue record (`abcd capture`), name it in the finding's `record` field, " + - "and commit the captures after the receipts, so the merged tree holds them.", + "and commit each capture before the roll, beside the fixes, or, for a finding made after the " + + "roll, after the receipts, so the merged tree holds it. No gate reads a capture, so committing " + + "one never stops a receipt being carried.", "Run `abcd launch receipts` on the release branch. It runs the release job's receipt gate locally " + "and names each missing or non-PROMOTE receipt; merge only when it exits 0.", } diff --git a/internal/core/release/protocol_test.go b/internal/core/release/protocol_test.go index 7fd12858b4..5ece3ad17e 100644 --- a/internal/core/release/protocol_test.go +++ b/internal/core/release/protocol_test.go @@ -58,6 +58,46 @@ func TestReceiptsProtocolNamesTheGatesTheCommitAndTheTwoCommitShape(t *testing.T } } +// TestReceiptsProtocolReviewsBeforeTheRollAndCarriesTheReceipts is +// iss-2612022218233502: the v0.18.0 cut rolled its release commit four times +// in 72 minutes because the reviews ran after the roll and every fix orphaned +// every receipt. The protocol has the reviews read the tree and the composed +// changelog before the roll, and carries each receipt to the content commit +// rather than running every review again. +func TestReceiptsProtocolReviewsBeforeTheRollAndCarriesTheReceipts(t *testing.T) { + root := t.TempDir() + writeWorkflow(t, root, "jobs:\n verify:\n steps:\n - run: |\n"+ + " go run ./cmd/record-lint --release-gate \"$content\" \\\n"+ + " --require-gate docs-currency-reviewer\n") + p, err := release.ReceiptsProtocolFor(root) + if err != nil { + t.Fatal(err) + } + review, roll, carry := -1, -1, -1 + for i, s := range p.Steps { + switch { + case strings.HasPrefix(s, "Review before the roll"): + review = i + case strings.HasPrefix(s, "Ingest the"): + roll = i + case strings.Contains(s, "abcd launch receipts --carry"): + carry = i + } + } + if review < 0 || roll < 0 || carry < 0 || !(review < roll && roll < carry) { + t.Fatalf("want the review, then the roll, then the carry; got review %d, roll %d, carry %d in:\n%s", + review, roll, carry, strings.Join(p.Steps, "\n")) + } + for _, want := range []string{"--changelog-json --dry-run", "the roll happens once"} { + if !strings.Contains(p.Steps[review], want) { + t.Errorf("the review step must carry %q:\n%s", want, p.Steps[review]) + } + } + if all := strings.Join(p.Steps, "\n"); strings.Contains(all, "orphans every receipt") { + t.Errorf("a fix after the receipts no longer orphans them; steps:\n%s", all) + } +} + // TestReceiptsProtocolWithNoGateRequiresNoReceipt is the AC3 degradation seen // from the emit step: a workflow that arms no semantic gate gets a protocol // that says no receipt is required, never one that asks for receipts nothing @@ -101,7 +141,12 @@ func TestReceiptsProtocolSaysTheReleasePublishesFromTheTaggedMerge(t *testing.T) if err != nil { t.Fatal(err) } - roll := p.Steps[0] + roll := "" + for _, s := range p.Steps { + if strings.HasPrefix(s, "Ingest the") { + roll = s + } + } if strings.Contains(roll, "publishes from and") { t.Errorf("the roll step says the content commit is what the release publishes from:\n%s", roll) } diff --git a/internal/surface/cli/launch_receipts.go b/internal/surface/cli/launch_receipts.go index b198ee927b..b555044c93 100644 --- a/internal/surface/cli/launch_receipts.go +++ b/internal/surface/cli/launch_receipts.go @@ -9,6 +9,7 @@ import ( "github.com/intentdriven/abcd/internal/core/lint" "github.com/intentdriven/abcd/internal/core/release" "github.com/intentdriven/abcd/internal/fsutil" + "github.com/intentdriven/abcd/internal/gitutil" "github.com/intentdriven/abcd/internal/termsafe" "github.com/spf13/cobra" ) @@ -32,9 +33,28 @@ import ( // the commit it must name, each finding whose disposition the release gate // refuses, and each uncommitted receipt or capture. // - 2 — a structural fault (the repository or its workflow could not be read). +// +// With --carry it carries the receipts instead (iss-2612022218233502): +// each required gate's receipt naming moves to HEAD when nothing that +// gate reads differs between the two commits (lint.CarryReceipts). It exits 0 +// when every gate's receipt was carried, 1 when any was left, naming the paths +// its reviewer reads again, and 2 on a structural fault or a that is no +// earlier commit. func newLaunchReceiptsCommand(asJSON *bool) *cobra.Command { - return &cobra.Command{ - Use: "receipts", + var carry string + cmd := &cobra.Command{ + Use: "receipts [--carry ]", + Long: "Run the release job's receipt gate on this branch before the merge.\n\n" + + "With --carry , carry the receipts instead: each required gate's receipt under\n" + + ".abcd/work/reviews// moves to HEAD, its subject rewritten to HEAD and carriedFrom\n" + + "naming the commit its reviewer read, when no path that gate reads differs between \n" + + "and HEAD as git stores them. A gate whose reads changed keeps its receipt where it was, and\n" + + "the report names each changed path, so its reviewer reads only those. No gate reads the\n" + + "working tier (.abcd/work/); the docs-currency reviewer reads none of the design record\n" + + "(.abcd/development/) but its releases/ and release-gate/; the brief cross-check reads\n" + + "neither docs/ nor the cut's own outputs (the changelog, the release page, the archived\n" + + "release pages, the release digest, the catalog and the surface snapshot); any other gate\n" + + "reads every path but the working tier. A receipt already naming HEAD is never replaced.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { cwd, err := os.Getwd() @@ -44,6 +64,9 @@ func newLaunchReceiptsCommand(asJSON *bool) *cobra.Command { if _, err := launchArtefact("abcd launch receipts", cwd); err != nil { return err } + if cmd.Flags().Changed("carry") { + return runReceiptsCarry(cmd, cwd, carry, *asJSON) + } check, err := lint.CheckReleaseReceipts(cwd) if err != nil { return &exitError{Code: 2, Msg: "abcd launch receipts: " + scrubPaths(err)} @@ -59,6 +82,73 @@ func newLaunchReceiptsCommand(asJSON *bool) *cobra.Command { return nil }, } + cmd.Flags().StringVar(&carry, "carry", "", + "the full sha the receipts name: move each gate's receipt to HEAD when nothing that gate reads changed since") + return cmd +} + +// runReceiptsCarry is `launch receipts --carry `: the carry, its report, +// and its exit code. +func runReceiptsCarry(cmd *cobra.Command, cwd, from string, asJSON bool) error { + root, err := gitutil.CheckoutRoot(cwd, "the release receipts") + if err != nil { + return &exitError{Code: 2, Msg: "abcd launch receipts: " + scrubPaths(err)} + } + outputs, err := release.CutOutputs(root) + if err != nil { + return &exitError{Code: 2, Msg: "abcd launch receipts: " + scrubPaths(err)} + } + c, err := lint.CarryReceipts(root, from, outputs) + if err != nil { + return &exitError{Code: 2, Msg: "abcd launch receipts: --carry: " + termsafe.Sanitize(scrubPaths(err)) + " (nothing was moved)"} + } + if rerr := render(cmd.OutOrStdout(), asJSON, c, func(w io.Writer) { renderReceiptCarry(w, c) }); rerr != nil { + return rerr + } + if !c.Complete() { + return &exitError{Code: 1} + } + return nil +} + +// renderReceiptCarry prints what the carry did for each gate: carried, or +// left, with the reason and each changed path the gate's reviewer reads again. +// Gate names, reasons and paths come from the working tree and git, so each +// is sanitised. +func renderReceiptCarry(w io.Writer, c lint.ReceiptCarry) { + carried := 0 + for _, g := range c.Gates { + if g.Carried { + carried++ + } + } + fmt.Fprintf(w, "abcd launch receipts --carry — carried %d of %d\n", carried, len(c.Gates)) + if !c.Gate.Armed { + fmt.Fprintf(w, " %s requires no semantic gate, so there is no receipt to carry.\n", c.Gate.Workflow) + return + } + fmt.Fprintf(w, " from: %s (the commit the receipts name)\n to: %s (HEAD)\n", c.From, c.To) + for _, g := range c.Gates { + if g.Carried { + fmt.Fprintf(w, " - %s: carried to %s\n", termsafe.Sanitize(g.Gate), termsafe.Sanitize(g.Path)) + if g.Reason != "" { + fmt.Fprintf(w, " note: %s\n", termsafe.Sanitize(scrubMessage(g.Reason))) + } + continue + } + fmt.Fprintf(w, " - %s: left: %s\n", termsafe.Sanitize(g.Gate), termsafe.Sanitize(scrubMessage(g.Reason))) + for _, p := range g.Changed { + fmt.Fprintf(w, " %s\n", termsafe.Sanitize(p)) + } + if g.MoreChanged > 0 { + fmt.Fprintf(w, " and %d more\n", g.MoreChanged) + } + } + if c.Complete() { + fmt.Fprintln(w, " every receipt names HEAD: commit them, then run `abcd launch receipts`.") + } else { + fmt.Fprintln(w, " a gate left behind is reviewed again over the paths named, and its receipt recorded for HEAD.") + } } // renderReceiptCheck prints the local verdict: the gate list and where it came diff --git a/internal/surface/cli/launch_receipts_carry_test.go b/internal/surface/cli/launch_receipts_carry_test.go new file mode 100644 index 0000000000..bd0f689da7 --- /dev/null +++ b/internal/surface/cli/launch_receipts_carry_test.go @@ -0,0 +1,57 @@ +package cli + +import ( + "encoding/json" + "strings" + "testing" + + "github.com/intentdriven/abcd/internal/core/lint" +) + +// TestLaunchReceiptsCarryMovesTheUnchangedGatesReceipt is +// iss-2612022218233502 at the front door: after a docs fix on top of the roll, +// the cross-check's receipt is carried to the fix and the docs review's is +// left, naming the page to read again; once that review records its receipt, +// the release job's gate admits the branch. +func TestLaunchReceiptsCarryMovesTheUnchangedGatesReceipt(t *testing.T) { + r, roll := receiptsRepo(t) + dir := ".abcd/work/reviews/" + roll + "/" + r.Write(dir+"docs-currency-reviewer.json", receiptJSON("docs-currency-reviewer", roll, "PROMOTE", "docs-currency-reviewer")) + r.Write(dir+"iss35-brief-surface-crosscheck.json", + receiptJSON("iss35-brief-surface-crosscheck", roll, "PROMOTE", "iss35-brief-surface-crosscheck")) + r.Write("docs/guide.md", "fixed\n") + r.Git("add", "--", "docs/guide.md") + r.Git("commit", "-q", "-m", "a docs fix a review asked for") + head := r.Git("rev-parse", "HEAD") + + out, err := shipIn(t, r, "launch", "receipts", "--carry", roll) + if code := exitCodeOf(err); code != 1 { + t.Fatalf("exit = %d, want 1 (a gate was left)\n%s", code, out) + } + for _, want := range []string{"carried 1 of 2", "iss35-brief-surface-crosscheck: carried to .abcd/work/reviews/" + head, + "docs-currency-reviewer: left:", " docs/guide.md"} { + if !strings.Contains(string(out), want) { + t.Errorf("the carry does not say %q:\n%s", want, out) + } + } + + r.Write(".abcd/work/reviews/"+head+"/docs-currency-reviewer.json", + receiptJSON("docs-currency-reviewer", head, "PROMOTE", "docs-currency-reviewer")) + r.Remove(dir + "docs-currency-reviewer.json") + r.Commit("receipts") + out, err = shipIn(t, r, "launch", "receipts", "--json") + if code := exitCodeOf(err); code != 0 { + t.Fatalf("exit = %d, want 0 once every receipt names the fix\n%s", code, out) + } + var check lint.ReceiptCheck + if err := json.Unmarshal(out, &check); err != nil { + t.Fatalf("--json: %v\n%s", err, out) + } + if !check.Pass || check.Commit != head { + t.Errorf("want a pass keyed to the fix %s, got %+v", head, check) + } + + if out, err := shipIn(t, r, "launch", "receipts", "--carry", "abc"); exitCodeOf(err) != 2 { + t.Errorf("a sha that names no commit is exit 2, got %d\n%s", exitCodeOf(err), out) + } +} From a9cd0b3198670316c8a637d2887b82aac07513e5 Mon Sep 17 00:00:00 2001 From: REPPL <77722411+REPPL@users.noreply.github.com> Date: Thu, 3 Dec 2026 00:19:47 +0000 Subject: [PATCH 03/11] fix: cut a release from the freeze its reservation took The v0.18.0 cut set for 01:00 waited until 04:07 for two docs pull requests: nothing made it take the default branch as it stood when the release was reserved, and the only guard was a line in a runbook. `abcd reserve rel-` now notes the freeze, the commit origin's default branch names as the reservation's own fetch left it, in the cutting copy's local tier, and reports it. The note stands until the copy releases the reservation, so a renewal, a take-over or a cut resumed after its lease lapsed keeps its freeze (dcn-2612022305274369). `abcd launch ship` names the freeze and the time since it, and its roll, the practice run included, refuses a cut whose base on the default branch is any other commit unless `--refreeze ` says why, which the report carries. The emit step refuses nothing on it. The note is not pushed, because every peer's binary reads the reservation and a field an older one does not know risks reading as unreadable, which holds every merge (dcn-2612022235359298). Resolves: iss-2612022218224985 Assisted-by: Claude:claude-opus-5-5 --- .../brief/04-surfaces/04-launch.md | 18 ++ .../brief/04-surfaces/37-reserve.md | 10 +- .abcd/development/release/surface.json | 7 + ...refine-dcn-2612022235359298-a-release-s.md | 6 + ...-release-cut-can-wait-at-its-freeze-for.md | 2 + commands/launch.md | 39 ++- commands/reserve.md | 13 + docs/reference/cli/commands.md | 22 +- docs/reference/cli/commands/launch.json | 6 +- internal/core/release/freeze.go | 226 ++++++++++++++++++ internal/core/release/freeze_test.go | 152 ++++++++++++ internal/surface/cli/reserve.go | 47 +++- internal/surface/cli/reserve_freeze_test.go | 54 +++++ internal/surface/cli/ship.go | 126 +++++++++- internal/surface/cli/ship_freeze_test.go | 132 ++++++++++ 15 files changed, 842 insertions(+), 18 deletions(-) create mode 100644 .abcd/work/decisions/dcn-2612022305274369-refine-dcn-2612022235359298-a-release-s.md rename .abcd/work/issues/{open => resolved}/iss-2612022218224985-a-release-cut-can-wait-at-its-freeze-for.md (69%) create mode 100644 internal/core/release/freeze.go create mode 100644 internal/core/release/freeze_test.go create mode 100644 internal/surface/cli/reserve_freeze_test.go create mode 100644 internal/surface/cli/ship_freeze_test.go diff --git a/.abcd/development/brief/04-surfaces/04-launch.md b/.abcd/development/brief/04-surfaces/04-launch.md index aa83b1a7bc..38e82d2aa8 100644 --- a/.abcd/development/brief/04-surfaces/04-launch.md +++ b/.abcd/development/brief/04-surfaces/04-launch.md @@ -935,6 +935,23 @@ account for is armed, so the cut's runbook (`commands/launch.md`) has the cutting session run the preview again just before it merges the release pull request, and tell people working in the repository by hand to hold. +The reservation is also the cut's freeze (iss-2612022218224985, +dcn-2612022235359298, dcn-2612022305274369). It notes in the cutting copy's +local tier the commit origin's default branch names as its own fetch left it, +which stands until the cutting copy releases the reservation, so a renewal, a +take-over or a cut resumed after its lease lapsed keeps its freeze. The ship +sub-verb names the freeze and the time since it, and its roll, the practice run +included, refuses a cut whose base on the default branch (the merge base of HEAD +and the branch the freeze read) is any other commit, unless the operator +refreezes the cut and says why; the report carries the reason. The v0.18.0 cut +set for 01:00 waited until 04:07 for two pull requests because nothing named +the commit it was cut from: with the freeze, a pull +request open at the freeze waits for the next release, and a cut that takes it +says so. The emit step refuses nothing on it, so the cut it previews stays +readable, and a copy with no note cuts as before, since the note is this copy's +alone and a pushed field an older peer's binary does not know risks the +reservation reading as unreadable, which holds every merge. + The hosted release run reuses no test result: its test steps pass `-count=1` on the tree being tagged. @@ -1194,6 +1211,7 @@ Sub-verbs: none. | `--dry-run` | bool | | `--fetch-baseline` | bool | | `--payload-dir` | string | +| `--refreeze` | string | | `--route` | stringArray | ### `abcd launch smoke-pages` diff --git a/.abcd/development/brief/04-surfaces/37-reserve.md b/.abcd/development/brief/04-surfaces/37-reserve.md index 2f11cc9ba9..2802b46b70 100644 --- a/.abcd/development/brief/04-surfaces/37-reserve.md +++ b/.abcd/development/brief/04-surfaces/37-reserve.md @@ -563,7 +563,15 @@ renewal and that from five minutes after the lapse any copy reserves the release again, to resume the cut or, followed by a release, to withdraw it (`lapsed_releases`, iss-2610241104098581), so no session waits on a holder that is gone. The subject is `rel-v` and three plain numbers, -with no leading zero and no suffix, so one release never makes two branches. It differs from a record's reservation in four ways: +with no leading zero and no suffix, so one release never makes two branches. +A release reservation notes its freeze in the cutting copy's local tier: +origin's default branch as the reservation's own fetch left it, which the launch +verb's ship step cuts from (iss-2612022218224985, dcn-2612022235359298). The note +stands until the cutting copy releases the reservation, so a renewal, a +take-over or a cut resumed after its lease lapsed keeps its freeze +(dcn-2612022305274369). The note is not pushed, because every peer's binary +reads the reservation and a field an older one does not know risks reading as +unreadable, which holds every merge. It differs from a record's reservation in four ways: - It takes no footprint, and refuses one: it holds every merge, not some files. diff --git a/.abcd/development/release/surface.json b/.abcd/development/release/surface.json index 1ad37a2196..395b4617b5 100644 --- a/.abcd/development/release/surface.json +++ b/.abcd/development/release/surface.json @@ -3918,6 +3918,13 @@ "required": false, "hidden": false }, + { + "name": "refreeze", + "shorthand": "", + "type": "string", + "required": false, + "hidden": false + }, { "name": "route", "shorthand": "", diff --git a/.abcd/work/decisions/dcn-2612022305274369-refine-dcn-2612022235359298-a-release-s.md b/.abcd/work/decisions/dcn-2612022305274369-refine-dcn-2612022235359298-a-release-s.md new file mode 100644 index 0000000000..715d8e489b --- /dev/null +++ b/.abcd/work/decisions/dcn-2612022305274369-refine-dcn-2612022235359298-a-release-s.md @@ -0,0 +1,6 @@ +--- +id: dcn-2612022305274369 +slug: refine-dcn-2612022235359298-a-release-s +date: 2026-12-02 +--- +2026-12-02 — Refine dcn-2612022235359298: a release's freeze note stands until the cutting copy releases the reservation with --release, so a renewal, a take-over, or a cut resumed by reserving the release again after its lease lapsed keeps its freeze; only a release clears the note, and the next reservation then takes a freeze of its own. Grounds: a cut that outlasts its day lapses and is resumed by reserving again, and a fresh freeze then would refuse the release branch already cut from the first one; a note left by a cut abandoned without --release is named with its age on every ship freeze line, and is passed with --refreeze or cleared by reserving and releasing. Reverse: take a fresh freeze on every fresh reservation, as dcn-2612022235359298 first said diff --git a/.abcd/work/issues/open/iss-2612022218224985-a-release-cut-can-wait-at-its-freeze-for.md b/.abcd/work/issues/resolved/iss-2612022218224985-a-release-cut-can-wait-at-its-freeze-for.md similarity index 69% rename from .abcd/work/issues/open/iss-2612022218224985-a-release-cut-can-wait-at-its-freeze-for.md rename to .abcd/work/issues/resolved/iss-2612022218224985-a-release-cut-can-wait-at-its-freeze-for.md index d52e21b655..a2b93880fc 100644 --- a/.abcd/work/issues/open/iss-2612022218224985-a-release-cut-can-wait-at-its-freeze-for.md +++ b/.abcd/work/issues/resolved/iss-2612022218224985-a-release-cut-can-wait-at-its-freeze-for.md @@ -10,6 +10,8 @@ origin: researcher-authored production_mode: hand-written found_at: "internal/core/release/protocol.go" remedy: "reserve rel- records the freeze commit (origin's default branch when the reservation is taken) and launch ship cuts from that commit, refusing a later default branch unless --refreeze names why; the cut's timeline names any wait between the set time and the reservation" +resolution: "Fixed by the freeze: abcd reserve rel- notes origin's default branch as the cut's freeze in the cutting copy's local tier, kept until the reservation is released, and abcd launch ship names it and the time since it and refuses a roll whose base on the default branch is any other commit unless --refreeze says why (dcn-2612022235359298, dcn-2612022305274369)." +impact: additive --- A release cut can wait at its freeze for open pull requests: nothing makes the cut take the default branch as it stands at the set time. The v0.18.0 cut set for 01:00 on 2 Dec waited until 04:07 for two docs pull requests, three of its twenty hours, and the only guard against it is a line in a session's runbook. diff --git a/commands/launch.md b/commands/launch.md index 800578e570..8ba3683d03 100644 --- a/commands/launch.md +++ b/commands/launch.md @@ -1,7 +1,7 @@ --- name: launch description: "Preview the release cut, the launch bundle, its secret scan and the gates: Writes only its pre-flight report, to the local tier; refuses without --dry-run." -argument-hint: "[--dry-run [--deep-smoke] [--baseline ] [--fetch-baseline]] | ship [--changelog-json ] [--payload-dir ] [--allow-dirty] [--fetch-baseline] [--dry-run] | archive --out [--tag ] [--verify] [--repository ] | manifests --tree public|dev [--root ] | receipts [--carry ] | reland [] [--assisted-by :] | scaffold [--confirm] [--dependency-reauthor]" +argument-hint: "[--dry-run [--deep-smoke] [--baseline ] [--fetch-baseline]] | ship [--changelog-json ] [--payload-dir ] [--allow-dirty] [--fetch-baseline] [--refreeze ] [--dry-run] | archive --out [--tag ] [--verify] [--repository ] | manifests --tree public|dev [--root ] | receipts [--carry ] | reland [] [--assisted-by :] | scaffold [--confirm] [--dependency-reauthor]" block: people --- @@ -194,6 +194,19 @@ reservation stands, recording it `kept`: reserving the release again from this copy tries the withdrawal again. Pass every such line on to the user. The launch check below then refuses the cut while that pull request is still armed. +**The reservation is the freeze.** It notes the commit `origin`'s default +branch names as its own fetch left it (`freeze` in `--json`, a `freeze:` +line), in this copy's local tier; a renewal, a take-over or a cut resumed after +its lease lapsed keeps it, and `--release` clears it. Cut the release branch +from that commit, not from a default branch that moved since. `launch ship` +names the freeze and the time since it, and +the roll refuses (exit 2, nothing written) a cut whose base on the default +branch is any other commit, naming both and how many commits the default +branch moved, unless `--refreeze ` says why the cut takes the later +base; the report carries the reason. A pull request still open at the freeze +waits for the next release rather than holding this one +(iss-2612022218224985). + ### Step 3 — merging, and the one hazard Merge the release PR the normal way, from the PR page's **Merge pull request** @@ -606,6 +619,16 @@ guardrails reads objects as git stores them, with no replace ref, graft file or commit-graph in force, so a record, a tree or which tags lie behind the base tag reads as the push and the tag send it. +**The emit names the freeze it cuts from.** When `abcd reserve rel-` +noted a freeze in this copy, the render's `freeze:` line (`freeze` in +`--json`: `commit`, `branch`, `at`, `base`, `held`, `later`, +`waited_seconds`) names its commit, when it was taken and how long ago, and +whether the cut's base on the default branch (the merge base of HEAD and the +branch the freeze read) is the freeze; a base past it says the roll refuses it +without `--refreeze `. The emit refuses nothing on it, and a copy with +no note for the release shows no line; `freeze_unjudged` says why a noted +freeze could not be judged. + **The cut is read from HEAD, so an uncommitted record move refuses it.** The record set comes out of git at HEAD, never the working tree, so a spec close or an issue resolve made and not yet committed would be missing from a cut that @@ -902,6 +925,18 @@ the emit step writes nothing already. With `--json` the result carries the usual fields plus `"dry_run": true`, `would_write` and `would_do`. +**The roll cuts from the freeze.** When this copy noted a freeze for the +payload's `next_tag` (`abcd reserve rel-`; *Before step 1* above), the +ingest and its practice run judge the cut's base on the default branch against +it before anything else is read. A base that is any other commit is refused +(exit 2, nothing written), naming the freeze, the base, how many commits the +default branch moved past the freeze and how long the cut has waited since it; +`--refreeze ` takes the later base, and the report's `freeze` carries +the reason. `--refreeze` with an empty reason, or on an emit step that rolls +nothing, is an operand error (exit 2). A copy with no note cuts as before: the +freeze is this copy's, so a cut moved to another copy reserves the release +there to take one. + In a repository whose version-location contract (`.abcd/config/version-location.json`) declares `"publishes_plugin_archive": true` — the statement that its release workflow uploads the plugin archive — a written @@ -1560,7 +1595,7 @@ plugin-root binary, and the plugin-root binary while it prints nothing. - What usually follows: - `abcd launch scaffold --confirm`, only when the person says yes to what a practice run listed. - `abcd launch --dry-run`, to preview the release gates it scaffolded. -- `abcd launch ship [--changelog-json ] [--payload-dir ] [--allow-dirty] [--fetch-baseline] [--dry-run] [flags]` +- `abcd launch ship [--changelog-json ] [--payload-dir ] [--allow-dirty] [--fetch-baseline] [--refreeze ] [--dry-run] [flags]` - Reads `--changelog-json`, the composed changelog, at schema_version 2; `"${CLAUDE_PLUGIN_ROOT}/abcd" explain launch ship --input changelog-json` prints its shape. - An example call is `abcd launch ship --dry-run`. - What usually follows: diff --git a/commands/reserve.md b/commands/reserve.md index ff2188352f..364fe4ff17 100644 --- a/commands/reserve.md +++ b/commands/reserve.md @@ -161,6 +161,19 @@ this copy's own landings are not held. It also withdraws every merge armed or queued before it (**Withdrawn merges** below). The hold binds sessions, not people, so the cutting session tells people working in the repository by hand to hold. + +Reserving the release also takes its **freeze**: the commit `origin`'s +default branch names as the reservation's own fetch left it, noted in this +copy's local tier (`.abcd/.work.local/release/freeze/vX.Y.Z.json`) and reported +as `freeze` (`release`, `commit`, `branch`, `at`) and a `freeze:` line. A note +already kept for the release stands, so a renewal, a take-over, or a cut +resumed by reserving again after its lease lapsed keeps its freeze; `--release` +from this copy clears it, and the next reservation takes a freeze of its own +(dcn-2612022305274369). `abcd launch ship` cuts from it: it names the freeze and the time since, and its roll +refuses a cut whose base on the default branch is any other commit unless +`--refreeze ` says why, so a cut does not wait at the freeze for pull +requests to merge. A clone that names no default branch of `origin` notes no +freeze and says why in `freeze_unnoted`; the reservation stands either way. `/abcd:peers` shows the line "release v0.16.0 being cut by h_0123456789abcdef0123456789abcdef (claimed): merges are held; the hold lapses at