From 0603c2738980587466fc3fcc7182329f9945de7e Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Mon, 23 Nov 2026 22:29:38 -0800 Subject: [PATCH] /ship instructions match the new review rules (GST-3562) (#4779) /ship's instructions, docs and the Capy skill now describe the review rules that already shipped: a change after the first review round gets a full second round, the old extra-reviewer permission slips are retired, and a clean merge from main counts as reviewed. Why: agents follow these instructions, and they still taught the retired steps. Part of the /ship simplification Garry approved; nothing for readers to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/outside-voice#1,#2,#3, adversarial-native#2, red-team#1 --- .gstack/pregate.json | 2 +- capy/skill/gstack/SKILL.md | 2 +- .../ship-prose-matches-new-review-rules.md | 1 + crew/docs/captain.md | 17 +- docs/review-policy.md | 156 ++++++------------ docs/ship-policy.md | 33 ++-- docs/skills.md | 2 +- docs/troubleshooting.md | 43 +++-- docs/unattended.md | 2 +- lib/pregate/config.ts | 2 +- lib/review-depth.ts | 2 +- scripts/resolvers/ship-driver.ts | 2 - ship/DRIVER.md | 32 ++-- ship/DRIVER.md.tmpl | 30 ++-- ship/SKILL.md | 6 +- ship/SKILL.md.tmpl | 6 +- ship/sections/adversarial.md | 2 +- ship/sections/adversarial.md.tmpl | 2 +- ship/sections/documentation.md | 2 + ship/sections/documentation.md.tmpl | 2 + ship/sections/pr-body.md | 10 +- ship/sections/pr-body.md.tmpl | 10 +- ship/sections/review-army.md | 22 +-- ship/sections/review-army.md.tmpl | 22 +-- test/fixtures/golden/agy-ship-SKILL.md | 6 +- test/fixtures/golden/claude-ship-SKILL.md | 6 +- test/fixtures/golden/codex-ship-SKILL.md | 6 +- test/fixtures/golden/factory-ship-SKILL.md | 6 +- .../files/lib/review-depth.ts.json | 2 +- .../files/ship/sections/adversarial.md.json | 2 +- .../files/ship/sections/review-army.md.json | 2 +- .../review-pins/replays/GST-3562-part-2.json | 1 + test/helpers/gst3562-replay.ts | 6 +- test/pregate-dart.test.ts | 2 +- test/pregate-starter.test.ts | 2 + test/review-depth-lean.test.ts | 2 +- test/review-depth.test.ts | 4 +- test/review-pass.test.ts | 18 ++ test/review-plan-pr-rounds.test.ts | 1 + test/ship-control-flow.test.ts | 3 +- test/ship-driver.test.ts | 33 ++-- .../ship-prose-matches-new-review-rules.json | 4 + 42 files changed, 260 insertions(+), 256 deletions(-) create mode 100644 changelog.d/ship-prose-matches-new-review-rules.md create mode 100644 test/fixtures/review-pins/replays/GST-3562-part-2.json create mode 100644 test/size-ledger/ship/ship-prose-matches-new-review-rules.json diff --git a/.gstack/pregate.json b/.gstack/pregate.json index d96b9f9a8..29bb8a24c 100644 --- a/.gstack/pregate.json +++ b/.gstack/pregate.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/garrytan/gstack/docs/pregate.md#pregate-v1", + "$schema": "https://github.com/garrytan/gstack/blob/main/docs/pregate.md#pregate-v1", "runner": "bun test --timeout=30000 {files}", "remote_gate": "bash scripts/ubicloud/pregate-remote.sh", "dependencies": { diff --git a/capy/skill/gstack/SKILL.md b/capy/skill/gstack/SKILL.md index b94d495e3..30729d357 100644 --- a/capy/skill/gstack/SKILL.md +++ b/capy/skill/gstack/SKILL.md @@ -46,7 +46,7 @@ Capy checklist for `/autoplan`: drive `gstack-autoplan`, never a hand adaptation Token caps on /ship: pass a brief's cap as `--token-cap `. /ship reads `cost.tokens` and `cost.credits` from `tools.thread.get({ thread_id: "" })` (the thread running /ship, its reviewers included) inside the same execute program as the `gstack-ship-budget` command that takes them as `--reading --credits `, never alone. `ship/DRIVER.md` starts `--mode observe`: each program ends with `note`, and only a note past the cap stops (`docs/ship-budget.md`). -/ship on Capy is about a dozen calls, each an execute program (`ship/DRIVER.md`). Each review pass and Step 11 is one call to the checked-in pass program (fill only `input`): `const t0 = await now(); const p = (await tools.capy.bash({ command: ". '' && gstack-review-dispatch program", description: "Pass" })).output.split("\n"); return p[0] + "\n" + (await new (Object.getPrototypeOf(async () => {}).constructor)("tools", "sleep", "now", "input", JSON.parse(p[1]))(tools, sleep, now, { startedAt: t0, launch: "", cwd: "", base: "", out: "/p", pass: "-p", laneModel: "", planFlags: [], logStart: ["review"], jam: "", record: "", step: "9.2" }));` It plans, logs `logStart` (`reservation` mode from `RESERVATION_ID:`), sends each brief on `machine: "shared"`, then polls: one `tools.subagent.list` per ~20 s tick, returning 200 s after the program's first line, where a reader is settled only at status `done` or `failed` or with a `summary` (a just-created `idle` reader has not run); it starts readers under `rejected` with `tools.subagent.start` as slots free and stops on one stuck 20 minutes. It ends on `NEXT:` (`poll`: rerun) or `STOP:`. `models` maps roles to models (`outside-voice`: another family, pinned in `voice-models.json`); Step 11 swaps `logStart` for `stage: "voices"`; a full repeat pass, `diffBase: ""`. Steps 7, 8 and 14.5 (`step: "14.5"`) use `extras`, JSON `{name, prompt_file, first, model}` (prompts verbatim from their sections, Step 7 `first`); they cannot block, so omit `model`: the pass prints `AUDIT_MODEL:`. Every other phase is one call to `gstack-ship-phase program`, loaded the same way, with `input` `{ startedAt, launch, cwd, dir: "", phase: , commands: [" …"], record, jam, step: "" }` (Phase 2's `gstack-ship-budget start` takes `--reading "$GSTACK_SHIP_READING" --credits "$GSTACK_SHIP_CREDITS"`; `pass: { … }` runs that pass after the commands); on `NEXT: rerun`, call it again unchanged. Waits under about 80 minutes: never let 5 minutes pass between calls. While readers run, never end the turn on `wait`; rerun the loader. Else re-issue `wait` with `duration_seconds: 200` and operation ids. A wait expected past 80 minutes (full CI) ends the turn on one `wait` on its operations; never poll every 10-15 minutes. `STOP: past 100 minutes`: report its `stop.json` and end. At Step 22 report the `CALLS:` line of `gstack-ship-budget calls --record `. A small waiting child saves nothing. Never hand-run a reader. Every pass, fix-check and Step 11 voice runs through that pass program, and each logs its row through Step 9.4's persistence (`gstack-review-log --start`/`--finish`); without the row `gstack-review-read` prints `NO_REVIEWS`, so no stop, fix-check grant or finish can bind the reading. A scoped or granted reader after the review bound is planned with `gstack-review-plan --post-review`, and run as it prints. +/ship on Capy is about a dozen calls, each an execute program (`ship/DRIVER.md`). Each review pass and Step 11 is one call to the checked-in pass program (fill only `input`): `const t0 = await now(); const p = (await tools.capy.bash({ command: ". '' && gstack-review-dispatch program", description: "Pass" })).output.split("\n"); return p[0] + "\n" + (await new (Object.getPrototypeOf(async () => {}).constructor)("tools", "sleep", "now", "input", JSON.parse(p[1]))(tools, sleep, now, { startedAt: t0, launch: "", cwd: "", base: "", out: "/p", pass: "-p", laneModel: "", planFlags: [], logStart: ["review"], jam: "", record: "", step: "9.2" }));` It plans, logs `logStart` (`reservation` mode from `RESERVATION_ID:`), sends each brief on `machine: "shared"`, then polls: one `tools.subagent.list` per ~20 s tick, returning 200 s after the program's first line, where a reader is settled only at status `done` or `failed` or with a `summary` (a just-created `idle` reader has not run); it starts readers under `rejected` with `tools.subagent.start` as slots free and stops on one stuck 20 minutes. It ends on `NEXT:` (`poll`: rerun) or `STOP:`. `models` maps roles to models (`outside-voice`: another family, pinned in `voice-models.json`); Step 11 swaps `logStart` for `stage: "voices"`; a full repeat pass, `diffBase: ""` (none on the read-only final review, which prints `READ_ONLY:`). Step 14.5 (`step: "14.5"`) and, with a bound plan, Step 8 use `extras`, JSON `{name, prompt_file, first, model}` (prompts verbatim from their sections); they cannot block, so omit `model`: the pass prints `AUDIT_MODEL:`. Every other phase is one call to `gstack-ship-phase program`, loaded the same way, with `input` `{ startedAt, launch, cwd, dir: "", phase: , commands: [" …"], record, jam, step: "" }` (Phase 2's `gstack-ship-budget start` takes `--reading "$GSTACK_SHIP_READING" --credits "$GSTACK_SHIP_CREDITS"`; `pass: { … }` runs that pass after the commands); on `NEXT: rerun`, call it again unchanged. Waits under about 80 minutes: never let 5 minutes pass between calls. While readers run, never end the turn on `wait`; rerun the loader. Else re-issue `wait` with `duration_seconds: 200` and operation ids. A wait expected past 80 minutes (full CI) ends the turn on one `wait` on its operations; never poll every 10-15 minutes. `STOP: past 100 minutes`: report its `stop.json` and end. At Step 22 report the `CALLS:` line of `gstack-ship-budget calls --record `. A small waiting child saves nothing. Never hand-run a reader. Every pass and Step 11 voice runs through that pass program, and each logs its row through Step 9.4's persistence (`gstack-review-log --start`/`--finish`); without the row `gstack-review-read` prints `NO_REVIEWS`, so no stop or finish can bind the reading. A scoped reader after the review bound (one a receipt or carry refusal asks for) is planned with `gstack-review-plan --post-review`, and run as it prints. /ship plans no fix-check: a code change after round 1 gets a full round 2; after round 2 the PR ships with its open notes or its Captain rules, and a PR past the cap whose code changed gets one read-only full review. Fix-check and round grants are deprecated and go in the next release: ask for none. ## Plan, approve, ship diff --git a/changelog.d/ship-prose-matches-new-review-rules.md b/changelog.d/ship-prose-matches-new-review-rules.md new file mode 100644 index 000000000..e9af08f06 --- /dev/null +++ b/changelog.d/ship-prose-matches-new-review-rules.md @@ -0,0 +1 @@ +**/ship's instructions now match how it reviews code.** A code change after the first review round gets a full second round, and a pull request past its two rounds whose code changed gets one read-only full review of its final head; the old narrow re-checks and the grants that bought them are marked deprecated and go away next release. Unattended /ship skips the test-coverage and plan-completion readers and the scope, exploratory-QA, TODOS, metrics and nudge steps, none of which caught anything in recorded runs. The documentation audit edits only README.md, docs/ and bench/README.md, a new /ship run on a pull request past its review rounds no longer lets that last review apply fixes, and the starter `.gstack/pregate.json` that gstack prints now links to its documentation on GitHub. diff --git a/crew/docs/captain.md b/crew/docs/captain.md index ca4180865..34dfec79d 100644 --- a/crew/docs/captain.md +++ b/crew/docs/captain.md @@ -572,9 +572,13 @@ lands while /ship runs waits for /ship to finish instead of being fixed mid-run. Capy the mechanics are in [the gstack skill](../../capy/skill/gstack/SKILL.md#plan-approve-ship). When the base moves under a reviewed branch, merge it in; never rebase. A merge that -leaves the product diff unchanged carries the receipt with `gstack-ship-receipt carry` -(pregate at HEAD, no review rerun), and a merge whose resolution changed product code -needs a fresh /ship. A rebase carries only onto a tree the receipt already covers with +leaves the branch's own lines, file modes and symlink targets byte-identical counts as +reviewed and carries the receipt with `gstack-ship-receipt carry` (pregate at HEAD, no +review rerun; CI on the merged head is the check). A merge that spliced main's change into a reviewed hunk, or +chose the order of the branch's inserted lines against main's at the same spot, gets the one +scoped reader `RECEIPT_CARRY_SCOPED_REVIEW` asks for, run without asking and not a review +round; a merge whose resolution changed the branch's own lines, a file mode or a symlink +target needs a fresh /ship. A rebase carries only onto a tree the receipt already covers with the same product diff; any other rebase is a full /ship ([ship-policy.md](../../docs/ship-policy.md#receipt-carry)). A controller never asks a lane to rebase a reviewed branch. @@ -792,9 +796,10 @@ case-kind change, closing a contribution without landing it, and anything destru Standing spend is the commonest standing approval: `SPEND` in CREW.md names what the owner pre-approved (train gates, screens, bisects, the backstop, focused paid cases) with the owner's date and words and the cap per rerun; anything over the cap is a fresh ask. -A review round past a PR's two (`PR_ROUND_CAP`) is the lane's or the controller's call, recorded -with `gstack-approvals round-grant`, never an owner ask -([rounds per pull request](../../docs/review-policy.md#rounds-per-pull-request)). +After a PR's two review rounds (`PR_ROUND_CAP`) it ships with its open notes listed, or the controller +rules on the blocker; a PR past the cap whose code changed gets one read-only full review of its final head, +never an owner ask ([rounds per pull request](../../docs/review-policy.md#rounds-per-pull-request)). Round and +fix-check grants are deprecated and go in the next release. **B. The plan ask** ([template](../../captain/templates/plan-ask.md)): before → after, why it matters, what caused this work, the big decisions, and what we need from you in the ask diff --git a/docs/review-policy.md b/docs/review-policy.md index 779668385..dc3cc6e2a 100644 --- a/docs/review-policy.md +++ b/docs/review-policy.md @@ -90,48 +90,35 @@ incomplete coverage, which blocks until the reviewer is rerun. for every reviewer (the gate scan and QA probes keep the whole candidate) and classifies with `--range-base`. Only a blocking finding in that range or in the diff is `fix`; every below-floor finding is a `note`. -3. **Two rounds is the cap** (R51): a full pass, a scoped pass - ([below](#scoped-pass)) or a fix-check is a round of this table. The counters - (`review_loop.rounds`, `PR_REVIEW_HISTORY: rounds=`) count passes only: a - fix-check reads only a round's fixes, and R51 counts a re-check of only what - changed as no round, so it shows as `fix_checks=`. After round 2 the run +3. **Two rounds is the cap** (R51): a full pass or a scoped pass + ([below](#scoped-pass)) is a round of this table, and /ship plans no + fix-check (GST-3562 A). Any code change after round 1, blocking, gate-class + or below the floor, gets a full round 2 on the range. After round 2 the run finishes with its open notes listed in the PR body and receipt (an owner-ruled note is closed and listed: [ruled notes](ship-policy.md#ruled-notes)), or stops for - the owner when a blocking finding is open, naming it (path, severity, - problem); a round-2 fix, blocking, gate-class or below the floor, first gets - the read-only full review described below. The cap limits fix rounds, not Step 11's voices: on gate + the lane's Captain when a blocking finding is open, naming it (path, severity, + problem); a round-2 fix first gets one read-only full review of the final + head: the dispatcher stages it on the merge base whatever `--diff-base` it is + given, prints `READ_ONLY:`, and no fix round follows it. A fix after that + review stops for the Captain. The cap limits fix rounds, not Step 11's voices: on gate class a stop waits for Step 11's adversarial, outside and targeted voices - (`NEXT: voices`), so gate code never reaches the owner's "ship with open - notes" without them (GST-967). A fix in round 2 gets one read-only full - review, never a fix-check (GST-3562 A). For one release, a grant recorded in - `review_loop_exception` (its ask or scope naming `review_loop_grant` and the - stop head's sha) still answers one row: `gstack-review-plan --grant --range-base ` plans one more fix-check after a - round-2 fix-check that was the run's only one (`--fix-checks 1`, GEVA-223), - with a fixed blocking finding or a gate-class edit, and refuses any other row, - including a grant for a stop head before `--range-base` (an earlier /ship). - A fix-check never earns another, so the grant cannot repeat, and a stop after - the granted fix-check still goes to the owner. The cap approves nothing. - This cap counts rounds inside one run. Across heads and runs the PR's own - count applies ([rounds per pull request](#rounds-per-pull-request)), and an - extra round there is the lane's or Captain's grant, never an owner ask. - Edits that /ship Step 16 later finds after the review bound are a new stop: a - new grant at a stop head after the last fix-check's commit, passed as - `gstack-review-plan --post-review --last fix-check --range-base - --grant `, plans one more fix-check, the next link of the - [fix-check chain](ship-policy.md#fix-check-chain) (GST-1676). The last link's - own grant is refused there, so each link still needs the owner's word. In the - loop, a new grant naming the last fix-check's commit (`--range-base`) plans - the next link the same way; a grant recorded before a later logged fix-check - already bought a link and is refused (GST-1681). Edits after the last - fix-check that are only release stamps under the base policy's stamp rule - (line-exact: one other line in a stamp file makes the file an edit) and docs - are no gate-class edit: the plan reads them with the receipt's classifier - (`docsChangeSince`, the [targeted-only read](#targeted-only-read-after-the-loop)'s) - and prints `NEXT: done`, or `NEXT: targeted` when a docs claim on a - targeted-class diff needs the read, with no grant (GST-1702). An executable, - symlink or gitlink file in that range, or a commit the gate scan tags there - (a `[skip ci]` message), still stops. + (`NEXT: voices`), so gate code never reaches "ship with open notes" without + them (GST-967). The cap approves nothing. This cap counts rounds inside one + run. Across heads and runs the PR's own count applies ([rounds per pull + request](#rounds-per-pull-request)). + Owner grants of a fix-check (`review_loop_exception`, `--grant`, the + [fix-check chain](ship-policy.md#fix-check-chain)) are deprecated: code still + honors a grant recorded before GST-3562 for one release, and the next release + removes them. Record no new one. + Edits that /ship Step 16 finds after the review bound that are only release + stamps under the base policy's stamp rule (line-exact: one other line in a + stamp file makes the file an edit) and docs are no gate-class edit: the plan + reads them with the receipt's classifier (`docsChangeSince`, the + [targeted-only read](#targeted-only-read-after-the-loop)'s) and prints + `NEXT: done`, or `NEXT: targeted` when a docs claim on a targeted-class diff + needs the read (GST-1702). An executable, symlink or gitlink file in that + range, or a commit the gate scan tags there (a `[skip ci]` message), still + stops. Any other code edit after review costs the next round. ### Rounds per pull request (R51, GST-2673) @@ -184,15 +171,12 @@ caught on another crew's PRs. hop covered never got a full review, so the head runs `/ship` until a fresh full review replaces that receipt. 4. **Stop rule.** `gstack-review-plan --prior-full ` adds the PR's earlier - full rounds to this run's full passes; fix-checks stay the in-run table's - call, and `--prior-rounds` is printed as `pr_rounds=`. The per-PR cap counts - full passes only, by design (`lib/review-depth.ts` `prCapped`): earlier runs' - scoped passes show in `pr_rounds=` but don't count against it, fix-checks - show in neither, - because each run's own fix round is the in-run table's call. A full pass past two - stops with `PR_ROUND_CAP` and says how to record the stop and its grant - (item 6); a fix at the cap gets one read-only full review of the final head - (GST-3562 A), and a fix after that review stops for the lane's Captain. The stop is the lane's or Captain's call, never an owner ask + full rounds to this run's full passes, and `--prior-rounds` is printed as + `pr_rounds=`. The per-PR cap counts full passes only, by design + (`lib/review-depth.ts` `prCapped`): earlier runs' scoped passes show in + `pr_rounds=` but don't count against it. A fix at the cap gets one read-only + full review of the final head (GST-3562 A), and a fix after that review stops + for the lane's Captain. The stop is the lane's or Captain's call, never an owner ask ([troubleshooting](troubleshooting.md#pr-round-cap)). 5. **Read-only final review.** A PR that already had two full rounds and whose own code changed since still gets one full review of its final head. It has @@ -201,62 +185,26 @@ caught on another crew's PRs. to decide: ship with the note, park, or keep the fix and run /ship again for one more read-only full review of the final head. A below-floor fix applied after that review also stops for the Captain (GST-3562 A). The count does not - reopen. -6. **Round grants.** Two kinds, each recorded with `gstack-approvals round-grant - --pr --head --reason --by `, and each spent - by the one run that claims it. - - **`--kind fix-check`, after a stop** (GST-2968). When a review stops, - `/ship` runs `gstack-ship-receipt stop`, which writes a stop record into - the PR body's runs block: the run, and the commit and tree the stopped review - read. It writes one only when that review finished, read one committed tree - from start to end on a clean checkout, and that commit is HEAD or under it - (`STOP_UNBOUND` otherwise). The grant names that stop's head, its run - (`--stop-run`) and the findings its fix round is for (`--findings`). It - buys the stopped review's fix round: one scoped fix-check of the PR's own - change since the stop's head (a base merge in between is not part of it), in - the same run or a new one on another machine, never a new full review. - Step 1's `PR_REVIEW_FLAGS:` adds `--round-grant --stop ` and the - route is `fix-check`. It answers only the newest stop record, and nothing - once another run reviewed after that stop, HEAD no longer contains the stop's - head, or another run claimed it (`PR_REVIEW_GRANT: not applied (why)`). - A fix-check found nothing to read (an empty, reverted or base-only change) - plans no fix-check. The fix-check never earns another: a blocker there - stops with `PR_ROUND_CAP` again. - - **`--kind extra-round`, before review.** One round past the cap, with its fix - round, at a head no review has stopped at: instead of the read-only review. - Step 1's `PR_REVIEW_FLAGS:` adds `--round-grant ` when the grant names - HEAD, or a head HEAD only merges the base into with the PR's own added and - removed lines byte-identical and in the same places (preflight merges the base - first); the plan raises that run's cap by one round, keeps the round's fix - round, and keeps the grant after the fix round's commits move HEAD past it. - An extra-round grant never answers a stop. - A run whose flags name a grant runs `gstack-ship-receipt claim` before its - first dispatch, which writes a grant record into the runs block; a grant - another run claimed, or a fix-check grant a counted fix-check already read - under (one carrying no grant and logged after it included), is refused (`GRANT_SPENT`), a - voided run's claim still - spends it, and stop and grant records are never trimmed from the block. When - the run record cannot save the claim, claim fails and the run starts no - reviewers; rerun claim with the same `--run` once the record is writable, since - a new run id reads `GRANT_SPENT`. - gstack never grants itself a round: `--by` naming gstack (one of the names - gstack writes for itself, `gstack` or `gstack no-stop default (K1)`, matched - whole and case-insensitively, so "gstack-evals Captain" or "GStack Minder" can - grant) and a grant from inside an open `/ship` run are refused, and `add` - refuses the scope. A stopped run (state `stopped` in its run record, - [what ends a run](ship-policy.md#what-ends-a-run)) may record the fix-check grant - for its own stop, once per run; any other grant on that checkout, a second fix - round included, is the lane's relay of its Captain's grant: `--owner-ref : --words `, the same relay - `gstack-approvals rule` takes, which the row keeps as `relayed:` (#4531). `--by` is otherwise the caller's own text, recorded and - not checked: a lane that records a grant (or a ruling) from another checkout - under its Captain's name can't be told apart from the Captain doing it, so the - Captain's check of the receipt's `review_round_grants` and the PR body's lines - is the control. The receipt lists grants under `review_round_grants`. + reopen. A new /ship run on such a PR plans this review as its pass 1, with the + same `READ_ONLY:` staging and no fix round as the in-run case. +6. **Round grants (deprecated).** `gstack-approvals round-grant` (`--kind + fix-check` after a stop, `--kind extra-round` before review), `gstack-ship-receipt + claim` and the `--round-grant`/`--stop` flags Step 1 adds for them still work + for one release, so a grant recorded before GST-3562 keeps verifying; the next + release removes them. Record no new grant: after round 2 the PR ships with its + open notes or its Captain rules, and a PR whose code changed after the cap gets + the read-only full review in item 5. gstack never grants itself a round, and the + receipt lists older grants under `review_round_grants`. ### What closes a finding (GST-3260) +The grant paths in this section are deprecated with the fix-check (GST-3562 A): +they keep a grant recorded before it verifying for one release, and the next +release removes them. /ship no longer plans a fix-check, so a new finding closes +by a fix that a later full round or the read-only final review reads clean, a +`Review-Finding` trailer, or the Captain's ruled note. + A fix-check that a grant bought and that read the fix clean closes exactly the findings the grant names, with no owner ruling. `gstack-ship-receipt write` checks it from records gstack's tools wrote, never from the `--review-loop` @@ -467,7 +415,7 @@ lane knows the diff has, `gstack-review-plan --declare-risk ` adds it: detected classes, only raises the depth, and prints `RISK_DECLARED: classes= detected=`. The outside voice reads its diff from a file the brief names with its sha256; past 2,000,000 bytes it reads a path-scoped slice whose brief lists the files left out. -`--fix-checks ` tells the loop how many fix-checks ran, so the owner's grant +For a grant recorded before GST-3562 only (deprecated), `--fix-checks ` tells the loop how many fix-checks ran, so the grant adds one fix-check after the first and never a second, in the lean loop and after a round-2 fix-check in the full loop (GEVA-223). @@ -987,7 +935,7 @@ class the lane added shows apart from what the matchers found) and the queue ref (capy-ai[bot]'s review id, reviewer and head); write and the queue accept it only under `review.platform on`, on a docs or tests diff with no numeric, results or prereg claims, with the review at that exact head, so a new head needs `/ship` again. A stop the owner -accepted after a fix-check edit, or after the second full pass with a finding +accepted after a fix-check edit (deprecated with fix-check grants; removed next release), or after the second full pass with a finding left open (`second_pass`), goes in `review_loop_exception`, never in prose under `REVIEW_LOOP:`. Step 16 takes the same record: `gstack-ship-release finish --review-loop-exception ` routes the @@ -1099,7 +1047,7 @@ larger edit still refuse; a finding goes to the lane's Captain | Value | Pass 1 | Blocking finding in unchanged code | Pass 2+ | Cap | |---|---|---|---|---| -| `frozen` (default) | the diff | listed as deferred in the PR body | the range since the previous pass, blocking only | 2 rounds (a fix-check is one) | +| `frozen` (default) | the diff | listed as deferred in the PR body | the range since the previous pass, blocking only | 2 full rounds per PR, then the read-only final review if code changed | | `diff-plus-blocking` | the diff | fixed in this PR | the range since the previous pass, blocking only | 3 fix cycles (Step 9.4 runs the review plan's two-round cap only under `frozen`) | | `all` | everything | fixed in this PR | the whole diff, every finding | 3 fix cycles | @@ -1351,7 +1299,7 @@ ones, and the arm lost blockers. `bin/gstack-review-dispatch` closes both ends: create whose result was lost by its title and never starts a reader twice; a missing or doubled title stops the pass. On Capy the pass runs as one call to the checked-in program `lib/capy-review-pass.js`, served by `program` and loaded - unchanged by the gstack Capy skill. A full repeat pass takes `--diff-base` (RANGE_BASE; a scoped pass, none), a + unchanged by the gstack Capy skill. A full repeat pass takes `--diff-base` (RANGE_BASE; a scoped pass and the read-only final review, none), a fix-check plan renders its reader from `--fix-list`, `--hunks`, `--tests` and `--callers`, `--audit-only` runs just the `--extras` readers (Step 14.5's docs audit), `--voices` keeps only the plan's voices for Step 11 on its own `--out` (it takes no `--extras`, and a diff --git a/docs/ship-policy.md b/docs/ship-policy.md index 46bf8c27a..649ab664c 100644 --- a/docs/ship-policy.md +++ b/docs/ship-policy.md @@ -1329,6 +1329,12 @@ first (`pr`, `head`, `version`, `base`), then the evidence (`gate`, `ci`, `carry`, `no_stop`), validated against the `ship-receipt` schema (`gstack-artifact schema ship-receipt`) and read back by `gstack-ship-receipt read`, `result`, `carry` and the queue. +Since GST-3562 (H), write and the queue's binding check need none of the +`docs`, `review_loop`, `issues` or budget records to bind a receipt at its head; +of the old records only the targeted reader's (`--review-targeted`) is still +required, when Step 9's plan named a targeted class. Keep passing +`--review-loop`: the next /ship run counts the PR's earlier rounds from it +(`gstack-ship-receipt history`). A receipt that still carries the old records binds. **`version`.** The version source at HEAD: the path `.gstack/version-path` pins, else `VERSION`, else `package.json#version`. A repository with none of @@ -1403,7 +1409,8 @@ checked-out HEAD, when the receipt records `gstack_version` without `class` one of the four no-stop defaults. /ship passes the branch's `gstack-no-stop` ledger here ([review-policy.md#no-stop](review-policy.md#no-stop)). -**`review_loop_exception`.** The owner's acceptance of a stop after a +**`review_loop_exception`.** Deprecated with fix-check grants (GST-3562 A; write +still takes one for a stop before it, and the next release removes it). The owner's acceptance of a stop after a fix-check edit under frozen scope (#3559), from `write --review-loop-exception `: `{ accepted_by, date, via, reason, fix_check: { head, findings[, files] } }`. It needs `--review-loop` with `fix_checks` of 1 or more, a `fix_check.head` @@ -1802,14 +1809,16 @@ construction: failed review. 3. **Two rounds is the cap** (R51), stepped by the [transition table](review-policy.md#transitions); a full pass, a - [scoped pass](review-policy.md#scoped-pass) and a fix-check each count as a round. A pass that applied no edits + [scoped pass](review-policy.md#scoped-pass) each count as a round, and /ship plans no fix-check: any code change + after round 1 gets a full round 2 (GST-3562 A). A pass that applied no edits continues to Step 10: the loop ships with its deferred and noted items named in the PR body. A blocking finding still open after the last allowed step stops - the run and names the finding (path, severity, problem) for the owner instead - of a third round. A fix applied in the last allowed round gets one read-only + the run and names the finding (path, severity, problem) for the lane's Captain + instead of a third round: the PR ships with its open notes or the Captain rules. A fix applied in the last allowed round gets one read-only full review of the final head with no fix round (GST-3562 A); a fix after it - stops for the owner. A grant no longer buys a fix-check at the cap; one - answering the stop after a round-2 fix-check still does, until a later release. + stops for the Captain. Fix-check and round grants are deprecated: one recorded + before GST-3562 still answers its stop for one release, and the next release + removes them. **What ends a /ship run (GST-3260).** Preflight opens the run in the checkout's @@ -2216,15 +2225,17 @@ that doesn't carry each of those lines word for word. **When the route still says behavior at the round cap.** `finish`'s behavior STOP tells the lane to plan the inserted Step 9 with `gstack-review-plan ---post-review` (plus `--pass`, `--last` and `--fix-checks` as the loop left +--post-review` (plus `--pass` and `--last` as the loop left them). Edits after the review bound plan as a fix to a gate-class path, never as a note. The exception is a range after the last fix-check whose edits are only release stamps and docs (`docsChangeSince`): it plans `NEXT: done`, or `NEXT: targeted` for a docs claim on a targeted-class diff, with no grant ([review-policy.md](review-policy.md#transitions), GST-1702). Below the round cap that's a pass on the range (a fix-check under the lean panel before GST-3562; a full pass on the range since). At the cap it gets -one read-only full review of the whole PR diff (GST-3562 A), never `done`, and a -grant buys no fix-check there. When the last step was a +one read-only full review of the whole PR diff (GST-3562 A), never `done`; any +other edit after review costs the next round. The rest of this paragraph and the +chain below serve only grants recorded before GST-3562 (deprecated, removed next +release). When the last step was a fix-check, pass `--range-base` at that fix-check's commit: a new grant at a stop head after it plans the next link of the chain below (GST-1676), and the last link's own grant is refused. So `finish` never asks for a step the @@ -2507,7 +2518,7 @@ A changed product path, or a product patch-id that differs, is base context next to the branch's unchanged hunks, which carries with no reader (GST-3562), or a hunk the base merge spliced, which is [`RECEIPT_CARRY_SCOPED_REVIEW`](troubleshooting.md#receipt-carry-scoped-review) -until one fix-check reviewer clears the packet; a working tree with uncommitted +until one scoped reader clears the packet; a working tree with uncommitted changes is [`RECEIPT_CARRY_REFUSED`](troubleshooting.md#receipt-carry-refused). A `RECEIPT_CARRY_PRODUCT_CHANGED` on linear history against the reviewed base whose range-diff, plus the diff of the changed product paths, is at most 400 @@ -2577,7 +2588,7 @@ review loop or Step 14.5's docs audit for a carried receipt: carry` is eligibility only; a refusal continues the full ship, except `RECEIPT_CARRY_SCOPED_REVIEW`, for which `gstack-ship-preflight` prints `NEXT: carry route`: fix what the base merge broke, commit and push, run carry - without `--dry-run` to write the packet, have one fix-check reviewer read it, + without `--dry-run` to write the packet, have one scoped reader read it (without asking; not a review round), then carry with `--scoped-review ` and `--pregate`. A blocking finding continues the full ship. 2. Fix what the base merge broke (the CHANGELOG, the size caps the policy diff --git a/docs/skills.md b/docs/skills.md index 4fd0d529a..29545eb4f 100644 --- a/docs/skills.md +++ b/docs/skills.md @@ -746,7 +746,7 @@ If your project doesn't have a test framework, `/ship` sets one up — detects y ### Coverage audit -Every `/ship` run builds a code path map from your diff, searches for corresponding tests, and produces an ASCII coverage diagram with quality stars. Gaps get tests auto-generated. Your PR body shows the coverage: `Tests: 42 → 47 (+5 new)`. +Every `/ship` run builds a code path map from your diff, searches for corresponding tests, and produces an ASCII coverage diagram with quality stars. Gaps get tests auto-generated. Your PR body shows the coverage: `Tests: 42 → 47 (+5 new)`. An unattended `/ship` ([ship/DRIVER.md](../ship/DRIVER.md)) skips this coverage reader, and with no plan it also skips the plan-completion audit and the exploratory pass below (GST-3562). `/review` and `/ship` also run a bounded exploratory pass on changed behavior and nearby risks, even for a small diff without a plan or web server. Their existing approval and test rules govern any fixes or permanent tests; a blocked probe remains a coverage gap, not a passing QA result. diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 1ed2bc5fa..48f340155 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -704,9 +704,9 @@ cannot repair it. **Fix.** Keep the checkout frozen (no edits, commits, merges or pushes) from a pass's start until every reviewer in it has returned and its row is logged. If the mid-pass change was your own fix to that pass's findings, log the pass with `"converged":false` and the fix -as `"action":"fixed"`. `gstack-review-plan` then picks the repeat: one fix-check reading -the touched hunks when every fix is below the blocking floor, and 11.5 accepts that -fix-check record as Step 9's. Rerun Step 11's native pass on the same frozen tree. +as `"action":"fixed"`. `gstack-review-plan` then picks the repeat, never a fix-check since GST-3562: a fix +after round 1 gets a full round 2 on the range, and a fix in the last round gets the +read-only final review. Step 11.5 binds that pass's record. Rerun Step 11's native pass on the same frozen tree. **Expected result.** `gstack-review-read` shows both records at one tree with `review_freshness` `CURRENT`, and Step 11.5 continues to Step 12. @@ -7767,7 +7767,9 @@ prints each `RULED_NOTE:`, and the PR body and receipt list every `Ruled note:` line ([ship-policy.md](ship-policy.md#ruled-notes)). A ruling at a head outside the range is listed as `not applied`, and a path edited after the fix-check still routes by the post-review rules. When the owner wants the -findings fixed instead, fix them and ask for a grant for one more fix-check. +findings fixed instead, fix them and run /ship again: fix-check grants are +deprecated (GST-3562 A), so ask for none, and a PR past its two rounds whose code +changed gets one read-only full review of its final head. A stopped final review or native reader row works the same way: its `gstack-review-read` reason lists each finding still waiting for a ruling, a `noted` CRITICAL included, so rule each listed fingerprint at the head it names. @@ -7787,8 +7789,8 @@ counted here. **Fix.** Fix the finding, commit, and run /ship again on the new head; that run's Step 9 row records it `fixed`. If it should ship unfixed, take the stop -to the owner: their ruled note (`gstack-approvals rule`) closes it, or their -grant buys one fix-check. Never edit the review-log row or the loop file to +to the owner: their ruled note (`gstack-approvals rule`) closes it. Ask for no +fix-check grant: those are deprecated (GST-3562 A). Never edit the review-log row or the loop file to drop the finding, and never write the receipt by hand ([ship-policy.md](ship-policy.md#ship-receipt)). @@ -7798,7 +7800,7 @@ drop the finding, and never write the receipt by hand **Meaning.** `gstack-ship-receipt write --review-loop-exception` refused the record and wrote nothing: it is not `{ accepted_by, date, via, reason }` with exactly one of `fix_check: { head, findings[, files] }` (a stop after a -fix-check) or `second_pass: { head, deferred: [] }` (a stop after +fix-check; deprecated with fix-check grants and removed next release) or `second_pass: { head, deferred: [] }` (a stop after the second full pass left a finding open, TRUT-7), `--review-loop` is missing or does not show that stop (no fix-check counted, or fewer than two passes or no deferred finding), the head is neither the receipt head nor its ancestor, or @@ -7918,8 +7920,9 @@ which a base merge can move (GST-2229), and the base's own change, already merged at base (GST-1226), are shown and not counted. A base change over 2,000 lines in one file counts in full again and takes the full loop. -**Fix.** Dispatch one fix-check reviewer -([review-policy.md](review-policy.md)) on the packet. When it comes back clean, +**Fix.** Dispatch one scoped reader +([review-policy.md](review-policy.md)) on the packet, without asking: it is not a +review round. When it comes back clean, write `{"head":"","paths":[...],"reviewer":"","verdict":"clean"}` and rerun `gstack-ship-receipt carry ... --scoped-review `; the carry reason records the reviewer and the paths. A blocking finding means /ship @@ -7994,9 +7997,11 @@ final head; this stop then means that review found a blocker or a gate-class edi notes; a fix applied after it, even below the floor, stops for the lane's Captain (GST-3562 A). -**Fix.** The lane's Captain decides. Ship with the open notes listed, park, or, -when a finding above the floor is open in this PR's own change, buy the stopped -review's fix round: +**Fix.** The lane's Captain decides: ship with the open notes listed, park, or +keep the fix and run /ship again for one more read-only full review of the final +head. Round grants are deprecated (GST-3562 A) and the next release removes them, +so record no new one. The steps below serve only a grant recorded before +GST-3562, which still buys the stopped review's fix round: 1. Record the stop: `gstack-ship-receipt stop --pr --run --since ` (`/ship` runs it on `NEXT: stop`). It prints @@ -8011,7 +8016,8 @@ review's fix round: since that head, with no new full review. The run claims the grant first (`gstack-ship-receipt claim`). -A head no review has stopped at takes an `--kind extra-round` grant instead: +A head no review has stopped at takes an `--kind extra-round` grant instead +(deprecated the same way): one full round with its fix round. Each grant is spent by the one run that claims it. When `PR_REVIEW_GRANT: not applied (...)` prints, the reason names what doesn't match (another stop or head, a stale stop, a claimed grant). This @@ -8028,8 +8034,10 @@ gstack can tie to one commit: the newest `via:ship` reading row since or its commit isn't HEAD or under it. It recorded no stop record, so no fix-check grant can buy that review's fix round. -**Fix.** The lane's Captain ships with the open notes listed, parks, or rules -the fix round with a grant that needs no stop record: `gstack-approvals +**Fix.** The lane's Captain ships with the open notes listed, or parks. Fix-check +grants are deprecated (GST-3562 A) and go in the next release, so record no new +one. Before GST-3562 the Captain could rule the fix round with a grant that needs +no stop record, and one recorded then still works for one release: `gstack-approvals round-grant --pr --head --kind fix-check --reason --by ` (add `--owner-ref` and `--words` inside an open run). The run then claims it, commits the fix, runs the one scoped fix-check @@ -8088,8 +8096,9 @@ fix-check row that doesn't count (`converged:false`, partial hunks) spends nothing: log a correct row in the same run instead of asking for a new grant ([review-policy.md](review-policy.md#one-grant-path)). -**Fix.** Record a new grant for the stop the PR is at now; `gstack-ship-receipt -stop` prints the command ([troubleshooting](#pr-round-cap)). +**Fix.** Record no new grant: fix-check and round grants are deprecated +(GST-3562 A). The lane's Captain decides the stop as +[`PR_ROUND_CAP`](#pr-round-cap) says. ### `GRANT_UNKNOWN` diff --git a/docs/unattended.md b/docs/unattended.md index d0d5acc67..e42e5e8b5 100644 --- a/docs/unattended.md +++ b/docs/unattended.md @@ -313,7 +313,7 @@ counters are kept, because the reviewed product diff is unchanged or its only difference passed a scoped review. `CARRY: current` means nothing moved. `CARRY: refused (RECEIPT_CARRY_SCOPED_REVIEW)` means the base merge spliced lines into reviewed hunks (moved context next to unchanged hunks carries). Carry without `--dry-run` writes the packet the -refusal names (a dry run writes none), one fix-check reviewer reads it, and a +refusal names (a dry run writes none), one scoped reader reads it, and a clean record reruns carry with `--scoped-review ` ([troubleshooting](troubleshooting.md#receipt-carry-scoped-review)). `CARRY: refused (RECEIPT_CARRY_PRODUCT_CHANGED)`, `(RECEIPT_CARRY_TREE_MISMATCH)` or `(RECEIPT_CARRY_REFUSED)` with the refused diff --git a/lib/pregate/config.ts b/lib/pregate/config.ts index c03b7e260..b7214baa9 100644 --- a/lib/pregate/config.ts +++ b/lib/pregate/config.ts @@ -82,7 +82,7 @@ import { containedRelative, globToRegExp, runningGstackVersion, SHIP_POLICY_PATH import { cmpVersion, parseVersion } from '../version-source'; export const PREGATE_CONFIG_PATH = '.gstack/pregate.json'; -export const PREGATE_CONFIG_SCHEMA = 'https://github.com/garrytan/gstack/docs/pregate.md#pregate-v1'; +export const PREGATE_CONFIG_SCHEMA = 'https://github.com/garrytan/gstack/blob/main/docs/pregate.md#pregate-v1'; export const NON_DOWNGRADABLE = ['secrets', 'guards'] as const; /** Finding ids (or categories) no allowlist entry may name: the real value of a credential-named environment variable (#3449), and the secret wildcard. */ export const NON_ALLOWLISTABLE = ['env.value', 'secret'] as const; diff --git a/lib/review-depth.ts b/lib/review-depth.ts index fdd943212..16868a049 100644 --- a/lib/review-depth.ts +++ b/lib/review-depth.ts @@ -454,7 +454,7 @@ function prCapped(h: History, n: NextStep): NextStep { const prior = h.priorFull ?? 0; const cap = FULL_PASS_CAP + (h.roundGrant ? 1 : 0); if (prior >= cap) { - if (h.last === 'none') return n.step === 'full' || n.step === 'scoped' ? { step: 'full', reason: `read-only final review (R51): this PR already had ${prior} full review rounds on earlier heads, so this head gets one full review with no fix round; a blocker goes to the lane's Captain as a decision and the count does not reopen` } : n; + if (h.last === 'none') return n.step === 'full' || n.step === 'scoped' ? { step: 'full', reason: `read-only final review (R51): this PR already had ${prior} full review rounds on earlier heads, so this head gets one full review with no fix round; a blocker goes to the lane's Captain as a decision and the count does not reopen`, keepReader: true, readOnly: true } : n; if (n.step === 'done') return n; if (h.fixedBelow && !h.fixedBlocking && !h.blockingOpen && !h.touchedGate && n.step !== 'stop') return { step: 'stop', reason: `a fix followed the read-only final review: ${CAPTAIN_DECIDES}` }; if (!h.fixedBlocking && !h.blockingOpen && !h.touchedGate && n.step !== 'stop') return { step: 'done', reason: `read-only final review done (R51): its below-floor findings ship as notes in the PR body and receipt, with no fix round` }; diff --git a/scripts/resolvers/ship-driver.ts b/scripts/resolvers/ship-driver.ts index beb06e602..a011734eb 100644 --- a/scripts/resolvers/ship-driver.ts +++ b/scripts/resolvers/ship-driver.ts @@ -18,11 +18,9 @@ export const SHIP_DRIVER_STOPS: Array<{ when: string; read: string }> = [ { when: 'a red eval or a failed free-suite shard', read: 'sections/measure.md#measure-then-fix-loop-a-red-paid-eval-or-a-failed-free-suite-shard' }, { when: 'Greptile found', read: 'sections/greptile-early.md#step-65-early-greptile-pr-after-the-free-tests-pass' }, { when: 'Step 10 with a PR', read: 'sections/greptile.md#step-10-address-review-bot-comments-if-pr-exists' }, - { when: 'coverage below target, a failed audit', read: 'sections/test-coverage.md#step-7-test-coverage-audit' }, { when: 'plan items NOT DONE or UNVERIFIABLE', read: 'sections/plan-completion.md#gate-logic' }, { when: '`NEXT: stop`', read: 'sections/review-army.md#decide-whether-to-repeat-step-9' }, { when: 'a `REVIEW_SCOPE_*` refusal, the review-log row', read: 'sections/review-army.md#step-94-fix-first-and-persistence' }, - { when: 'a required probe not passed', read: 'sections/review-army.md#step-921-exploratory-qa-before-fix-first' }, { when: 'native adversarial incomplete, queued fixes', read: 'sections/adversarial.md#finish-the-adversarial-phase' }, { when: 'Step 11.5 mismatch', read: 'SKILL.md#step-115-bind-the-reviews' }, { when: 'a `version` STOP', read: 'SKILL.md#step-12-version-bump-auto-decide' }, diff --git a/ship/DRIVER.md b/ship/DRIVER.md index 123511b8e..b13dba283 100644 --- a/ship/DRIVER.md +++ b/ship/DRIVER.md @@ -15,7 +15,7 @@ the next act. Read a section only when a phase or the list below sends you, neve up front. A STOP or decision this file does not cover: read `ship/SKILL.md` at that step, finish there, come back. Unattended, take a question's recommended option (log it); gate dispositions and approvals stay pending and end the run, except `gstack-no-stop`. Keep a record (`--record`): write its six headings at Phase 1, fill each per phase: **Checks** -(Phases 2-4: lanes, pregate, evals, `Coverage:`, the plan checks, `Exploratory QA:`, `Scope Check:`), **Decisions** (any +(Phases 2-4: lanes, pregate, evals, `Coverage:` and Step 8's `--audit` line), **Decisions** (any phase: questions and answers, verbatim), **Reviews** (Phases 3-5: the plan line, start tokens, `Pre-Landing Review:`, `Gate edits:`, the reviewed tree), **Release** (Phases 5-7: version, CHANGELOG, commits), **Documentation** (Step 14.5) and **Next steps** (every phase: the next act). @@ -23,11 +23,11 @@ version, CHANGELOG, commits), **Documentation** (Step 14.5) and **Next steps** ( **Reviewers are the sections' own.** Every reviewer brief, its severity and confidence rules and gates come from its section verbatim; this file never shortens a reviewer's brief. A blocking reader's prompt is its `gstack-review-dispatch render` -file, unchanged; its findings reach `merged.jsonl` only via `collect`; `judge` refuses a drop or downgrade. Audit readers (Steps 7, 8, 14.5) cannot block: low effort on `AUDIT_MODEL:`, +file, unchanged; its findings reach `merged.jsonl` only via `collect`; `judge` refuses a drop or downgrade. Audit readers cannot block (here only 14.5 runs): low effort on `AUDIT_MODEL:`, 14.5 once; findings go to the PR body. **Calls.** One pass with no fixes is 9 calls: Phases 1-8 and the report; at most 12 with a STOP's -section read or fix-check, plus a keep-alive per 200 s waited under ~80 min (longer: end the turn on one wait; no 10-15 min polls). +section read or a repeat pass, plus a keep-alive per 200 s waited under ~80 min (longer: end the turn on one wait; no 10-15 min polls). **Budget: observe.** `gstack-ship-budget start --mode observe` only records: each program ends with `gstack-ship-budget note --step --reading R --credits C --record `, R and C read in it @@ -68,23 +68,22 @@ harness: start the eval selector and pre-merge command (detached past 30 min); e record `evals: none affected`. Step 6.5 runs only if `gstack-greptile-early detect` finds Greptile. Then `gstack-ship-preflight --audit --base --out ` writes the diff once (`CONTEXT:`) and the TODOS.md items on touched paths (`TODOS:`); prints the coverage map, -plan candidates and `READER: coverage= plan=`; read a section only when its reader is `needed`. +plan candidates and `READER: coverage= plan=`; Phase 3 runs neither reader. Never read TODOS.md or the full diff into the parent. A `PERSIST:` hint never replaces Step 9. ## 3. Audits and review: Steps 7, 8, 9, 9.1, 9.2, 9.2.1 -One program: the audit readers `READER:` names (Step 7 from `sections/test-coverage.md`, Step 8 from -`sections/plan-completion.md`, each run as written; Step 7 may write tests, so it settles first), 9.2.1's Reads only and the pass -(above): Steps 9-9.2 from `sections/review-army.md` as written. `Coverage:` and Step 8's line come from `--audit` when no -reader ran. +One program: `--audit`'s lines and the pass (above): Steps 9-9.2 from `sections/review-army.md` as written. Skipped: the Step 7 +reader (`sections/test-coverage.md`, GST-3562 K); on `plan=none` also Step 8's (`sections/plan-completion.md`) and 9.2.1 (L), else +both run as written. `Coverage:` and Step 8's line come from `--audit`. ## 4. Judgment: Steps 8.1, 8.2, 9.3, 9.4 and Step 11 -Step 8.1, 9.2.1's probes, 8.2 (`Scope Check:`) on the todos and commits files, then the core checklist, Steps +On `plan=none` Steps 8.1, 8.2 and 9.2.1 are skipped (L). The core checklist, Steps 9.3, 9.4 and the repeat decision as written (`JUDGMENT: ok` before any fix), fixes and persistence in one program. Prints `Pre-Landing Review:`, `Gate edits:`. `NEXT: stop` stops; `full` or -`scoped`: one program runs the failing test, fix, `--tests-only` and Phase 3, each gated (`diffBase` RANGE_BASE on `full` only; scoped fix-check: Step 3.5); `fix-check`: the -pass with `fixCheck: {fix_list, hunks, tests, callers}`; `done` or `voices`: that program runs Step 11 from +`scoped`: one program runs the failing test, fix, `--tests-only` and Phase 3, each gated (`diffBase` RANGE_BASE on a `full` round 2 only, never +on a scoped pass or the `READ_ONLY:` final review, which reads the whole PR and takes no fix); `fix-check` (only a pre-GST-3562 grant's, deprecated): the pass with `fixCheck: {fix_list, hunks, tests, callers}`; `done` or `voices`: that program runs Step 11 from `sections/adversarial.md` as written (above), only the voices the last full-pass plan lists (none: `ADVERSARIAL: skipped (review plan)`). @@ -99,10 +98,11 @@ approvals; `VERSION: skipped|kept`: no write. ## 6. Notes and documentation: Steps 13, 14, 14.5 Step 13: one user-facing entry from the commits file where `NEXT:` says; -`gstack-prose-lint --base origin/ --gate` until `PROSE_LINT: ok`. Step 14: TODOS.md deferrals and -completions, edited from the todos file. Step 14.5, every ship: read `sections/documentation.md` and run its audit as written, as +`gstack-prose-lint --base origin/ --gate` until `PROSE_LINT: ok`. Step 14 is skipped (no catch +recorded, L). Step 14.5, every ship: read `sections/documentation.md` and run its audit as written, as one program (above), then `gstack-ship-receipt docs-caps --base `; print `Documentation:`. -One re-audit at most. +One re-audit at most. It edits only README.md, `docs/`, `bench/README.md`; +a SKILL.md or template edit after review costs the next round. ## 7. Release: Steps 15, 16, 17 @@ -117,7 +117,7 @@ repo gates run with CI. Unattended, push defers the pre-push offer; else its STO - Step 18: the open-PR lookup; a plain `v ` title (`gstack-plain-title check`). `UNATTENDED_SHIP:` with no open PR at HEAD takes Step 18-H. - Step 19 body: plain opening sentences, then sections `sections/pr-body.md` lists, led under `CAPY_PR: on` (Step 19-C) by What changed, Why and Blast radius; Agent notes last (receipt, `gstack-approvals render --plan`, `REVIEW_LOOP:`). `gstack-prose-lint --sections 'Why,Summary,Blast radius' --gate`; `gstack-issue-links`; `gstack-review-scope summary --since "$REVIEW_SINCE" --run && gstack-ship-receipt write --pr --base --gate @ --pregate --issues @ --review-loop @ --docs @ --budget-record [--review-exclude ] [--review-targeted @] --body `; `gstack-post pr-body` and `pr-title` (new PR: host PR tool; draft while a gate finding is `open`). `SHIP_RECEIPT:` opens your report. -- Step 20: a metrics row via `gstack-review-log`. +- Steps 20 and 21 are skipped (no catch recorded, L; /retro gets no row). - Step 22: `gstack-ship-budget close --reading R --credits C` (report `BUDGET_FINAL:`, `BUDGET_TIMELINE:`, any `METER:` line), then `gstack-ship-receipt result --pr `: `GSTACK_RESULT: skill=ship status=complete head= run=`. Under a merge queue, `gstack-ship-queue ready --pr [--screen|--no-screen]` at the pushed head; paste its output. ## Where each STOP sends you (paths under `/ship/`) @@ -131,11 +131,9 @@ repo gates run with CI. Unattended, push defers the pre-push offer; else its STO - a red eval or a failed free-suite shard: `sections/measure.md#measure-then-fix-loop-a-red-paid-eval-or-a-failed-free-suite-shard` - Greptile found: `sections/greptile-early.md#step-65-early-greptile-pr-after-the-free-tests-pass` - Step 10 with a PR: `sections/greptile.md#step-10-address-review-bot-comments-if-pr-exists` -- coverage below target, a failed audit: `sections/test-coverage.md#step-7-test-coverage-audit` - plan items NOT DONE or UNVERIFIABLE: `sections/plan-completion.md#gate-logic` - `NEXT: stop`: `sections/review-army.md#decide-whether-to-repeat-step-9` - a `REVIEW_SCOPE_*` refusal, the review-log row: `sections/review-army.md#step-94-fix-first-and-persistence` -- a required probe not passed: `sections/review-army.md#step-921-exploratory-qa-before-fix-first` - native adversarial incomplete, queued fixes: `sections/adversarial.md#finish-the-adversarial-phase` - Step 11.5 mismatch: `SKILL.md#step-115-bind-the-reviews` - a `version` STOP: `SKILL.md#step-12-version-bump-auto-decide` diff --git a/ship/DRIVER.md.tmpl b/ship/DRIVER.md.tmpl index 0a5651f5c..2cb4423b3 100644 --- a/ship/DRIVER.md.tmpl +++ b/ship/DRIVER.md.tmpl @@ -13,7 +13,7 @@ the next act. Read a section only when a phase or the list below sends you, neve up front. A STOP or decision this file does not cover: read `ship/SKILL.md` at that step, finish there, come back. Unattended, take a question's recommended option (log it); gate dispositions and approvals stay pending and end the run, except `gstack-no-stop`. Keep a record (`--record`): write its six headings at Phase 1, fill each per phase: **Checks** -(Phases 2-4: lanes, pregate, evals, `Coverage:`, the plan checks, `Exploratory QA:`, `Scope Check:`), **Decisions** (any +(Phases 2-4: lanes, pregate, evals, `Coverage:` and Step 8's `--audit` line), **Decisions** (any phase: questions and answers, verbatim), **Reviews** (Phases 3-5: the plan line, start tokens, `Pre-Landing Review:`, `Gate edits:`, the reviewed tree), **Release** (Phases 5-7: version, CHANGELOG, commits), **Documentation** (Step 14.5) and **Next steps** (every phase: the next act). @@ -21,11 +21,11 @@ version, CHANGELOG, commits), **Documentation** (Step 14.5) and **Next steps** ( **Reviewers are the sections' own.** Every reviewer brief, its severity and confidence rules and gates come from its section verbatim; this file never shortens a reviewer's brief. A blocking reader's prompt is its `gstack-review-dispatch render` -file, unchanged; its findings reach `merged.jsonl` only via `collect`; `judge` refuses a drop or downgrade. Audit readers (Steps 7, 8, 14.5) cannot block: low effort on `AUDIT_MODEL:`, +file, unchanged; its findings reach `merged.jsonl` only via `collect`; `judge` refuses a drop or downgrade. Audit readers cannot block (here only 14.5 runs): low effort on `AUDIT_MODEL:`, 14.5 once; findings go to the PR body. **Calls.** One pass with no fixes is 9 calls: Phases 1-8 and the report; at most 12 with a STOP's -section read or fix-check, plus a keep-alive per 200 s waited under ~80 min (longer: end the turn on one wait; no 10-15 min polls). +section read or a repeat pass, plus a keep-alive per 200 s waited under ~80 min (longer: end the turn on one wait; no 10-15 min polls). **Budget: observe.** `gstack-ship-budget start --mode observe` only records: each program ends with `gstack-ship-budget note --step --reading R --credits C --record `, R and C read in it @@ -66,23 +66,22 @@ harness: start the eval selector and pre-merge command (detached past 30 min); e record `evals: none affected`. Step 6.5 runs only if `gstack-greptile-early detect` finds Greptile. Then `gstack-ship-preflight --audit --base --out ` writes the diff once (`CONTEXT:`) and the TODOS.md items on touched paths (`TODOS:`); prints the coverage map, -plan candidates and `READER: coverage= plan=`; read a section only when its reader is `needed`. +plan candidates and `READER: coverage= plan=`; Phase 3 runs neither reader. Never read TODOS.md or the full diff into the parent. A `PERSIST:` hint never replaces Step 9. ## 3. Audits and review: Steps 7, 8, 9, 9.1, 9.2, 9.2.1 -One program: the audit readers `READER:` names (Step 7 from `sections/test-coverage.md`, Step 8 from -`sections/plan-completion.md`, each run as written; Step 7 may write tests, so it settles first), 9.2.1's Reads only and the pass -(above): Steps 9-9.2 from `sections/review-army.md` as written. `Coverage:` and Step 8's line come from `--audit` when no -reader ran. +One program: `--audit`'s lines and the pass (above): Steps 9-9.2 from `sections/review-army.md` as written. Skipped: the Step 7 +reader (`sections/test-coverage.md`, GST-3562 K); on `plan=none` also Step 8's (`sections/plan-completion.md`) and 9.2.1 (L), else +both run as written. `Coverage:` and Step 8's line come from `--audit`. ## 4. Judgment: Steps 8.1, 8.2, 9.3, 9.4 and Step 11 -Step 8.1, 9.2.1's probes, 8.2 (`Scope Check:`) on the todos and commits files, then the core checklist, Steps +On `plan=none` Steps 8.1, 8.2 and 9.2.1 are skipped (L). The core checklist, Steps 9.3, 9.4 and the repeat decision as written (`JUDGMENT: ok` before any fix), fixes and persistence in one program. Prints `Pre-Landing Review:`, `Gate edits:`. `NEXT: stop` stops; `full` or -`scoped`: one program runs the failing test, fix, `--tests-only` and Phase 3, each gated (`diffBase` RANGE_BASE on `full` only; scoped fix-check: Step 3.5); `fix-check`: the -pass with `fixCheck: {fix_list, hunks, tests, callers}`; `done` or `voices`: that program runs Step 11 from +`scoped`: one program runs the failing test, fix, `--tests-only` and Phase 3, each gated (`diffBase` RANGE_BASE on a `full` round 2 only, never +on a scoped pass or the `READ_ONLY:` final review, which reads the whole PR and takes no fix); `fix-check` (only a pre-GST-3562 grant's, deprecated): the pass with `fixCheck: {fix_list, hunks, tests, callers}`; `done` or `voices`: that program runs Step 11 from `sections/adversarial.md` as written (above), only the voices the last full-pass plan lists (none: `ADVERSARIAL: skipped (review plan)`). @@ -97,10 +96,11 @@ approvals; `VERSION: skipped|kept`: no write. ## 6. Notes and documentation: Steps 13, 14, 14.5 Step 13: one user-facing entry from the commits file where `NEXT:` says; -`gstack-prose-lint --base origin/ --gate` until `PROSE_LINT: ok`. Step 14: TODOS.md deferrals and -completions, edited from the todos file. Step 14.5, every ship: read `sections/documentation.md` and run its audit as written, as +`gstack-prose-lint --base origin/ --gate` until `PROSE_LINT: ok`. Step 14 is skipped (no catch +recorded, L). Step 14.5, every ship: read `sections/documentation.md` and run its audit as written, as one program (above), then `gstack-ship-receipt docs-caps --base `; print `Documentation:`. -One re-audit at most. +One re-audit at most. It edits only README.md, `docs/`, `bench/README.md`; +a SKILL.md or template edit after review costs the next round. ## 7. Release: Steps 15, 16, 17 @@ -115,7 +115,7 @@ repo gates run with CI. Unattended, push defers the pre-push offer; else its STO - Step 18: the open-PR lookup; a plain `v ` title (`gstack-plain-title check`). `UNATTENDED_SHIP:` with no open PR at HEAD takes Step 18-H. - Step 19 body: plain opening sentences, then sections `sections/pr-body.md` lists, led under `CAPY_PR: on` (Step 19-C) by What changed, Why and Blast radius; Agent notes last (receipt, `gstack-approvals render --plan`, `REVIEW_LOOP:`). `gstack-prose-lint --sections 'Why,Summary,Blast radius' --gate`; `gstack-issue-links`; `gstack-review-scope summary --since "$REVIEW_SINCE" --run && gstack-ship-receipt write --pr --base --gate @ --pregate --issues @ --review-loop @ --docs @ --budget-record [--review-exclude ] [--review-targeted @] --body `; `gstack-post pr-body` and `pr-title` (new PR: host PR tool; draft while a gate finding is `open`). `SHIP_RECEIPT:` opens your report. -- Step 20: a metrics row via `gstack-review-log`. +- Steps 20 and 21 are skipped (no catch recorded, L; /retro gets no row). - Step 22: `gstack-ship-budget close --reading R --credits C` (report `BUDGET_FINAL:`, `BUDGET_TIMELINE:`, any `METER:` line), then `gstack-ship-receipt result --pr `: `GSTACK_RESULT: skill=ship status=complete head= run=`. Under a merge queue, `gstack-ship-queue ready --pr [--screen|--no-screen]` at the pushed head; paste its output. ## Where each STOP sends you (paths under `/ship/`) diff --git a/ship/SKILL.md b/ship/SKILL.md index e2b3c810f..7efc7cf1b 100644 --- a/ship/SKILL.md +++ b/ship/SKILL.md @@ -217,9 +217,9 @@ compare two with `git diff `. **Review policy** (docs/review-policy.md): only a finding that would fail a test, break production, or lose data or secrets blocks a pass; the rest is a PR-body note. Step 9's plan sets both reviews' depth (`--depth-floor standard|full` only -raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds under `frozen` -(fix-checks included), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) -is the knob; the receipt's `review_loop` records the outcome. +raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds per PR under `frozen` +(then a read-only review if code changed), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) +is the knob. ### Ship control flow diff --git a/ship/SKILL.md.tmpl b/ship/SKILL.md.tmpl index 5d9ccf55a..035cef73e 100644 --- a/ship/SKILL.md.tmpl +++ b/ship/SKILL.md.tmpl @@ -75,9 +75,9 @@ compare two with `git diff `. **Review policy** (docs/review-policy.md): only a finding that would fail a test, break production, or lose data or secrets blocks a pass; the rest is a PR-body note. Step 9's plan sets both reviews' depth (`--depth-floor standard|full` only -raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds under `frozen` -(fix-checks included), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) -is the knob; the receipt's `review_loop` records the outcome. +raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds per PR under `frozen` +(then a read-only review if code changed), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) +is the knob. ### Ship control flow diff --git a/ship/sections/adversarial.md b/ship/sections/adversarial.md index 1af25126b..6880a18a9 100644 --- a/ship/sections/adversarial.md +++ b/ship/sections/adversarial.md @@ -12,7 +12,7 @@ and add `--reservation ` to the `--start adversarial-review` call below. After `NEXT: voices` (gate class: Step 11 before any stop), Finish the adversarial phase takes neither decision 2 nor 3: rerun Step 9's repeat decision with `--adversarial-ran` (a queued blocking finding as `--blocking-open`); its `NEXT:` stands: only `stop` (Step 9.4's decision 2) -or a granted fix-check (item 3.5, then Step 11.5) follows voices. +follows voices, or a `fix-check` from a grant recorded before GST-3562 (item 3.5, then Step 11.5). ## Step 11: Adversarial review diff --git a/ship/sections/adversarial.md.tmpl b/ship/sections/adversarial.md.tmpl index 206bfef12..2f3b841b8 100644 --- a/ship/sections/adversarial.md.tmpl +++ b/ship/sections/adversarial.md.tmpl @@ -10,7 +10,7 @@ and add `--reservation ` to the `--start adversarial-review` call below. After `NEXT: voices` (gate class: Step 11 before any stop), Finish the adversarial phase takes neither decision 2 nor 3: rerun Step 9's repeat decision with `--adversarial-ran` (a queued blocking finding as `--blocking-open`); its `NEXT:` stands: only `stop` (Step 9.4's decision 2) -or a granted fix-check (item 3.5, then Step 11.5) follows voices. +follows voices, or a `fix-check` from a grant recorded before GST-3562 (item 3.5, then Step 11.5). {{ADVERSARIAL_STEP}} diff --git a/ship/sections/documentation.md b/ship/sections/documentation.md index a4f4bd41b..07222fc92 100644 --- a/ship/sections/documentation.md +++ b/ship/sections/documentation.md @@ -34,6 +34,8 @@ Reentry never resets the count or authorizes a launch. (`--select ` narrows release paths). It records HEAD, branch, index, path lists and hashes of release paths, generated outputs and docs, NUL-safely. Read only new files' content; the helper hashes the rest. Fill the prompt placeholders with literal candidate values. + In `edit` mode, `--docs` names only README.md, `docs/` and `bench/README.md`: the audit edits nothing else. A SKILL.md or + template edit after review is a code change and costs the next review round, so a change one needs goes in the PR body as a note. ## Launch the audit diff --git a/ship/sections/documentation.md.tmpl b/ship/sections/documentation.md.tmpl index e76ac1eb8..de1ad30b9 100644 --- a/ship/sections/documentation.md.tmpl +++ b/ship/sections/documentation.md.tmpl @@ -32,6 +32,8 @@ Reentry never resets the count or authorizes a launch. (`--select ` narrows release paths). It records HEAD, branch, index, path lists and hashes of release paths, generated outputs and docs, NUL-safely. Read only new files' content; the helper hashes the rest. Fill the prompt placeholders with literal candidate values. + In `edit` mode, `--docs` names only README.md, `docs/` and `bench/README.md`: the audit edits nothing else. A SKILL.md or + template edit after review is a code change and costs the next review round, so a change one needs goes in the PR body as a note. ## Launch the audit diff --git a/ship/sections/pr-body.md b/ship/sections/pr-body.md index 0ce215b02..cd3bd0767 100644 --- a/ship/sections/pr-body.md +++ b/ship/sections/pr-body.md @@ -255,19 +255,19 @@ NS=$(~/.claude/skills/gstack/bin/gstack-no-stop list | sed -n 's/^NO_STOP_FILE: ~/.claude/skills/gstack/bin/gstack-ship-receipt write --pr --run --base --gate @.gstack/tmp/ship-gate.json --pregate .gstack/tmp/pregate.json --issues @.gstack/tmp/issues.json --review-loop @.gstack/tmp/review-loop.json --docs @.gstack/tmp/docs-audit.json $([ -s .gstack/tmp/targeted.json ] && echo --review-targeted @.gstack/tmp/targeted.json) ${NS:+--no-stop "@$NS"} --body "$PR_BODY_FILE" ``` -If write refuses `review_targeted` for a docs claim added after the read, or after a granted fix round (add its `--grant`), rerun Step 9's plan with `--range-base +If write refuses `review_targeted` for a docs claim added after the read, rerun Step 9's plan with `--range-base --targeted-ran `; on `NEXT: targeted`, run that one reader (`pass`, its voices stage, `verify --targeted-out .gstack/tmp/targeted.json`) and write again. If write refuses `RECEIPT_DOCS_AUDIT_READ` (Step 14.5 edited a doc the review read), run its one scoped reader without asking: -it is not a review round and needs no grant. Give one reader the packet it names, save the clean record it prints the +it is not a review round and needs no ruling. Give one reader the packet it names, save the clean record it prints the shape of outside the worktree, and write again with `--docs-audit-read `; a finding goes to the lane's Captain. A Step 5 red-base pause adds `--base-red ` (a conditional receipt the queue refuses, `QUEUE_RECEIPT_CONDITIONAL`). `--docs` reads the record Step 14.5 saved (`{status, scope[, exception]}`): the receipt carries it as `docs`, and a `blocked` status without the owner's exception, or a body missing the exception line, is `DOCS_AUDIT_BLOCKED` with nothing written. -When the owner accepted a stop after a fix-check edit, add -`--review-loop-exception @` (`{accepted_by, date, via, reason, fix_check: {head, findings}}`) -and put its printed `Review-loop exception:` line in the body; never a prose line under `REVIEW_LOOP:`. +`--review-loop-exception` (an owner's acceptance of a stop after a fix-check edit) is deprecated with fix-check grants and goes +in the next release; write still takes one recorded before GST-3562. After the round cap, a blocker goes to the lane's Captain, +whose ruling is a ruled note (below); never a prose line under `REVIEW_LOOP:`. A finding the owner rules a disclosed note instead of a fix is closed only by the owner's `gstack-approvals rule`, recorded outside this run, never by this run or a review-log field (docs/ship-policy.md#ruled-notes); the receipt lists each one as `ruled_notes`. diff --git a/ship/sections/pr-body.md.tmpl b/ship/sections/pr-body.md.tmpl index bce1a602e..1affcf1bd 100644 --- a/ship/sections/pr-body.md.tmpl +++ b/ship/sections/pr-body.md.tmpl @@ -238,19 +238,19 @@ NS=$(~/.claude/skills/gstack/bin/gstack-no-stop list | sed -n 's/^NO_STOP_FILE: ~/.claude/skills/gstack/bin/gstack-ship-receipt write --pr --run --base --gate @.gstack/tmp/ship-gate.json --pregate .gstack/tmp/pregate.json --issues @.gstack/tmp/issues.json --review-loop @.gstack/tmp/review-loop.json --docs @.gstack/tmp/docs-audit.json $([ -s .gstack/tmp/targeted.json ] && echo --review-targeted @.gstack/tmp/targeted.json) ${NS:+--no-stop "@$NS"} --body "$PR_BODY_FILE" ``` -If write refuses `review_targeted` for a docs claim added after the read, or after a granted fix round (add its `--grant`), rerun Step 9's plan with `--range-base +If write refuses `review_targeted` for a docs claim added after the read, rerun Step 9's plan with `--range-base --targeted-ran `; on `NEXT: targeted`, run that one reader (`pass`, its voices stage, `verify --targeted-out .gstack/tmp/targeted.json`) and write again. If write refuses `RECEIPT_DOCS_AUDIT_READ` (Step 14.5 edited a doc the review read), run its one scoped reader without asking: -it is not a review round and needs no grant. Give one reader the packet it names, save the clean record it prints the +it is not a review round and needs no ruling. Give one reader the packet it names, save the clean record it prints the shape of outside the worktree, and write again with `--docs-audit-read `; a finding goes to the lane's Captain. A Step 5 red-base pause adds `--base-red ` (a conditional receipt the queue refuses, `QUEUE_RECEIPT_CONDITIONAL`). `--docs` reads the record Step 14.5 saved (`{status, scope[, exception]}`): the receipt carries it as `docs`, and a `blocked` status without the owner's exception, or a body missing the exception line, is `DOCS_AUDIT_BLOCKED` with nothing written. -When the owner accepted a stop after a fix-check edit, add -`--review-loop-exception @` (`{accepted_by, date, via, reason, fix_check: {head, findings}}`) -and put its printed `Review-loop exception:` line in the body; never a prose line under `REVIEW_LOOP:`. +`--review-loop-exception` (an owner's acceptance of a stop after a fix-check edit) is deprecated with fix-check grants and goes +in the next release; write still takes one recorded before GST-3562. After the round cap, a blocker goes to the lane's Captain, +whose ruling is a ruled note (below); never a prose line under `REVIEW_LOOP:`. A finding the owner rules a disclosed note instead of a fix is closed only by the owner's `gstack-approvals rule`, recorded outside this run, never by this run or a review-log field (docs/ship-policy.md#ruled-notes); the receipt lists each one as `ruled_notes`. diff --git a/ship/sections/review-army.md b/ship/sections/review-army.md index 9c440837c..f852e53b1 100644 --- a/ship/sections/review-army.md +++ b/ship/sections/review-army.md @@ -18,15 +18,14 @@ Finish the complete review and QA before applying any fix in Step 9.4. **Review plan.** Pass 1 runs `~/.claude/skills/gstack/bin/gstack-review-plan --base `, plus `--depth-floor ` on every plan run when the /ship prompt gave `--depth-floor ` (it only raises), and Step 1's `PR_REVIEW_FLAGS:` on every plan run (the PR's -earlier rounds and a round grant; past two the plan is one read-only full review, and `PR_ROUND_CAP` stops for the lane, never the owner). -When they name `--round-grant `, run `gstack-ship-receipt claim --pr --run --grant ` before the first -dispatch (`GRANT_SPENT` stops the run). With `--stop ` too, the grant buys that stop's fix round: Step 9 is only decision -3.5's fix-check of the PR's own change since ``, for the grant's findings, Step 11.5 saves ``'s tree, and the receipt's -`review_loop_exception` names the grant. Add `--declare-risk ` when the diff touches a risk +earlier rounds; past two, a head whose code changed gets one read-only full review (`READ_ONLY:`, no fix round), and `PR_ROUND_CAP` +stops for the lane, never the owner). Round grants and fix-check grants are deprecated and go in the next release: ask for and +record none. When an older grant still puts `--round-grant ` there, run `gstack-ship-receipt claim --pr --run --grant ` +before the first dispatch (`GRANT_SPENT` stops the run), then follow the plan's `NEXT:`. Add `--declare-risk ` when the diff touches a risk class the plan's `REVIEW_DEPTH:` misses (spend it reserves or binds: `money`), and give Step 16's receipt write the same flag; a repeat uses the plan run that picked it. -A `scoped` repeat is a full pass on the range: its `fix-check` is decision 3.5's -reviewer and prompt with `git diff $RANGE_BASE` as the hunks, inside this pass. +A `scoped` repeat is a full pass on the range: its `fix-check` dispatch is one full-effort reviewer on the +`gstack-review-plan --fix-check-prompt` prompt with `git diff $RANGE_BASE` as the hunks, inside this pass, never a step of its own. Save its `REVIEW_PLAN:` line and fingerprint, `REVIEW_DEPTH:` (depth, `runtime_lines`, `rules`) and `GATE_SCAN:`. Dispatch exactly its `DISPATCH:` lines (specialists, Red Team, Step 11's voices), each at its `effort=` on the same model @@ -834,9 +833,10 @@ Decision 1 always applies first. Then, under `frozen`, run `gstack-review-plan - with each flag that holds (`--fixed-blocking`, `--fixed-below`, `--blocking-open`, `--touched-gate` for a fix to an item 2.5 path, `--critical-found` when this pass logged a CRITICAL, `--adversarial-ran` once Step 11's native pass ran, `--reviewed-numbers `, -`--depth-floor ` when given, `--fix-checks ` after a fix-check, `--grant ` once the owner's grant of one scoped fix-check is -in `gstack-approvals` naming `review_loop_grant` and the stop head), `--range-base $PASS_HEAD` and `--pass1-depth `; -its `NEXT:` alone picks the next decision: `stop` 2, `full` 3, `fix-check` 3.5, `done` 4, `platform` 4. `voices` 4: Step 11 runs before the stop. +`--depth-floor ` when given), `--range-base $PASS_HEAD` and `--pass1-depth `; +its `NEXT:` alone picks the next decision: `stop` 2, `full` 3, `done` 4, `platform` 4. `voices` 4: Step 11 runs before the stop. +Any code change after round 1 gets a full round 2; a fix in the last round gets the read-only final review (`READ_ONLY:`); +after it the PR ships with its open notes or the lane's Captain rules. `fix-check` (3.5) comes only from a grant recorded before GST-3562. `scoped` is 3 too. A full pass 1 always gets a full pass 2. Other scopes apply decisions 2–4 in order. @@ -853,7 +853,7 @@ Other scopes apply decisions 2–4 in order. past what the request needs (a helper, a guard, a case nothing takes), cut that growth before anything else; the repeat reviews the cut as part of the range. Tests must pass or retain approval for the same verified pre-existing failures and scope. Keep CYCLES and scoped approvals across this repeat; PASS increments on entry. -3.5. **One fix-check.** Take a `gstack-review-log --start review-fix-check` token (`--reservation ` under a cap); write the +3.5. **A fix-check from an older grant** (deprecated, removed next release; /ship plans none). Take a `gstack-review-log --start review-fix-check` token (`--reservation ` under a cap); write the fix list, touched hunks (`git diff $PASS_HEAD`), callers of changed symbols and test results to `.gstack/tmp/fix-check-*.txt`; dispatch one full-effort reviewer on `gstack-review-plan --fix-check-prompt --fix-list --hunks --tests diff --git a/ship/sections/review-army.md.tmpl b/ship/sections/review-army.md.tmpl index 9202611dc..3dc5a032b 100644 --- a/ship/sections/review-army.md.tmpl +++ b/ship/sections/review-army.md.tmpl @@ -16,15 +16,14 @@ Finish the complete review and QA before applying any fix in Step 9.4. **Review plan.** Pass 1 runs `~/.claude/skills/gstack/bin/gstack-review-plan --base `, plus `--depth-floor ` on every plan run when the /ship prompt gave `--depth-floor ` (it only raises), and Step 1's `PR_REVIEW_FLAGS:` on every plan run (the PR's -earlier rounds and a round grant; past two the plan is one read-only full review, and `PR_ROUND_CAP` stops for the lane, never the owner). -When they name `--round-grant `, run `gstack-ship-receipt claim --pr --run --grant ` before the first -dispatch (`GRANT_SPENT` stops the run). With `--stop ` too, the grant buys that stop's fix round: Step 9 is only decision -3.5's fix-check of the PR's own change since ``, for the grant's findings, Step 11.5 saves ``'s tree, and the receipt's -`review_loop_exception` names the grant. Add `--declare-risk ` when the diff touches a risk +earlier rounds; past two, a head whose code changed gets one read-only full review (`READ_ONLY:`, no fix round), and `PR_ROUND_CAP` +stops for the lane, never the owner). Round grants and fix-check grants are deprecated and go in the next release: ask for and +record none. When an older grant still puts `--round-grant ` there, run `gstack-ship-receipt claim --pr --run --grant ` +before the first dispatch (`GRANT_SPENT` stops the run), then follow the plan's `NEXT:`. Add `--declare-risk ` when the diff touches a risk class the plan's `REVIEW_DEPTH:` misses (spend it reserves or binds: `money`), and give Step 16's receipt write the same flag; a repeat uses the plan run that picked it. -A `scoped` repeat is a full pass on the range: its `fix-check` is decision 3.5's -reviewer and prompt with `git diff $RANGE_BASE` as the hunks, inside this pass. +A `scoped` repeat is a full pass on the range: its `fix-check` dispatch is one full-effort reviewer on the +`gstack-review-plan --fix-check-prompt` prompt with `git diff $RANGE_BASE` as the hunks, inside this pass, never a step of its own. Save its `REVIEW_PLAN:` line and fingerprint, `REVIEW_DEPTH:` (depth, `runtime_lines`, `rules`) and `GATE_SCAN:`. Dispatch exactly its `DISPATCH:` lines (specialists, Red Team, Step 11's voices), each at its `effort=` on the same model @@ -244,9 +243,10 @@ Decision 1 always applies first. Then, under `frozen`, run `gstack-review-plan - with each flag that holds (`--fixed-blocking`, `--fixed-below`, `--blocking-open`, `--touched-gate` for a fix to an item 2.5 path, `--critical-found` when this pass logged a CRITICAL, `--adversarial-ran` once Step 11's native pass ran, `--reviewed-numbers `, -`--depth-floor ` when given, `--fix-checks ` after a fix-check, `--grant ` once the owner's grant of one scoped fix-check is -in `gstack-approvals` naming `review_loop_grant` and the stop head), `--range-base $PASS_HEAD` and `--pass1-depth `; -its `NEXT:` alone picks the next decision: `stop` 2, `full` 3, `fix-check` 3.5, `done` 4, `platform` 4. `voices` 4: Step 11 runs before the stop. +`--depth-floor ` when given), `--range-base $PASS_HEAD` and `--pass1-depth `; +its `NEXT:` alone picks the next decision: `stop` 2, `full` 3, `done` 4, `platform` 4. `voices` 4: Step 11 runs before the stop. +Any code change after round 1 gets a full round 2; a fix in the last round gets the read-only final review (`READ_ONLY:`); +after it the PR ships with its open notes or the lane's Captain rules. `fix-check` (3.5) comes only from a grant recorded before GST-3562. `scoped` is 3 too. A full pass 1 always gets a full pass 2. Other scopes apply decisions 2–4 in order. @@ -263,7 +263,7 @@ Other scopes apply decisions 2–4 in order. past what the request needs (a helper, a guard, a case nothing takes), cut that growth before anything else; the repeat reviews the cut as part of the range. Tests must pass or retain approval for the same verified pre-existing failures and scope. Keep CYCLES and scoped approvals across this repeat; PASS increments on entry. -3.5. **One fix-check.** Take a `gstack-review-log --start review-fix-check` token (`--reservation ` under a cap); write the +3.5. **A fix-check from an older grant** (deprecated, removed next release; /ship plans none). Take a `gstack-review-log --start review-fix-check` token (`--reservation ` under a cap); write the fix list, touched hunks (`git diff $PASS_HEAD`), callers of changed symbols and test results to `.gstack/tmp/fix-check-*.txt`; dispatch one full-effort reviewer on `gstack-review-plan --fix-check-prompt --fix-list --hunks --tests diff --git a/test/fixtures/golden/agy-ship-SKILL.md b/test/fixtures/golden/agy-ship-SKILL.md index 937b43887..a175cdc93 100644 --- a/test/fixtures/golden/agy-ship-SKILL.md +++ b/test/fixtures/golden/agy-ship-SKILL.md @@ -212,9 +212,9 @@ compare two with `git diff `. **Review policy** (docs/review-policy.md): only a finding that would fail a test, break production, or lose data or secrets blocks a pass; the rest is a PR-body note. Step 9's plan sets both reviews' depth (`--depth-floor standard|full` only -raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds under `frozen` -(fix-checks included), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) -is the knob; the receipt's `review_loop` records the outcome. +raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds per PR under `frozen` +(then a read-only review if code changed), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) +is the knob. ### Ship control flow diff --git a/test/fixtures/golden/claude-ship-SKILL.md b/test/fixtures/golden/claude-ship-SKILL.md index e2b3c810f..7efc7cf1b 100644 --- a/test/fixtures/golden/claude-ship-SKILL.md +++ b/test/fixtures/golden/claude-ship-SKILL.md @@ -217,9 +217,9 @@ compare two with `git diff `. **Review policy** (docs/review-policy.md): only a finding that would fail a test, break production, or lose data or secrets blocks a pass; the rest is a PR-body note. Step 9's plan sets both reviews' depth (`--depth-floor standard|full` only -raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds under `frozen` -(fix-checks included), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) -is the knob; the receipt's `review_loop` records the outcome. +raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds per PR under `frozen` +(then a read-only review if code changed), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) +is the knob. ### Ship control flow diff --git a/test/fixtures/golden/codex-ship-SKILL.md b/test/fixtures/golden/codex-ship-SKILL.md index 02407b577..d520c7711 100644 --- a/test/fixtures/golden/codex-ship-SKILL.md +++ b/test/fixtures/golden/codex-ship-SKILL.md @@ -210,9 +210,9 @@ compare two with `git diff `. **Review policy** (docs/review-policy.md): only a finding that would fail a test, break production, or lose data or secrets blocks a pass; the rest is a PR-body note. Step 9's plan sets both reviews' depth (`--depth-floor standard|full` only -raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds under `frozen` -(fix-checks included), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) -is the knob; the receipt's `review_loop` records the outcome. +raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds per PR under `frozen` +(then a read-only review if code changed), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) +is the knob. ### Ship control flow diff --git a/test/fixtures/golden/factory-ship-SKILL.md b/test/fixtures/golden/factory-ship-SKILL.md index 1b3d4959b..29e4beb2b 100644 --- a/test/fixtures/golden/factory-ship-SKILL.md +++ b/test/fixtures/golden/factory-ship-SKILL.md @@ -212,9 +212,9 @@ compare two with `git diff `. **Review policy** (docs/review-policy.md): only a finding that would fail a test, break production, or lose data or secrets blocks a pass; the rest is a PR-body note. Step 9's plan sets both reviews' depth (`--depth-floor standard|full` only -raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds under `frozen` -(fix-checks included), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) -is the knob; the receipt's `review_loop` records the outcome. +raises it). Pass 1 reads the diff, later passes the range; the cap is two rounds per PR under `frozen` +(then a read-only review if code changed), else Step 9.4's third fix cycle. `NO FINDINGS` is complete. `ship: review_scope` (Step 3) +is the knob. ### Ship control flow diff --git a/test/fixtures/review-pins/files/lib/review-depth.ts.json b/test/fixtures/review-pins/files/lib/review-depth.ts.json index 80d06c27b..756dae4e6 100644 --- a/test/fixtures/review-pins/files/lib/review-depth.ts.json +++ b/test/fixtures/review-pins/files/lib/review-depth.ts.json @@ -1 +1 @@ -{"sha":"e616b939cb5ad8283d9590ba887e63ad54018ee08e4846c59d8ec7171af24860","replay":"GST-3562-A"} +{"sha":"e6f1395136db91c611ec576795c27fb1cc360eb0318ce3a01d585e383d96c665","replay":"GST-3562-part-2"} diff --git a/test/fixtures/review-pins/files/ship/sections/adversarial.md.json b/test/fixtures/review-pins/files/ship/sections/adversarial.md.json index b32d26100..c6bae4625 100644 --- a/test/fixtures/review-pins/files/ship/sections/adversarial.md.json +++ b/test/fixtures/review-pins/files/ship/sections/adversarial.md.json @@ -1 +1 @@ -{"sha":"3b77c0e5dbf5d9f91b24173b33f52a3897000150466ed5bdb0004c03ac046550","replay":"GSTA-812"} +{"sha":"63f0b646cbc3f3ea6dae42ee1072242f63105f9e579d52ac38f22a7ad5370c8c","replay":"GST-3562-part-2"} diff --git a/test/fixtures/review-pins/files/ship/sections/review-army.md.json b/test/fixtures/review-pins/files/ship/sections/review-army.md.json index 70f48f3ac..d462d6b12 100644 --- a/test/fixtures/review-pins/files/ship/sections/review-army.md.json +++ b/test/fixtures/review-pins/files/ship/sections/review-army.md.json @@ -1 +1 @@ -{"sha":"b62f72416cf46298004c399254b25ace4230dddf5528c3fe2685bdcc8b4b3fd3","replay":"GST-3562-A"} +{"sha":"fc0bcf40ab6b935550a3293fda04890a6f9ec9cbb63b5d901325b7d4233127c4","replay":"GST-3562-part-2"} diff --git a/test/fixtures/review-pins/replays/GST-3562-part-2.json b/test/fixtures/review-pins/replays/GST-3562-part-2.json new file mode 100644 index 000000000..9651ecb75 --- /dev/null +++ b/test/fixtures/review-pins/replays/GST-3562-part-2.json @@ -0,0 +1 @@ +{"replay": "GST-3562-part-2", "justification": "GST-3562 part 2 (prose; Garry 'Do it' 2026-11-23 to the /ship simplification cut list; Captain GStack Minder's CREW rule 15 ruling, approval a-6ec01c09edf8). Deterministic no-loss replay, no paid run. lib/review-depth.ts: the cross-run read-only final review (prCapped, a new /ship run on a PR whose two full rounds are spent) now carries the keepReader and readOnly flags the in-run read-only review already had. test/review-depth-lean.test.ts replays main's table frozen at 0408128 against this branch over its dispatch grid: the only new cases are kind f (15,936 of them), the same full step with the same reason now marked read-only, and every reader main dispatched is still dispatched (test/helpers/gst3562-replay.ts asserts it per case); no case drops a reader. ship/sections/review-army.md and ship/sections/adversarial.md: workflow prose only (fix-check and grant instructions marked deprecated, the round-2 and read-only final review rules stated); every reviewer brief cut from them renders byte-identical to its pinned body (brief-bodies pins unchanged)."} diff --git a/test/helpers/gst3562-replay.ts b/test/helpers/gst3562-replay.ts index 9f4f74191..c22610aa5 100644 --- a/test/helpers/gst3562-replay.ts +++ b/test/helpers/gst3562-replay.ts @@ -17,12 +17,14 @@ * the voices before one). * e. main stopped (or ran the voices before stopping) on a blocker fixed or a gate edit made at the cap; the branch gives the * final head one read-only full review. + * f. a new /ship run on a PR whose full rounds are spent: both plan the same read-only full review of the head, and the + * branch marks it read-only (no fix round, staged on the merge base) and keeps every reader main dispatched (GST-3562 part 2). */ import { expect } from 'bun:test'; import { planReviewAt, type PlanInput, type ReviewPlan } from '../../lib/review-depth'; import { mainNextStep } from '../fixtures/review-depth-main/next-step-0408128'; -export type Gst3562Kind = 'a' | 'b' | 'c' | 'd' | 'e'; +export type Gst3562Kind = 'a' | 'b' | 'c' | 'd' | 'e' | 'f'; export function asMainBeforeGst3562(input: PlanInput, plan: ReviewPlan): { plan: ReviewPlan; kind?: Gst3562Kind } { const main = planReviewAt(input, mainNextStep); @@ -35,9 +37,11 @@ export function asMainBeforeGst3562(input: PlanInput, plan: ReviewPlan): { plan: : was.step === 'fix-check' && (now.step === 'stop' || now.step === 'voices') && now.reason.includes('a fix followed the read-only final review') ? 'c' : was.step === 'done' && !!h.fixedBelow && ['full', 'stop', 'voices', 'fix-check'].includes(now.step) ? 'd' : (was.step === 'stop' || was.step === 'voices') && !!(h.fixedBlocking || h.touchedGate) && now.step === 'full' && now.reason.startsWith('read-only final review (R51)') ? 'e' + : h.last === 'none' && was.step === 'full' && !was.readOnly && now.readOnly && now.reason === was.reason && was.reason.startsWith('read-only final review (R51)') ? 'f' : undefined; expect([h, was, now, kind]).toEqual([h, was, now, expect.any(String)]); if (kind === 'b') expect({ ...plan, next: was }).toEqual(main); + if (kind === 'f') expect([h, main.dispatches.filter(d => !plan.dispatches.some(p => Bun.deepEquals(p, d)))]).toEqual([h, []]); if (kind === 'a') { const lost = main.dispatches.filter(d => d.role === 'fix-check' ? !plan.dispatches.some(p => p.role !== 'targeted' && p.effort === 'full' && p.exclude.every(e => d.exclude.includes(e))) diff --git a/test/pregate-dart.test.ts b/test/pregate-dart.test.ts index 6183da900..d2a7a3da8 100644 --- a/test/pregate-dart.test.ts +++ b/test/pregate-dart.test.ts @@ -38,7 +38,7 @@ const DART_FILES: Record = { }; /** A base policy with no declared runner, so Dart files are planned per package. */ -const DART_PREGATE = { $schema: 'https://github.com/garrytan/gstack/docs/pregate.md#pregate-v1', dependencies: { 'docs/**': [], 'README.md': [] } }; +const DART_PREGATE = { $schema: 'https://github.com/garrytan/gstack/blob/main/docs/pregate.md#pregate-v1', dependencies: { 'docs/**': [], 'README.md': [] } }; /** * The fixture plus DART_FILES on main. `policy` is committed as the base's diff --git a/test/pregate-starter.test.ts b/test/pregate-starter.test.ts index f21ec3b81..2199d1a3e 100644 --- a/test/pregate-starter.test.ts +++ b/test/pregate-starter.test.ts @@ -56,6 +56,8 @@ describe('no policy anywhere: warn plus a printed starter (never PREGATE_NO_LANE expect(row.fix).toContain('gstack-pregate init'); const starter = starterJson(r.out); expect(validateConfig(starter, CHECK_IDS)).toEqual([]); + expect(starter.$schema).toBe('https://github.com/garrytan/gstack/blob/main/docs/pregate.md#pregate-v1'); + expect(fs.readFileSync(path.join(import.meta.dir, '..', 'docs', 'pregate.md'), 'utf8')).toContain(''); expect(starter.runner).toBe('node --test {files}'); expect((starter.dependencies as Record)['scripts/report.js']).toEqual(['test/report.test.js']); expect(starter.dependencies).not.toHaveProperty('lib/orphan.js'); diff --git a/test/review-depth-lean.test.ts b/test/review-depth-lean.test.ts index 27a574794..35a9bb4b3 100644 --- a/test/review-depth-lean.test.ts +++ b/test/review-depth-lean.test.ts @@ -180,7 +180,7 @@ describe('GST-3562 A no-loss replay across panels, prior rounds, round grants, t const { kind } = asMainBeforeGst3562(input, planReview(input)); if (kind) kinds[`${name}:${kind}`] = (kinds[`${name}:${kind}`] ?? 0) + 1; } - expect(kinds).toEqual({ 'docs:a': 4134, 'docs:b': 6336, 'docs:c': 576, 'docs:d': 1086, 'docs:e': 576, 'tests:a': 4134, 'tests:b': 6336, 'tests:c': 576, 'tests:d': 1086, 'tests:e': 576, 'code:a': 3984, 'code:b': 6336, 'code:c': 576, 'code:d': 1056, 'code:e': 576, 'risk:a': 2664, 'risk:b': 6624, 'risk:c': 336, 'risk:d': 456, 'risk:e': 1152, 'mixed:a': 3984, 'mixed:b': 6336, 'mixed:c': 576, 'mixed:d': 1056, 'mixed:e': 576 }); + expect(kinds).toEqual({ 'docs:a': 4134, 'docs:b': 6336, 'docs:c': 576, 'docs:d': 1086, 'docs:e': 576, 'docs:f': 2784, 'tests:a': 4134, 'tests:b': 6336, 'tests:c': 576, 'tests:d': 1086, 'tests:e': 576, 'tests:f': 2784, 'code:a': 3984, 'code:b': 6336, 'code:c': 576, 'code:d': 1056, 'code:e': 576, 'code:f': 3456, 'risk:a': 2664, 'risk:b': 6624, 'risk:c': 336, 'risk:d': 456, 'risk:e': 1152, 'risk:f': 3456, 'mixed:a': 3984, 'mixed:b': 6336, 'mixed:c': 576, 'mixed:d': 1056, 'mixed:e': 576, 'mixed:f': 3456 }); }, 60_000); test('the three corners keep the one full-effort reader main\'s fix-check was', () => { const bot = { id: 'r1', head: HEAD, reviewer: 'capy-ai[bot]' }; diff --git a/test/review-depth.test.ts b/test/review-depth.test.ts index 0de7c1397..c122380f1 100644 --- a/test/review-depth.test.ts +++ b/test/review-depth.test.ts @@ -161,7 +161,9 @@ describe('GST-967: the round cap limits fix rounds, not the gate-class voices; a expect(table).toContain('| the stop after a fix-check (granted before GST-3562) that was the run\'s only one, with the owner\'s recorded grant (`--grant `) | one more scoped fix-check, after Step 11 on gate class, until a later release removes it; a grant after a round-2 full pass buys nothing, because the read-only full review replaces it |'); const rule3 = doc.slice(doc.indexOf('3. **Two rounds is the cap**'), doc.indexOf('')).replace(/\s+/g, ' '); expect(rule3).toContain("The cap limits fix rounds, not Step 11's voices"); - expect(rule3).toContain('`gstack-review-plan --grant --range-base `'); + expect(rule3).toContain('/ship plans no fix-check (GST-3562 A)'); + expect(rule3).toContain('Owner grants of a fix-check'); + expect(rule3).toContain('are deprecated'); }); }); diff --git a/test/review-pass.test.ts b/test/review-pass.test.ts index 87c5f8099..84f260249 100644 --- a/test/review-pass.test.ts +++ b/test/review-pass.test.ts @@ -323,6 +323,24 @@ describe('the read-only final review reads the whole PR diff (GST-3562 A)', () = expect(m.diff_base).toBe(mergeBase); expect(m.readers.every(r => (r.diff_base ?? m.diff_base) === mergeBase)).toBe(true); }, 120_000); + + // Value: protects=a new /ship run on a PR whose two full rounds are spent plans its pass 1 as the read-only final review, so the dispatcher + // ignores --diff-base and prints READ_ONLY there too; fails_when=prCapped's cross-run path drops the readOnly flag; + // why_new=#4741 round-2 note (prCapped's cross-run path, GST-3562 part 2); seam=none; no_claim=the edit guard's prose is followed + test('a new run on a PR past its round cap is read-only too, whatever --diff-base it is given', () => { + const { dir, env } = repo(); + const sh = (c: string) => { const r = spawnSync('bash', ['-c', c], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 }); if (r.status !== 0) throw new Error(r.stderr); return r.stdout.trim(); }; + const mergeBase = sh('git merge-base main HEAD'); + const oldHead = sh('git rev-parse HEAD'); + sh('echo "export const later = 1;" >> src/fix.ts && git add -A && git commit -qm "fix: change after the last round"'); + const out = path.join(dir, '.state/run/p1'); + const p = bin(dir, env, ['pass', '--base', 'main', '--out', out, '--pass', 'p1', '--diff-base', oldHead, '--', '--prior-rounds', '2', '--prior-full', '2']); + expect(p.status, p.stdout + p.stderr).toBe(0); + expect(p.stdout).toMatch(/^NEXT: full \(read-only final review \(R51\): this PR already had 2 full review rounds/m); + expect(p.stdout).toContain(`READ_ONLY: the final review reads the whole PR diff from the merge base (--diff-base ${oldHead} ignored); no fix round follows it`); + const m = JSON.parse(fs.readFileSync(path.join(out, 'pass-manifest.json'), 'utf8')) as Manifest; + expect(m.diff_base).toBe(mergeBase); + }, 120_000); }); describe('the fetch sweep quarantines a stage that fetched (GST-1322 PR B)', () => { diff --git a/test/review-plan-pr-rounds.test.ts b/test/review-plan-pr-rounds.test.ts index 5c17dbc4e..dc33d5172 100644 --- a/test/review-plan-pr-rounds.test.ts +++ b/test/review-plan-pr-rounds.test.ts @@ -50,6 +50,7 @@ describe('PR round cap', () => { const n = nextStep(h({ priorRounds: 4, priorFull: FULL_PASS_CAP, lean })); expect(n.step).toBe('full'); expect(n.reason).toStartWith('read-only final review (R51): this PR already had 2 full review rounds'); + expect([lean, n.readOnly, n.keepReader]).toEqual([lean, true, true]); } }); diff --git a/test/ship-control-flow.test.ts b/test/ship-control-flow.test.ts index ff954b9e3..a70063226 100644 --- a/test/ship-control-flow.test.ts +++ b/test/ship-control-flow.test.ts @@ -43,7 +43,8 @@ describe('ship source controller', () => { test('the review plan drives the repeat, the fix-check binds under its own skill, and Step 11.5 accepts a fix-check or a planned adversarial skip', () => { const decide = review.slice(review.indexOf('### Decide whether to repeat Step 9'), review.indexOf('**Required-probe parent gate:**')); for (const flag of ['--fixed-blocking', '--fixed-below', '--blocking-open', '--touched-gate', '--critical-found', '--adversarial-ran', '--reviewed-numbers ']) expect(decide).toContain(flag); - expect(decide).toContain('its `NEXT:` alone picks the next decision: `stop` 2, `full` 3, `fix-check` 3.5, `done` 4, `platform` 4.'); + expect(decide).toContain('its `NEXT:` alone picks the next decision: `stop` 2, `full` 3, `done` 4, `platform` 4.'); + expect(compact(decide)).toContain('`fix-check` (3.5) comes only from a grant recorded before GST-3562.'); expect(decide).toContain('`gstack-review-log --start review-fix-check` token'); expect(decide).toContain('`"skill":"review-fix-check"` with `--finish `'); expect(compact(read('ship/sections/adversarial.md.tmpl'))).toContain("Step 9's last full-pass plan governs this step"); diff --git a/test/ship-driver.test.ts b/test/ship-driver.test.ts index 05cdd6ac2..bf0ff3054 100644 --- a/test/ship-driver.test.ts +++ b/test/ship-driver.test.ts @@ -147,9 +147,9 @@ describe('one program per pass (GSTA-167 variant E)', () => { test('Phase 2 runs --audit and the reads in its program, and no phase reads TODOS.md or the full diff into the parent', () => { const p2 = phase('## 2. Preflight'); for (const s of ['gstack-ship-preflight --audit --base --out ', 'writes the diff once (`CONTEXT:`)', '(`TODOS:`)', 'READER: coverage= plan=', - 'only when its reader is `needed`', 'Never read TODOS.md or the full diff into the parent']) expect(p2).toContain(s); - expect(phase('## 4. Judgment')).toContain('on the todos and commits files'); - expect(phase('## 6. Notes and documentation')).toContain('edited from the todos file'); + 'Phase 3 runs neither reader', 'Never read TODOS.md or the full diff into the parent']) expect(p2).toContain(s); + expect(phase('## 4. Judgment')).toContain('Steps 8.1, 8.2 and 9.2.1 are skipped'); + expect(phase('## 6. Notes and documentation')).toContain('Step 14 is skipped'); }); }); @@ -191,10 +191,10 @@ describe('variant G: the call plan, observe budget, waits and audit readers (GST // Value: protects=the driver and the Capy skill give diffBase to a full repeat pass only, so a scoped pass reaches GST-619's bases: its pending Step 11 voices read the merge base, not the fix range; fails_when=either text passes RANGE_BASE to every repeat pass again; // why_new=#3670 merge fix-check (row 454): an explicit --diff-base wins in pass() (GST-619), so the driver's scoped diffBase narrowed the voices; seam=none; no_claim=the parent's adherence - test('a scoped repeat pass passes no diffBase, in the driver and the Capy skill', () => { + test('a scoped repeat pass and the read-only final review pass no diffBase, in the driver and the Capy skill', () => { const f = flat(doc); - const phase = f.slice(f.indexOf('`NEXT: stop` stops;'), f.indexOf('`fix-check`: the')); - expect(phase).toContain('(`diffBase` RANGE_BASE on `full` only; scoped fix-check: Step 3.5)'); + const phase = f.slice(f.indexOf('`NEXT: stop` stops;'), f.indexOf('`fix-check` (only')); + expect(phase).toContain('(`diffBase` RANGE_BASE on a `full` round 2 only, never on a scoped pass or the `READ_ONLY:` final review, which reads the whole PR and takes no fix)'); expect(phase).not.toMatch(/`diffBase`: RANGE_BASE;/); const capy = flat(read('capy/skill/gstack/SKILL.md')); expect(capy).toContain('a full repeat pass, `diffBase: ""`'); @@ -203,10 +203,10 @@ describe('variant G: the call plan, observe budget, waits and audit readers (GST // Value: protects=a program's return fits the host's output cap, a fix runs as one gated program, Step 7's test-writing audit settles before the pass reads the tree, and an unattended push never stops on the one-time pre-push offer; fails_when=Phase 2 returns review-army.md + adversarial.md + documentation.md (97,750 B) at once (replays 8G: truncated reads cost extra calls), a fix walks test, fix, tests and dispatch call by call (GSTA-189: 16 calls), Step 7 writes tests while specialists read (GSTA-164: a pregate refused mid-run), or push stops unattended (all three variant G replays); // why_new=GSTA-167 calls plan C5, C6, C7 and round-2 High 11; seam=none; no_claim=the parent's adherence, which the replays' CALLS: lines measure - test('returns stay at or under 32 KB, a fix is one gated program, Step 7 settles first, and unattended push defers the pre-push offer', () => { + test('returns stay at or under 32 KB, a fix is one gated program, and unattended push defers the pre-push offer', () => { const f = flat(doc); for (const s of ['Returns: ≤32 KB per program; split longer reads at headings, each byte once, before first use', - 'one program runs the failing test, fix, `--tests-only` and Phase 3, each gated', '(`diffBase` RANGE_BASE on `full` only; scoped fix-check: Step 3.5)', 'Step 7 may write tests, so it settles first', + 'one program runs the failing test, fix, `--tests-only` and Phase 3, each gated', '(`diffBase` RANGE_BASE on a `full` round 2 only, never on a scoped pass or the `READ_ONLY:` final review', 'Unattended, push defers the pre-push offer; else its STOP runs Step 17\'s guard block', 'plus a keep-alive per 200 s waited']) expect(f).toContain(s); expect(flat(doc.slice(doc.indexOf('**Budget: observe.**')))).toContain('--reading R --credits C --record '); }); @@ -222,8 +222,8 @@ describe('variant G: the call plan, observe budget, waits and audit readers (GST // Value: protects=audits that cannot block (Steps 7, 8, 14.5) run at low effort on AUDIT_MODEL (GST-1439, GST-1449) with their sections' own briefs, and skip their reader when --audit decides them; fails_when=an audit reader inherits the lane's model and effort (#36: the coverage audit alone was 2.45M at Opus), the Capy skill hard-codes a model for Steps 7 and 8 again, or an audit brief is paraphrased; // why_new=audit model routing is new; seam=none; no_claim=the audits' recall test('audit readers run on AUDIT_MODEL at low effort, named for Capy, and Phase 3 dispatches only what READER names', () => { - expect(flat(doc)).toContain('Audit readers (Steps 7, 8, 14.5) cannot block: low effort on `AUDIT_MODEL:`, 14.5 once; findings go to the PR body'); - expect(flat(doc)).toContain('`Coverage:` and Step 8\'s line come from `--audit` when no reader ran'); + expect(flat(doc)).toContain('Audit readers cannot block (here only 14.5 runs): low effort on `AUDIT_MODEL:`, 14.5 once; findings go to the PR body'); + expect(flat(doc)).toContain('`Coverage:` and Step 8\'s line come from `--audit`'); const capy = read('capy/skill/gstack/SKILL.md'); expect(capy).toContain('they cannot block, so omit `model`: the pass prints `AUDIT_MODEL:`.'); expect(capy).not.toContain('claude-sonnet-5-5'); @@ -233,19 +233,16 @@ describe('variant G: the call plan, observe budget, waits and audit readers (GST // their result line reaches the record, at no extra call; fails_when=the driver or the Capy skill sends Step 9.2.1 out as a QA reader // (C4-36, C5-36: it refused both passes, "parent-only", and QA coverage was empty), the probes leave the record, or they take their own call; // why_new=#3648 made Step 9.2.1 a reader (GST-450); seam=none; no_claim=the probes' recall - test('Step 9.2.1 is the parent\'s: Reads in Phase 3, probes in Phase 4\'s one program, Exploratory QA in the record, never an extra', () => { + test('Step 9.2.1 is the parent\'s in interactive /ship, never an extra, and the unattended driver skips it (GST-3562 L)', () => { const f = flat(doc); const phase = (n: number) => f.slice(f.indexOf(`## ${n}. `), f.indexOf(`## ${n + 1}. `)); expect(phase(3)).not.toMatch(/QA reader/); - expect(phase(3)).toContain("9.2.1's Reads only"); - expect(phase(4)).toContain("Step 8.1, 9.2.1's probes, 8.2 (`Scope Check:`)"); - const at = ['Step 8.1', "9.2.1's probes", '8.2 (`Scope Check:`)', 'Steps 9.3, 9.4 and the repeat decision'].map(s => phase(4).indexOf(s)); - expect(at[0]).toBeGreaterThanOrEqual(0); - expect(at).toEqual([...at].sort((a, b) => a - b)); + expect(phase(3)).toContain('on `plan=none` also Step 8\'s (`sections/plan-completion.md`) and 9.2.1 (L), else both run as written'); + expect(phase(4)).toContain('On `plan=none` Steps 8.1, 8.2 and 9.2.1 are skipped (L)'); expect(phase(4)).toContain('one program'); - expect(f).toContain('the plan checks, `Exploratory QA:`, `Scope Check:`), **Decisions**'); + expect(f).toContain('`Coverage:` and Step 8\'s `--audit` line), **Decisions**'); const capy = flat(read('capy/skill/gstack/SKILL.md')); - expect(capy).toContain('Steps 7, 8 and 14.5 (`step: "14.5"`) use `extras`'); + expect(capy).toContain('Step 14.5 (`step: "14.5"`) and, with a bound plan, Step 8 use `extras`'); expect(capy).not.toMatch(/9\.2\.1[^.]*`extras`/); expect(flat(read('ship/sections/review-army.md'))).toContain('### Step 9.2.1: Exploratory QA (before Fix-First) Only the parent runs report-only discovery.'); }); diff --git a/test/size-ledger/ship/ship-prose-matches-new-review-rules.json b/test/size-ledger/ship/ship-prose-matches-new-review-rules.json new file mode 100644 index 000000000..b0937b327 --- /dev/null +++ b/test/size-ledger/ship/ship-prose-matches-new-review-rules.json @@ -0,0 +1,4 @@ +{ + "bytes": 432, + "why": "GST-3562 part 2 review fixes: plan-bound unattended runs keep Step 8 and 9.2.1; the older-grant claim step stays until grants go" +}