From 7eba5caf6f5fce30810bc265ee077b3150c4af47 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Wed, 25 Nov 2026 11:21:05 -0500 Subject: [PATCH] /gstack-ship honours ruled edits after the final review and records second-model stops (GST-3814) (#4829) /gstack-ship no longer asks for every reviewer again after an edit the owner already ruled a note, and a stop on a second-model reviewer's blocker now records instead of failing with STOP_UNBOUND. Why: both forced hand-written workarounds after the final review (#4819, yc-software/qm#3973, gskills#45 and #46). Nothing to do: the fixes apply on the next /gstack-ship run. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=testing Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/red-team#2 reader=red-team Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#2 reader=outside-voice --- bin/gstack-review-plan | 35 +++++++--- bin/gstack-ship-receipt | 6 +- ...gstack-ship-ruled-edits-and-voice-stops.md | 1 + crew/docs/captain.md | 6 +- docs/review-policy.md | 6 +- docs/ship-policy.md | 8 +++ lib/capy-review-pass.js | 6 +- lib/no-stop.ts | 27 ++------ lib/result-codes-release.ts | 12 ++-- lib/review-depth.ts | 4 +- lib/ruled-notes.ts | 36 ++++++++++ lib/ship-preflight.ts | 2 +- lib/ship-release.ts | 25 +------ .../files/lib/review-depth.ts.json | 2 +- .../review-pins/replays/GSTA-861.json | 1 + test/no-stop.test.ts | 15 +++-- test/review-pass-program-steps.test.ts | 35 +++++----- test/review-pass-step11.test.ts | 3 +- test/review-plan-cli.test.ts | 67 ++++++++++++++++++- test/review-plan-pr-rounds.test.ts | 2 +- test/ship-finish-edit-ruling.test.ts | 2 +- test/ship-receipt-carry-mixed.test.ts | 2 +- test/ship-rereview-triggers.test.ts | 2 +- 23 files changed, 201 insertions(+), 104 deletions(-) create mode 100644 changelog.d/gstack-ship-ruled-edits-and-voice-stops.md create mode 100644 test/fixtures/review-pins/replays/GSTA-861.json diff --git a/bin/gstack-review-plan b/bin/gstack-review-plan index 6d41e64d2..112cb1b37 100755 --- a/bin/gstack-review-plan +++ b/bin/gstack-review-plan @@ -42,6 +42,7 @@ import { classList, targetedBriefSha, targetedClasses, targetedPatchId } from '. import { targetedDelta } from '../lib/review-targeted-delta'; import { ownChangeSince } from '../lib/ship-receipt-depth'; import { RISK_CLASSES, type RiskClass } from '../lib/review-risk'; +import { readRuledNotes, ruledEditLine, ruledEdits } from '../lib/ruled-notes'; const HELP = `gstack-review-plan — the review depth of the next /ship step (docs/review-policy.md#review-depth) @@ -186,7 +187,9 @@ function main(): number { const tiersSetting = runScriptSync(path.join(binDir, 'gstack-config'), ['get', 'review_effort_tiers'], { encoding: 'utf8', timeout: 15_000 }); const auditEffort = has('--no-tiers') || (tiersSetting.stdout ?? '').trim() === 'off' ? 'host' : 'light'; const { added, diffLines, paths, deleted, stampOnly, perPath, registry } = collected; - let fixRange: { base: string; runtime_lines: number | null; error?: string; touched_gate?: true } | undefined; + let fixRange: { base: string; runtime_lines: number | null; error?: string; touched_gate?: true; ruled?: string[] } | undefined; + let routed: ReturnType | null = null; + let ruledAll = false; let own: string | null = null; if (rangeBase) { const unread = (error: string) => ({ base: rangeBase, runtime_lines: null, error }); @@ -198,8 +201,14 @@ function main(): number { else { const commit = collectCommit(root, resolved, own); const range = classifyDiff({ ...commit, registry, scope: scopeOf([resolved, '--head', own]), gateTagged: gateTagsOf(['--commit', own]), ...riskPaths, ...(active ? { excluded: active.excluded } : {}) }); + const edits = readRuledNotes(root).filter(n => n.finding.startsWith('edit:')); + routed = edits.length && commit.paths.length && !range.errors.length ? ruledEdits(root, commit.paths, head, edits) : null; + const tagsBeyond = (ruled: ReadonlyMap) => { const g = runGateDiff(['--commit', own!, '--format', 'jsonl']); + return g.status !== 0 || (g.stdout ?? '').split('\n').slice(1).some(l => { try { const h = JSON.parse(l) as { path?: string; tags?: unknown[] }; return !!h.tags?.length && !ruled.has(h.path ?? ''); } catch { return false; } }); }; + ruledAll = !!routed && routed.ruled.size === commit.paths.length && !tagsBeyond(routed.ruled); fixRange = range.errors.length ? unread([...range.errors.slice(0, 5).map(e => `${e.code} ${e.input}`), ...(range.errors.length > 5 ? [`+${range.errors.length - 5} more`] : [])].join('; ')) : !commit.paths.length ? unread('the fix range is empty: commit the fix after the range base (a base merge alone is not the PR\'s own change)') + : ruledAll ? { base: rangeBase, runtime_lines: 0, ruled: [...routed!.ruled.keys()].sort() } : { base: rangeBase, runtime_lines: range.runtimeLines, ...(range.class === 'gate' ? { touched_gate: true as const } : {}) }; } } @@ -208,31 +217,35 @@ function main(): number { const brief = targetedBriefSha(); const ran = !['uncommitted', 'none'].includes(patch) && flag('--targeted-ran') === patch; const postReview = has('--post-review'); + const fixedPost = !ruledAll && postReview && pass > 0; const plan = planReview({ ...collected, ...exclusionInput, ...riskPaths, declared: declared as RiskClass[], shape: { panel: review.panel, readerModel: review.reader_model, platform: review.platform, head, platformReview: platform?.ok ? platform.review : null }, scope, gateTagged, targeted: { classes: targeted.classes, ran }, numbers: scanNumbers(kept(added)), force, gated: list('--gated'), floor, tiers: auditEffort !== 'host', criticalFound: has('--critical-found'), adversarialRan: has('--adversarial-ran'), reviewedNumbers: flag('--reviewed-numbers'), - history: { priorRounds, priorFull, fullPasses: pass, last, fixedBlocking: has('--fixed-blocking'), fixedBelow: has('--fixed-below') || (postReview && pass > 0), blockingOpen: has('--blocking-open'), touchedGate: has('--touched-gate') || !!fixRange?.touched_gate || (postReview && pass > 0), pass1Depth, rangeRuntimeLines: fixRange?.runtime_lines, postReview }, + history: { priorRounds, priorFull, fullPasses: pass, last, fixedBlocking: has('--fixed-blocking'), fixedBelow: !ruledAll && (has('--fixed-below') || fixedPost), blockingOpen: has('--blocking-open'), touchedGate: !ruledAll && (has('--touched-gate') || !!fixRange?.touched_gate || fixedPost), pass1Depth, rangeRuntimeLines: fixRange?.runtime_lines, postReview }, }); - if (postReview && pass > 0) plan.next.reason = `edits after the review bound (Step 16 stage 2.1) plan as a fix to a gate-class path, never a note: ${plan.next.reason}`; + if (ruledAll) plan.next.reason = `every edit since --range-base is ruled a note (RULED_EDIT), so the range plans as no fix (docs/ship-policy.md#ruled-edits): ${plan.next.reason}`; + if (fixedPost) plan.next.reason = `edits after the review bound (Step 16 stage 2.1) plan as a fix to a gate-class path, never a note: ${plan.next.reason}`; if (postReview && plan.next.step === 'stop') { const status = rangeBase ? git(['diff', '-z', '--name-status', '--no-renames', rangeBase, own ?? head])?.split('\0').filter(Boolean) : undefined; const pairs = status ? Array.from({ length: status.length >> 1 }, (_, i) => [status[2 * i]!, status[2 * i + 1]!] as const) : undefined; const edited = pairs?.filter(([s]) => s !== 'D').map(([, p]) => p), deleted = pairs?.filter(([s]) => s === 'D').map(([, p]) => p) ?? []; const spaced = edited?.filter(p => /\s/.test(p)) ?? []; - const rulable = edited?.filter(p => !spaced.includes(p)); + const rulable = edited?.filter(p => !spaced.includes(p) && !routed?.ruled.has(p)); const quote = (s: string) => `'${s.replace(/'/g, `'\\''`)}'`; const rule = (finding: string) => `gstack-approvals rule --finding ${finding} --head ${head} --reason '' --by '' --words '' --owner-ref :`; - plan.next.reason += `; if the owner rules instead that the edit ships as a disclosed note, record that ruling once per edited path (each path shell-quoted; the owner-ref is the relay this open /ship run needs): ${rulable?.length ? rulable.map(p => rule(quote(`edit:${p}`))).join(' && ') : rule("'edit:'")}, then rerun finish, which routes each ruled path at the ruled bytes as RULED_EDIT${spaced.length ? `; ${spaced.map(quote).join(', ')} cannot be ruled (a finding holds no whitespace), so an edit there keeps the fix and runs /ship again` : ''}${deleted.length ? `; a deletion (${deleted.map(quote).join(', ')}) cannot be ruled, so it keeps the fix and runs /ship again` : ''}`; + plan.next.reason += `; if the owner rules instead that the edit ships as a disclosed note, record that ruling once per edited path (each path shell-quoted; the owner-ref is the relay this open /gstack-ship run needs): ${rulable?.length ? rulable.map(p => rule(quote(`edit:${p}`))).join(' && ') : rule("'edit:'")}, then rerun finish, which routes each ruled path at the ruled bytes as RULED_EDIT${spaced.length ? `; ${spaced.map(quote).join(', ')} cannot be ruled (a finding holds no whitespace), so an edit there keeps the fix and runs /gstack-ship again` : ''}${deleted.length ? `; a deletion (${deleted.map(quote).join(', ')}) cannot be ruled, so it keeps the fix and runs /gstack-ship again` : ''}`; } const ranArg = flag('--targeted-ran'); const delta = plan.next.step !== 'done' || !targeted.classes.length || ran ? null : rangeBase && ranArg ? targetedDelta(root, ref, rangeBase, ranArg) : null; - if (delta?.state === 'dispatch') { - const why = `the only change since is docs whose claim the record cannot carry (${delta.paths.join(', ')})`; - plan.next = { step: 'targeted', reason: `the loop is done and ${why} after the targeted read at ${delta.range_base.slice(0, 12)}: one targeted reader reads HEAD for ${classList(targeted.classes)}; it is not a review round` }; + const ruledRead = ruledAll && plan.next.step === 'done' && targeted.classes.length > 0 && !ran && !(delta?.state === 'skip' && delta.carried); + if (delta?.state === 'dispatch' || ruledRead) { + const why = delta?.state === 'dispatch' ? `the only change since is docs whose claim the record cannot carry (${delta.paths.join(', ')}) after the targeted read at ${delta.range_base.slice(0, 12)}` + : 'every edit since --range-base is ruled a note, but no targeted record covers the ruled bytes'; + plan.next = { step: 'targeted', reason: `the loop is done and ${why}: one targeted reader reads HEAD for ${classList(targeted.classes)}; it is not a review round` }; plan.dispatches.push({ role: 'targeted', name: 'targeted', effort: ROLE_EFFORT.targeted, exclude: active ? [...active.specs] : [], classes: [...targeted.classes], ...(active?.keep.length ? { keep: [...active.keep] } : {}) }); } else if (delta) plan.skipped.push(`targeted-only read (${delta.reason})`); - if (last === 'full' && plan.next.step === 'done' && fixRange && fixRange.runtime_lines !== null && !ran && !(delta?.state === 'skip' && delta.carried) && !postReview && !['--fixed-blocking', '--fixed-below', '--blocking-open', '--touched-gate'].some(has)) { + if (last === 'full' && plan.next.step === 'done' && fixRange && !ruledAll && fixRange.runtime_lines !== null && !ran && !(delta?.state === 'skip' && delta.carried) && !postReview && !['--fixed-blocking', '--fixed-below', '--blocking-open', '--touched-gate'].some(has)) { process.stderr.write(`${gateOutcomeLine('gstack-review-plan', 'review_required_no_readers', `--pass ${pass} --last ${last} names no fix, but the PR's own change since --range-base ${fixRange.base.slice(0, 12)} has ${fixRange.runtime_lines} runtime line${fixRange.runtime_lines === 1 ? '' : 's'}`)} (review_required_no_readers)\n`); return EXIT.refused; } @@ -253,7 +266,9 @@ function main(): number { out.push(`REVIEW_MODE: ${plan.mode} panel=${review.panel} reader_model=${review.reader_model} platform=${review.platform}`); if (declared.length) out.push(`RISK_DECLARED: classes=${plan.declared.join(',')} detected=${plan.detected.join(',') || 'none'}`); if (platform) out.push(platform.ok ? `PLATFORM_REVIEW: ${platform.review.id} reviewer=${platform.review.reviewer} head=${platform.review.head}` : `PLATFORM_REVIEW: none (${platform.reason})`); - if (fixRange) out.push(`FIX_RANGE: ${fixRange.runtime_lines === null ? `unread (${fixRange.error})` : `runtime_lines=${fixRange.runtime_lines}`} base=${fixRange.base}`); + if (fixRange) out.push(`FIX_RANGE: ${fixRange.runtime_lines === null ? `unread (${fixRange.error})` : `runtime_lines=${fixRange.runtime_lines}`} base=${fixRange.base}${fixRange.ruled ? ` ruled=${fixRange.ruled.length}` : ''}`); + for (const [p, n] of routed?.ruled ?? []) out.push(ruledEditLine(p, n)); + for (const x of routed?.refused ?? []) out.push(`RULED_EDIT_REFUSED: ${x}`); if (targetedDeltaOut) out.push(`TARGETED_DELTA: range_base=${targetedDeltaOut.range_base} paths=${targetedDeltaOut.paths.join(',')} classes=${classList(targetedDeltaOut.classes)}`); out.push(reviewPlanLine(plan, pass + (plan.next.step === 'full' || plan.next.step === 'scoped' ? 1 : 0), priorRounds), `NEXT: ${plan.next.step} (${plan.next.reason})`); for (const e of plan.errors) out.push(`DEPTH_ERROR: ${e.code} input=${e.input} detail=${e.detail}; fix: ${e.repair}${e.result ? ` (${e.result})` : ''}`); diff --git a/bin/gstack-ship-receipt b/bin/gstack-ship-receipt index 2e5fe77f1..25ae7159c 100755 --- a/bin/gstack-ship-receipt +++ b/bin/gstack-ship-receipt @@ -158,7 +158,7 @@ write flags: --pr --head --base --version --gated-tree --predecessor --gate (a JSON array of {class, reason, evidence}: each routine stop the run recorded and went on past, class one of - scoped-fix-check, test-timeout-fix, pregate-flake-rerun, autoplan-regate); recorded as no_stop. + test-timeout-fix, pregate-flake-rerun, autoplan-regate; gstack-no-stop refuses the retired scoped-fix-check); recorded as no_stop. --declare-risk (the same list gstack-review-plan --declare-risk took): joins review_depth's risk and only raises its depth; review_depth.declared and .detected record both lists (GST-1129). An unknown class is RECEIPT_INVALID. --platform-review (NEXT: platform's PLATFORM_REVIEW: id): records review_depth platform with capy-ai[bot]'s review at HEAD; @@ -777,7 +777,7 @@ function cmdCarry(rest: string[], json: boolean): number { if (packetBody && !changedProduct.length) { const record = flag(rest, '--scoped-review'); if (!record && rest.includes('--dry-run')) { - scopedDryRun = `the base merge spliced lines into the reviewed hunks in ${contextPaths.join(', ')}: carry without --dry-run writes the scoped-review packet for one fix-check reviewer, then carry --scoped-review ; nothing written`; + scopedDryRun = `the base merge spliced lines into the reviewed hunks in ${contextPaths.join(', ')}: carry without --dry-run writes the scoped-review packet for one scoped reader (not a review round), then carry --scoped-review ; nothing written`; scopedReview = `spliced hunks (scoped review pending: ${contextPaths.join(', ')})`; } else if (!record) { const gitPath = git(['rev-parse', '--git-path', `gstack/scoped-review-${head.slice(0, 12)}.md`], repoRoot); @@ -788,7 +788,7 @@ function cmdCarry(rest: string[], json: boolean): number { } catch (e) { return refused('RECEIPT_CARRY_REFUSED', `the base merge spliced lines into the reviewed hunks in ${contextPaths.join(', ')}, but the scoped-review packet ${packet} cannot be written (${(e as Error).message.split('\n')[0]}); make its directory writable, then rerun carry`); } - return refused('RECEIPT_CARRY_SCOPED_REVIEW', `the base merge spliced lines into the reviewed hunks in ${contextPaths.join(', ')}: one fix-check reviewer reads ${packet}, then rerun carry with --scoped-review ({"head":"${head}","paths":[…],"reviewer":"","verdict":"clean"}); a blocking finding means /gstack-ship on ${head.slice(0, 12)}`); + return refused('RECEIPT_CARRY_SCOPED_REVIEW', `the base merge spliced lines into the reviewed hunks in ${contextPaths.join(', ')}: one scoped reader (not a review round) reads ${packet}, then rerun carry with --scoped-review ({"head":"${head}","paths":[…],"reviewer":"","verdict":"clean"}); a blocking finding means /gstack-ship on ${head.slice(0, 12)}`); } if (record) { const review = readScopedReview(record, { head }, contextPaths); diff --git a/changelog.d/gstack-ship-ruled-edits-and-voice-stops.md b/changelog.d/gstack-ship-ruled-edits-and-voice-stops.md new file mode 100644 index 000000000..bc3f73d80 --- /dev/null +++ b/changelog.d/gstack-ship-ruled-edits-and-voice-stops.md @@ -0,0 +1 @@ +- **/gstack-ship honours a ruled edit after the final review, and a stop on a second-model blocker records.** `gstack-review-plan --range-base` now reads `edit:` rulings the way finish does, so an edit the owner ruled a note plans as no fix (`RULED_EDIT:`, `NEXT: done`) instead of asking for every voice again (GST-3814). Step 11's pass program starts one review-log token per voice row it logs, so the second-model reader's row binds to its tree and `gstack-ship-receipt stop` no longer refuses with `STOP_UNBOUND` when that reader is the one that blocks. `gstack-no-stop` and `checkNoStop` both refuse the retired `scoped-fix-check`, and the remaining recovery messages name `/gstack-ship` and the scoped reader. diff --git a/crew/docs/captain.md b/crew/docs/captain.md index de6459fbe..b1c78f23f 100644 --- a/crew/docs/captain.md +++ b/crew/docs/captain.md @@ -125,8 +125,8 @@ Where each rule lives: | 19 | CHANGELOG-only conflicts are the train's to resolve, not the lane's | folded into 14: [ship-policy.md](../../docs/ship-policy.md#ship-before-ready) ("the stamp keeps the pin's receipt") | | 20 | A READY from before a contract change needs a fresh receipt | [The READY contract](#the-ready-contract) | | 21 | Approvals, plan asks and merge asks in the three shapes | [Approvals](#approvals-three-shapes); [capy/skill/gstack/captain.md](../../capy/skill/gstack/captain.md) | -| 22 | /gstack-ship before every READY; the block carries `SHIP_RECEIPT`; stamp commits hold only tool output | [ship-policy.md](../../docs/ship-policy.md#ship-before-ready); [the lane's /gstack-ship sequence](#the-lanes-ship-sequence-before-ready) | -| 23 | Review loops converge: scope frozen after pass 1, later passes on the delta, a pass cap, a blocking floor | the `/gstack-ship` and `/review` skills' own convergence policy ([skills.md](../../docs/skills.md#ship)); a crew names it in one line and sets only the scope knob (`REVIEW_SCOPE`) | +| 22 | /gstack-ship before every READY; the block carries `SHIP_RECEIPT`; stamp commits hold only tool output | [ship-policy.md](../../docs/ship-policy.md#ship-before-ready); [the lane's /gstack-ship sequence](#the-lanes-gstack-ship-sequence-before-ready) | +| 23 | Review loops converge: scope frozen after pass 1, later passes on the delta, a pass cap, a blocking floor | the `/gstack-ship` and `/review` skills' own convergence policy ([skills.md](../../docs/skills.md#gstack-ship)); a crew names it in one line and sets only the scope knob (`REVIEW_SCOPE`) | | 24 | Plan before build: a sized `/autoplan` is a building lane's first act; the plan ask goes up, the build starts after the owner's word is in the run and it reports `APPROVED` | [Plan before build](#plan-before-build); the [brief template](../../captain/templates/brief.md) | ## Lane discipline @@ -206,7 +206,7 @@ cheap: longer sleeps on its operations alone. For short lane waits this overrides "waits go on operations, never on polling wakes" ([unattended.md](../../docs/unattended.md#report-length)). The controller never warm-waits, and a lane running /gstack-ship follows the waits in `ship/DRIVER.md` - ([the lane's /gstack-ship sequence](#the-lanes-ship-sequence-before-ready)). + ([the lane's /gstack-ship sequence](#the-lanes-gstack-ship-sequence-before-ready)). - **Batched reads.** Independent reads (files, greps, pull request and thread state) go in one parallel program, not one call each. Each call returns 4k characters or less; long output (logs, test output, diffs) goes to a file under `~/.capy/work`, and the lane reads diff --git a/docs/review-policy.md b/docs/review-policy.md index f60a4be83..a122bd0df 100644 --- a/docs/review-policy.md +++ b/docs/review-policy.md @@ -115,7 +115,7 @@ incomplete coverage, which blocks until the reviewer is rerun. 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 + needs the read. 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. @@ -279,7 +279,7 @@ applies no edits is its exit too. ### No-stop defaults (K1) -Four routine stops don't wait for a Captain. /gstack-ship and /autoplan record each one +Three routine stops don't wait for a Captain (the retired `scoped-fix-check` row below is refused). /gstack-ship and /autoplan record each one as `{class, reason, evidence}` in the receipt's `no_stop` field and keep going. `gstack-no-stop record` (`lib/no-stop.ts`) checks each case before it records it. When a case doesn't qualify, it prints `NO_STOP: refused` and exits 3, and that @@ -819,7 +819,7 @@ puts in the receipt: | `review_loop.passes` | full review passes this ship ran (1 or 2; up to 3 under `review_scope: diff-plus-blocking` or `all`) | | `review_loop.blocking_found` | every blocker found (GST-951): the rows' blocking findings (classified, or an unclassified CRITICAL), plus each ledger CRITICAL (as collected or judged) that no row finding from the same reviewer at the same path:line accounts for (each row finding pairs with one per ledger), so an adversarial, outside-voice or not-yet-classified blocker counts and one whose newest classification is below the floor does not. An unreadable ledger, merged file or judged set, or a judged set changed since `judge`, is `REVIEW_SCOPE_LEDGER`, never a count | | `review_loop.unrecorded` | blockers found that no row gives a disposition (fixed, deferred, noted, skipped, a gate answer); absent when 0 | -| `review_loop.open` | blockers a row still holds as `open` at its newest action, gate findings aside (GST-3075), each its ledger id or fingerprint (or `{ id, fingerprint }`); Step 11's `adversarial-review` row counts here like a pass's row but is never a pass or a round. Only a later row's action clears one, or a [granted fix-check or a trailer-carrying fix](#what-closes-a-finding) (`cleared_by_grant`, `cleared_by_trailer`), and while any is left with no owner ruling, `gstack-ship-receipt write` refuses with [`RECEIPT_BLOCKER_OPEN`](troubleshooting.md#receipt-blocker-open); absent when 0 | +| `review_loop.open` | blockers a row still holds as `open` at its newest action, gate findings aside (GST-3075), each its ledger id or fingerprint (or `{ id, fingerprint }`); Step 11's `adversarial-review` row counts here like a pass's row but is never a pass or a round. Only a later row's action clears one, or a [trailer-carrying fix](#what-closes-a-finding) (`cleared_by_trailer`; a receipt written before fix-check grants were removed may still hold `cleared_by_grant`), and while any is left with no owner ruling, `gstack-ship-receipt write` refuses with [`RECEIPT_BLOCKER_OPEN`](troubleshooting.md#receipt-blocker-open); absent when 0 | | `review_loop.unbound` | what could not bind (GST-1168), each printed as `REVIEW_SCOPE_UNBOUND: : `: a row with no start token and no readable time, a `pN` ledger with no review row of pass N (a fix-check ledger in a `pN` directory is not a pass ledger, GST-1775), a row finding's `ledger_id` no ledger collected, a `Review-Finding` trailer naming nothing; absent when 0 | | `review_loop.ledgers_read` | dispatch ledgers the count read; absent under `--no-ledger` | | `REVIEW_SCOPE_VOIDED:` (stderr, not a receipt field) | an abandoned pass (GBEV-3): a `pN` ledger never judged that no row names, replaced by a later `pM` ledger (M > N) that was judged or is named. Its findings are left out of every count above instead of counting as unbound and unrecorded. A fix-check ledger and the last pass are never voided | diff --git a/docs/ship-policy.md b/docs/ship-policy.md index b2a84db46..196519c5a 100644 --- a/docs/ship-policy.md +++ b/docs/ship-policy.md @@ -1934,6 +1934,14 @@ ruled note, so it prints as `RULED_NOTE:`, marked `(no RULED_EDIT at this head; applied)` when it cleared no path, the receipt records it and the PR body lists its `Ruled note:` line. +`gstack-review-plan --range-base` reads the same rulings the same way (GST-3814): +it prints `RULED_EDIT:` for each cleared path and `RULED_EDIT_REFUSED:` for each +that did not clear, and when every path the fix range changed is cleared and the +gate scan tags no other path in it, `FIX_RANGE:` reports `runtime_lines=0 ruled=` +and the range plans as no fix instead of asking for every voice again. A PR with +targeted classes still gets one targeted reader on HEAD when no targeted record +covers the ruled bytes; that read is not a review round. + **Security findings stay private (GST-3076).** A PR body keeps every earlier version in its edit history, and a ruled, dispositioned, deferred or noted diff --git a/lib/capy-review-pass.js b/lib/capy-review-pass.js index af2d6a040..afa72b072 100644 --- a/lib/capy-review-pass.js +++ b/lib/capy-review-pass.js @@ -40,7 +40,7 @@ const finish = (tail) => { const stop = (why) => finish(['STOP: ' + why]); const logStart = input.stage === 'voices' ? (input.logStart ?? ['adversarial-review']) : (input.logStart || []); if (!Array.isArray(logStart) || !logStart.every((s) => typeof s === 'string' && s.trim())) return stop('input.logStart must be a list of review-log start skills (strings), got ' + JSON.stringify(input.logStart) + '; nothing ran'); -if (input.stage === 'voices' && !(logStart.length && logStart.every((s) => s.split(' ')[0] === 'adversarial-review'))) return stop('Step 11 (stage "voices") takes the adversarial-review start token, which Step 11.5 binds, so its logStart is ["adversarial-review"] (with any --reservation in input.reservation) or omitted, never ' + JSON.stringify(input.logStart) + '; nothing ran'); +if (input.stage === 'voices' && !(logStart.length && logStart.every((s) => s.split(' ')[0] === 'adversarial-review'))) return stop('Step 11 (stage "voices") takes the adversarial-review start token, which Step 11.5 binds, so its logStart is omitted (one adversarial-review start per voice row it logs: the native adversarial and the second-model reader each log their own row) or lists only adversarial-review (with any --reservation in input.reservation), never ' + JSON.stringify(input.logStart) + '; nothing ran'); const runDir = input.out.replace(/\/+$/, '').replace(/\/[^/]+$/, ''); const nextPhase = input.stage === 'voices' ? 5 : input.step === '14.5' ? 7 : 4; const withParts = async (tail) => { @@ -196,7 +196,9 @@ try { if (heldBase !== 'none' && startTop !== want) return stop('readers on the shared machine start in ' + startTop + ', not in ' + want + ', the checkout this pass ships, and ' + startTop + ' also holds its diff base ' + heldBase + '; a reader that ran a brief command without its cd would review that checkout\'s diff with no error, so no start token was taken and no reader was dispatched. Start /ship in the shipped checkout: run it from a thread whose working directory is ' + want + ', or one whose working directory holds no checkout of this history'); if (reach.exit_code !== 0 || got !== want) return stop('readers on the shared machine cannot reach ' + want + ', the checkout this pass ships: ' + got.slice(-300) + '; no start token was taken and no reader was dispatched. Each brief tells its reader to cd there before anything else, so that path must be readable from the directory readers start in'); } - const starts = input.stage !== 'voices' && m.next === 'fix-check' ? logStart.map((s) => (s.split(' ')[0] === 'review' ? 'review-fix-check' + s.slice(6) : s)) : logStart; + const starts = input.stage !== 'voices' && m.next === 'fix-check' ? logStart.map((s) => (s.split(' ')[0] === 'review' ? 'review-fix-check' + s.slice(6) : s)) : [...logStart]; + const voiceRows = input.stage === 'voices' ? m.readers.filter((r) => r.stage === 'voices' && !r.retry_of && (r.role === 'adversarial-native' || r.role === 'outside-voice')).length : 0; + while (starts.length < voiceRows) starts.push(starts[0]); const seen = {}; for (const s of starts) { const nth = (seen[s] = (seen[s] || 0) + 1); diff --git a/lib/no-stop.ts b/lib/no-stop.ts index 3b6d55e5b..61e30ac6b 100644 --- a/lib/no-stop.ts +++ b/lib/no-stop.ts @@ -4,8 +4,8 @@ * Each class has one deterministic test here; anything that fails it, and any stop outside the four, * still stops for the owner. * - * - scoped-fix-check: one scoped fix-check past R51's two-round cap when the round-2 fix is docs-only - * (docs class, lib/review-depth.ts classifyPath) or timeout-only. One per branch. + * - scoped-fix-check: removed with fix-check grants (GST-3562 part 4); refused, so a stop after round 2 goes to the lane's + * Captain. The class stays in NO_STOP_CLASSES so receipts written before still validate. * - test-timeout-fix: a fix whose every changed line, all in test files, only raises a timeout value. * - pregate-flake-rerun: one rerun of a failed pregate case at the same tree (CREW rule 16). One per branch. * - autoplan-regate: a later autoplan gate revision whose plan-file edit only adds ELI5 lines that name no @@ -19,7 +19,6 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import { branchKey } from './approval-record'; import { NO_STOP_CLASSES, type NoStopClass } from './headless-artifacts'; -import { classifyPath } from './review-depth'; export interface NoStopRecord { class: NoStopClass; reason: string; evidence: string } export type NoStopVerdict = { ok: true; record: NoStopRecord; detail: string } | { ok: false; reason: string }; @@ -82,13 +81,6 @@ export function notTimeoutOnly(files: FileDiff[]): string | null { return null; } -/** Why the paths are not docs-only, or null: each is docs class as /ship's review classifies it (agent-read and skill prose is not). */ -export function notDocsOnly(paths: string[], root: string): string | null { - if (!paths.length) return 'the fix changes nothing'; - const code = paths.filter(p => classifyPath(p, root) !== 'docs'); - return code.length ? `not docs: ${code.slice(0, 3).join(', ')}` : null; -} - const HEADING = /^#{1,6}\s+(.*)$/; const ELI5 = /^eli5\b/i; @@ -123,20 +115,15 @@ export function checkNoStop(i: NoStopInput): NoStopVerdict { const cls = i.cls as NoStopClass; if (!i.reason.trim() || !i.evidence.trim()) return { ok: false, reason: 'a no-stop record needs a reason and evidence that resolves (run id, commit or file)' }; const record = { class: cls, reason: i.reason.trim(), evidence: i.evidence.trim() }; - if ((cls === 'scoped-fix-check' || cls === 'pregate-flake-rerun') && i.prior.some(r => r.class === cls)) return { ok: false, reason: `one ${cls} per branch is recorded already; a second goes to the owner` }; + if (cls === 'scoped-fix-check') return { ok: false, reason: "scoped-fix-check was removed with fix-check grants (GST-3562 part 4): a stop after round 2 goes to the lane's Captain, who ships it with notes or parks it" }; + if (cls === 'pregate-flake-rerun' && i.prior.some(r => r.class === cls)) return { ok: false, reason: `one ${cls} per branch is recorded already; a second goes to the owner` }; if (cls === 'pregate-flake-rerun') return { ok: true, record, detail: 'one rerun at the same tree (rule 16): green is flaky, red again is real' }; if (cls === 'autoplan-regate') return { ok: false, reason: 'gstack-autoplan decides re-gates at the gate (lib/autoplan-carry.ts), never by hand' }; const files = parseDiff(i.diff ?? ''); - const where = files.map(f => f.path).join(', '); + const outside = files.filter(f => !TEST_PATH.test(f.path)).map(f => f.path); + if (outside.length) return { ok: false, reason: `not a test file: ${outside.slice(0, 3).join(', ')}` }; const timeout = notTimeoutOnly(files); - if (cls === 'test-timeout-fix') { - const outside = files.filter(f => !TEST_PATH.test(f.path)).map(f => f.path); - if (outside.length) return { ok: false, reason: `not a test file: ${outside.slice(0, 3).join(', ')}` }; - return timeout ? { ok: false, reason: timeout } : { ok: true, record, detail: `timeout raised in ${where}` }; - } - if (!timeout) return { ok: true, record, detail: `timeout-only fix in ${where}` }; - const docs = notDocsOnly(files.map(f => f.path), i.root ?? process.cwd()); - return docs ? { ok: false, reason: `the fix is neither docs-only (${docs}) nor timeout-only (${timeout})` } : { ok: true, record, detail: `docs-only fix in ${where}` }; + return timeout ? { ok: false, reason: timeout } : { ok: true, record, detail: `timeout raised in ${files.map(f => f.path).join(', ')}` }; } /** The branch's ledger under the checkout's git dir, or null outside a git checkout. */ diff --git a/lib/result-codes-release.ts b/lib/result-codes-release.ts index a3cf92f36..17d6d038a 100644 --- a/lib/result-codes-release.ts +++ b/lib/result-codes-release.ts @@ -190,7 +190,7 @@ export const RELEASE_RESULT_CODES = { SHIP_BASE_RED_FIXER: { anchor: 'ship-base-red-fixer', summary: 'ready --base-red names no fixer PR, or the receipt\'s base-red condition no longer matches the base: a conditional READY needs an owner for its condition and a current classification', - fix: 'pass --fixer naming the open PR whose merge fixes the cases; when the base moved, rerun gstack-base-red classify (and /ship) first', + fix: 'pass --fixer naming the open PR whose merge fixes the cases; when the base moved, rerun gstack-base-red classify (and /gstack-ship) first', }, QUEUE_TRAIN_FROZEN: { anchor: 'queue-train-frozen', @@ -443,12 +443,12 @@ export const RELEASE_RESULT_CODES = { RECEIPT_CARRY_PRODUCT_CHANGED: { anchor: 'receipt-carry-product-changed', summary: 'the product diff against the base changed between the receipt\'s head and HEAD (a product file differs beyond a base merge, a test-only fix, release metadata or a regenerated output), so the reviewed verdict does not cover HEAD', - fix: 'run /gstack-ship on the new head; the receipt carries only when every changed path is a test, release metadata, a registered output the pregate regen check proved, or the base merge, and the product patch-id is unchanged; base context next to unchanged reviewed hunks carries as the base merge, and a hunk the base merge spliced is RECEIPT_CARRY_SCOPED_REVIEW instead (one scoped reader, no /ship)', + fix: 'run /gstack-ship on the new head; the receipt carries only when every changed path is a test, release metadata, a registered output the pregate regen check proved, or the base merge, and the product patch-id is unchanged; base context next to unchanged reviewed hunks carries as the base merge, and a hunk the base merge spliced is RECEIPT_CARRY_SCOPED_REVIEW instead (one scoped reader, no /gstack-ship)', }, STOP_UNBOUND: { anchor: 'stop-unbound', summary: 'gstack-ship-receipt stop found no review of this run bound to one committed tree, so it recorded no stop record', - fix: 'the lane or its Captain ships with the open notes listed or parks; a fresh /ship run gives the head its review', + fix: 'the lane or its Captain ships with the open notes listed or parks; a fresh /gstack-ship run gives the head its review', }, GRANT_SPENT: { anchor: 'grant-spent', @@ -463,7 +463,7 @@ export const RELEASE_RESULT_CODES = { SHIP_RUN_RECORD_UNREADABLE: { anchor: 'ship-run-record-unreadable', summary: 'this checkout\'s /ship run record (git dir gstack-ship-run) is neither a run record nor a run id, so every guard reads it as an open run', - fix: 'if no /ship run is working on this checkout, end it with the gstack-ship-run abandon --run unknown --sha256 command status prints, once', + fix: 'if no /gstack-ship run is working on this checkout, end it with the gstack-ship-run abandon --run unknown --sha256 command status prints, once', }, GRANT_UNKNOWN: { anchor: 'grant-unknown', @@ -473,7 +473,7 @@ export const RELEASE_RESULT_CODES = { RECEIPT_CARRY_SCOPED_REVIEW: { anchor: 'receipt-carry-scoped-review', summary: 'the base replaced the very lines one of the branch\'s hunks replaces and the merge kept both (GST-2975), so the branch\'s own lines are not the reviewed bytes; the receipt carries only after a scoped review of those hunks', - fix: 'dispatch one fix-check reviewer on the packet the refusal names, write its clean verdict as { head, paths, reviewer, verdict } and rerun carry with --scoped-review ; a blocking finding means /gstack-ship on the new head', + fix: 'dispatch one scoped reader (not a review round) on the packet the refusal names, write its clean verdict as { head, paths, reviewer, verdict } and rerun carry with --scoped-review ; a blocking finding means /gstack-ship on the new head', }, RECEIPT_DOCS_AUDIT_READ: { anchor: 'receipt-docs-audit-read', @@ -540,7 +540,7 @@ export const RELEASE_RESULT_CODES = { QUEUE_LAND_DRIFT: { anchor: 'queue-land-drift', summary: 'the base branch moved between the merge step\'s last check and the squash merge, so main\'s tree is not the stamped tree land verified', - fix: 'gstack-ship-queue land --pr --repair opens a PR whose only change is a fragment for what the outside merge brought; /ship and land it, which releases the lock', + fix: 'gstack-ship-queue land --pr --repair opens a PR whose only change is a fragment for what the outside merge brought; /gstack-ship and land it, which releases the lock', }, QUEUE_LAND_BASE_BUSY: { anchor: 'queue-land-base-busy', diff --git a/lib/review-depth.ts b/lib/review-depth.ts index 7d42435ed..0f04134ae 100644 --- a/lib/review-depth.ts +++ b/lib/review-depth.ts @@ -451,7 +451,7 @@ function prCapped(h: History, n: NextStep): NextStep { 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` }; - return { step: 'stop', reason: `PR_ROUND_CAP: the read-only final review of a PR that already had ${prior} full review rounds found a blocker; the lane's Captain decides (ship with the note, park, or keep the fix and run /ship again for one more read-only full review of the final head), not an owner ask` }; + return { step: 'stop', reason: `PR_ROUND_CAP: the read-only final review of a PR that already had ${prior} full review rounds found a blocker; the lane's Captain decides (ship with the note, park, or keep the fix and run /gstack-ship again for one more read-only full review of the final head), not an owner ask` }; } if (!prior || (n.step !== 'full' && n.step !== 'scoped')) return n; const used = prior + h.fullPasses; @@ -463,7 +463,7 @@ function prCapped(h: History, n: NextStep): NextStep { } const READ_ONLY_REVIEW = 'read-only final review (R51): fixes changed code after the last round, so the final head gets one full review of the whole PR diff (the dispatcher stages it on the merge base) with no fix round (GST-3562 A)'; -const CAPTAIN_DECIDES = "the lane's Captain decides (R51): ship with it as a ruled note, or keep the fix and run /ship again for one read-only full review of the final head"; +const CAPTAIN_DECIDES = "the lane's Captain decides (R51): ship with it as a ruled note, or keep the fix and run /gstack-ship again for one read-only full review of the final head"; /** * A step that applied fixes in the last allowed round (GST-3562 A, R51): the final head gets one read-only full review, unless diff --git a/lib/ruled-notes.ts b/lib/ruled-notes.ts index 534ad9a24..45173bc40 100644 --- a/lib/ruled-notes.ts +++ b/lib/ruled-notes.ts @@ -8,6 +8,7 @@ import { locate, readRecord, type ApprovalRow, type Env } from './approval-record'; import { isSecurityFinding, REDACTED_FINDING, REDACTED_REASON } from './security-findings'; import { openRun, readRunRecord } from './ship-run-record'; +import { spawnSync } from './spawn-sync'; export interface RuledNote { finding: string; head: string; by: string; reason: string; at: string; approval: string; relayed?: string; not_security?: true } @@ -75,3 +76,38 @@ export const ruledNoteText = (note: RuledNote) => { const n = publicRuledNote(no * beat_age and abandon command; none once the run finished or was abandoned (lib/ship-run-record.ts). */ export const openShipRun = (cwd: string) => openRun(readRunRecord(cwd)); + +/** Finish's and the plan's line for a ruled path: `RULED_EDIT: (ruled at by , approval )`. */ +export const ruledEditLine = (p: string, n: RuledNote) => `RULED_EDIT: ${p} (ruled at ${n.head.slice(0, 12)} by ${n.by}, approval ${n.approval})`; + +/** + * Which of `paths` an owner's `edit:` ruling clears at `now` (a commit or tree; docs/ship-policy.md#ruled-edits): the ruling + * names HEAD or an ancestor of it, both trees hold the path as one file under exactly this spelling with the same mode and bytes, + * and no first-parent commit after the ruled head touches it. finish routes the cleared paths as RULED_EDIT and gstack-review-plan + * leaves them out of the fix range (GST-3814), so both read a ruling the same way; `refused` names each ruled path that did not + * clear, with why. + */ +export function ruledEdits(cwd: string, paths: readonly string[], now: string, edits: readonly RuledNote[]): { ruled: Map; refused: string[] } { + const git = (dir: string, args: string[]) => { const r = spawnSync('git', args, { cwd: dir, encoding: 'utf8', timeout: 120_000, maxBuffer: 64 * 1024 * 1024 }); return { status: r.status, stdout: String(r.stdout ?? '') }; }; + const ancestor = (a: string, d: string) => git(cwd, ['merge-base', '--is-ancestor', a, d]).status === 0; + const top = edits.length ? git(cwd, ['rev-parse', '--show-toplevel']).stdout.trim() : ''; + const entry = (tree: string, p: string) => { const ls = git(cwd, ['--literal-pathspecs', 'ls-tree', '-z', '--full-tree', tree, '--', p]); const rows = ls.stdout.split('\0').filter(Boolean); + return ls.status !== 0 || rows.length > 1 || rows.some(e => e.slice(e.indexOf('\t') + 1) !== p) ? null : rows[0] ?? ''; }; + const untouched = (head: string, p: string) => { const log = git(top, ['--literal-pathspecs', 'log', '--first-parent', '--format=%H', `${head}..HEAD`, '--', p]); return log.status === 0 && !log.stdout.trim(); }; + const refusal = (n: RuledNote, p: string) => { + if (!ancestor(n.head, 'HEAD')) return `ruled at ${n.head.slice(0, 12)}, which is not HEAD or an ancestor of it`; + const [at, cur] = [entry(n.head, p), entry(now, p)], where = (e: string | null) => e === at ? n.head.slice(0, 12) : 'the tree finish routes'; + if (at === null || cur === null) return `git ls-tree could not read it at ${where(null)}`; + if (!at || !cur) return `no file at ${where('')}: a ruling covers a file git holds under this spelling, never a deletion`; + if (p.includes('\uFFFD')) return 'its spelling holds a replacement character (U+FFFD), so the file git changed may have another name'; + if (at !== cur) return `its mode or bytes differ from the ruled head ${n.head.slice(0, 12)}`; + return top && untouched(n.head, p) ? '' : `a commit after ${n.head.slice(0, 12)} touches it, or git could not list them`; + }; + const ruled = new Map(), refused: string[] = []; + for (const p of paths) { + const why = edits.filter(n => n.finding === `edit:${p}`).map(n => [n, refusal(n, p)] as const); + const ok = why.filter(([, w]) => !w).at(-1); + if (ok) ruled.set(p, ok[0]); else if (why.length) refused.push(`${p} (${why.at(-1)![1]}; keep the edit and run /gstack-ship again, docs/ship-policy.md#ruled-edits)`); + } + return { ruled, refused }; +} diff --git a/lib/ship-preflight.ts b/lib/ship-preflight.ts index 6e6ea40d1..d6c947bea 100644 --- a/lib/ship-preflight.ts +++ b/lib/ship-preflight.ts @@ -122,7 +122,7 @@ function integrate(cwd: string, base: string, run: string | undefined, r: Report return false; } if (line === 'CARRY: refused (RECEIPT_CARRY_SCOPED_REVIEW)') { - r.next(`carry route (Step 1.4): the base edited context next to reviewed hunks: fix what the base merge broke (CHANGELOG, size caps), commit and push; then gstack-ship-receipt carry --pr ${n} --base ${base} writes the packet for that head; one fix-check reviewer reads it; gstack-pregate --allow-repo-commands, then carry again with --scoped-review --pregate .gstack/tmp/pregate.json; a blocking finding runs Steps 2-16`); + r.next(`carry route (Step 1.4): the base edited context next to reviewed hunks: fix what the base merge broke (CHANGELOG, size caps), commit and push; then gstack-ship-receipt carry --pr ${n} --base ${base} writes the packet for that head; one scoped reader (not a review round) reads it; gstack-pregate --allow-repo-commands, then carry again with --scoped-review --pregate .gstack/tmp/pregate.json; a blocking finding runs Steps 2-16`); return false; } } else r.add('PR: none open'); diff --git a/lib/ship-release.ts b/lib/ship-release.ts index b3bbe2067..dc9879cfc 100644 --- a/lib/ship-release.ts +++ b/lib/ship-release.ts @@ -22,7 +22,7 @@ import { mechanicalPaths, writeMechanicalRecord } from './ship-mechanical'; import { uidSidecars } from './ship-sidecar'; import type { MechanicalConstant } from './ship-policy-mechanical'; import { forbidSpecs } from './review-fetch'; -import { readRuledNotes, ruledNoteText } from './ruled-notes'; +import { readRuledNotes, ruledEditLine, ruledEdits, ruledNoteText } from './ruled-notes'; import { dispositionedOn, gateDispositionText, readGateDispositions } from './gate-dispositions'; import { parseReceiptDocs, type ReceiptDocs } from './ship-receipt-docs'; import { redactFindingSpans } from './redact-engine'; @@ -299,33 +299,14 @@ function route(cwd: string, base: string, reviewed: string, reviewedBase: Review for (const k of ['context', 'tests', 'bounded'] as const) by[k] = by[k].filter(p => !packetBody.over.includes(p)); } printRulings(cwd, r); - const ancestor = (a: string, d: string) => git(cwd, ['merge-base', '--is-ancestor', a, d]).status === 0; const edits = readRuledNotes(cwd).filter(n => n.finding.startsWith('edit:')); - const top = edits.length ? git(cwd, ['rev-parse', '--show-toplevel']).stdout.trim() : ''; - const entry = (tree: string, p: string) => { const ls = git(cwd, ['--literal-pathspecs', 'ls-tree', '-z', '--full-tree', tree, '--', p]); const rows = ls.stdout.split('\0').filter(Boolean); - return ls.status !== 0 || rows.length > 1 || rows.some(e => e.slice(e.indexOf('\t') + 1) !== p) ? null : rows[0] ?? ''; }; - const untouched = (head: string, p: string) => { const log = git(top, ['--literal-pathspecs', 'log', '--first-parent', '--format=%H', `${head}..HEAD`, '--', p]); return log.status === 0 && !log.stdout.trim(); }; - const refusal = (n: (typeof edits)[number], p: string) => { - if (!ancestor(n.head, 'HEAD')) return `ruled at ${n.head.slice(0, 12)}, which is not HEAD or an ancestor of it`; - const [at, cur] = [entry(n.head, p), entry(now, p)], where = (e: string | null) => e === at ? n.head.slice(0, 12) : 'the tree finish routes'; - if (at === null || cur === null) return `git ls-tree could not read it at ${where(null)}`; - if (!at || !cur) return `no file at ${where('')}: a ruling covers a file git holds under this spelling, never a deletion`; - if (p.includes('\uFFFD')) return 'its spelling holds a replacement character (U+FFFD), so the file git changed may have another name'; - if (at !== cur) return `its mode or bytes differ from the ruled head ${n.head.slice(0, 12)}`; - return top && untouched(n.head, p) ? '' : `a commit after ${n.head.slice(0, 12)} touches it, or git could not list them`; - }; - const ruled = new Map(), refusedEdits: string[] = []; - for (const p of by.behavior) { - const why = edits.filter(n => n.finding === `edit:${p}`).map(n => [n, refusal(n, p)] as const); - const ok = why.filter(([, w]) => !w).at(-1); - if (ok) ruled.set(p, ok[0]); else if (why.length) refusedEdits.push(`${p} (${why.at(-1)![1]}; keep the edit and run /ship again, docs/ship-policy.md#ruled-edits)`); - } + const { ruled, refused: refusedEdits } = ruledEdits(cwd, by.behavior, now, edits); by.behavior = by.behavior.filter(p => !ruled.has(p)); const uid = uidSidecars(cwd, { sides, candidates: parent ? [] : by.behavior, excluded: opts.excluded }); by.sidecar = Object.keys(uid.proven).sort(); by.behavior = by.behavior.filter(p => !by.sidecar.includes(p)); r.add(`ROUTE: reviewed=${reviewed.slice(0, 12)} current=${now.slice(0, 12)} behavior=${by.behavior.length} docs=${by.docs.length} metadata=${by.metadata.length} tests=${by.tests.length} base=${sides ? by.base.length : 'unknown'} context=${by.context.length}${by.bounded.length ? ` bounded=${by.bounded.length}` : ''}${by.mechanical.length ? ` mechanical=${by.mechanical.length}` : ''}${by.sidecar.length ? ` sidecar=${by.sidecar.length}` : ''}`); - for (const [p, n] of ruled) r.add(`RULED_EDIT: ${p} (ruled at ${n.head.slice(0, 12)} by ${n.by}, approval ${n.approval})`); + for (const [p, n] of ruled) r.add(ruledEditLine(p, n)); for (const x of refusedEdits) r.add(`RULED_EDIT_REFUSED: ${x}`); for (const n of edits) r.add(`RULED_NOTE: ${ruledNoteText(n)}${[...ruled.values()].includes(n) ? '' : ' (no RULED_EDIT at this head; not applied)'}`); for (const x of bounded.refused) if (by.behavior.includes(x.path)) r.add(`ROUTE_BOUNDED_REFUSED: ${x.path} ${x.reason} (fix: ${x.fix}; docs/troubleshooting.md#route-bounded-refused)`); 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 a465b5000..3e57f09dd 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":"a296be05e50ac76c10be9199a1facfb844f1f2d8a406c5cd24a55e7a535e880d","replay":"GST-3562-part-4"} +{"sha":"d6f474b5320d9b94715e79400647ab215942ed2f5c60636ea8a82e890ab21b6f","replay":"GSTA-861"} diff --git a/test/fixtures/review-pins/replays/GSTA-861.json b/test/fixtures/review-pins/replays/GSTA-861.json new file mode 100644 index 000000000..3e34f92f8 --- /dev/null +++ b/test/fixtures/review-pins/replays/GSTA-861.json @@ -0,0 +1 @@ +{"replay":"GSTA-861","justification":"GSTA-861 deterministic no-loss replay, no paid run (CREW rule 15): lib/review-depth.ts changes two stop-reason strings only, renaming the recovery command in the read-only final review's PR_ROUND_CAP reason and in CAPTAIN_DECIDES from 'run /ship again' to 'run /gstack-ship again' (#4819 leftovers). No step, dispatch, reader, effort, depth rule or History field changes, and no reviewer brief reads these strings. The GST-3562 replays (test/review-depth.test.ts, test/review-depth-lean.test.ts, test/review-risk-token-paths.test.ts) keep every case's kind and step at this file's bytes, because their kind rules match the unchanged reason prefixes ('a fix followed the read-only final review', 'read-only final review (R51)')."} diff --git a/test/no-stop.test.ts b/test/no-stop.test.ts index 802d52c8f..de9db80c6 100644 --- a/test/no-stop.test.ts +++ b/test/no-stop.test.ts @@ -25,12 +25,13 @@ const TIMEOUT = diff('test/worker.test.ts', [" test('drains', async () => { awa const check = (cls: string, d?: string, prior: NoStopRecord[] = []) => checkNoStop({ cls, reason: 'r', evidence: 'run 41715705702', prior, diff: d, root: ROOT }); describe('lib/no-stop: what qualifies', () => { - test('scoped-fix-check: a docs-only or timeout-only round-2 fix qualifies once; code, skill prose or a second one stops', () => { - expect(check('scoped-fix-check', diff('docs/review-policy-notes.md', ['old wording'], ['new wording']))).toMatchObject({ ok: true, detail: expect.stringContaining('docs-only') }); - expect(check('scoped-fix-check', TIMEOUT)).toMatchObject({ ok: true, detail: expect.stringContaining('timeout-only') }); - expect(check('scoped-fix-check', diff('lib/worker.ts', ['return a;'], ['return b;']))).toMatchObject({ ok: false, reason: expect.stringContaining('neither docs-only') }); - expect(check('scoped-fix-check', diff('ship/SKILL.md.tmpl', ['old'], ['new']))).toMatchObject({ ok: false }); - expect(check('scoped-fix-check', TIMEOUT, [{ class: 'scoped-fix-check', reason: 'x', evidence: 'y' }])).toMatchObject({ ok: false, reason: expect.stringContaining('a second goes to the owner') }); + // Value: protects=the retired scoped-fix-check (fix-checks and their grants, GST-3562 part 4) never records a no-stop, so a + // stop after round 2 goes to the lane's Captain; fails_when=checkNoStop still accepts a docs-only or timeout-only round-2 + // fix as scoped-fix-check while gstack-no-stop refuses it (#4826 final review); seam=lib/no-stop checkNoStop + test('scoped-fix-check is retired: no diff qualifies, not even a docs-only or timeout-only one', () => { + for (const d of [diff('docs/review-policy-notes.md', ['old wording'], ['new wording']), TIMEOUT, diff('lib/worker.ts', ['return a;'], ['return b;'])]) { + expect(check('scoped-fix-check', d)).toMatchObject({ ok: false, reason: expect.stringContaining('removed with fix-check grants (GST-3562 part 4)') }); + } }); test('test-timeout-fix: only a raised timeout in a test file qualifies', () => { @@ -43,7 +44,7 @@ describe('lib/no-stop: what qualifies', () => { test('review pass 1 holes: an assertion bound, a name that only contains "timeout", and a "-- " line inside a hunk are not timeout-only', () => { expect(check('test-timeout-fix', diff('test/perf.test.ts', [' expect(elapsedMs).toBeLessThan(timeoutMs + 100);'], [' expect(elapsedMs).toBeLessThan(timeoutMs + 5000);']))).toMatchObject({ ok: false }); - expect(check('scoped-fix-check', diff('lib/retry.ts', ['const MAX_ATTEMPTS_BEFORE_TIMEOUT = 3;'], ['const MAX_ATTEMPTS_BEFORE_TIMEOUT = 30;']))).toMatchObject({ ok: false }); + expect(check('test-timeout-fix', diff('test/retry.test.ts', ['const MAX_ATTEMPTS_BEFORE_TIMEOUT = 3;'], ['const MAX_ATTEMPTS_BEFORE_TIMEOUT = 30;']))).toMatchObject({ ok: false }); expect(check('test-timeout-fix', diff('test/x.test.ts', [' setDefaultTimeout(5_000);'], [' setDefaultTimeout(30_000);']))).toMatchObject({ ok: true }); const hidden = 'diff --git a/test/x.test.ts b/test/x.test.ts\n--- a/test/x.test.ts\n+++ b/test/x.test.ts\n@@ -1,2 +1,1 @@\n--- guard\n- }, 5000);\n+ }, 50000);\n'; expect(check('test-timeout-fix', hidden)).toMatchObject({ ok: false }); diff --git a/test/review-pass-program-steps.test.ts b/test/review-pass-program-steps.test.ts index 3ea93c534..605286abb 100644 --- a/test/review-pass-program-steps.test.ts +++ b/test/review-pass-program-steps.test.ts @@ -10,22 +10,6 @@ import { withWorkspace } from '../lib/review-brief'; import { PARENT_ONLY_QA, type Manifest } from '../lib/review-pass'; import { ROOT, BIN, spec, manifest, repo, host, runPass, bin } from './helpers/review-pass-harness'; -/** - * GST-3562 A: the planner plans a fix-check only for a grant answering the stop after a round-2 fix-check (GEVA-223), until a - * later release removes it. Commit a fix, record the owner's grant at that stop head, and return the plan flags of that stop. - */ -function legacyGrantFlags(dir: string, env: NodeJS.ProcessEnv): string[] { - const sh = (c: string) => spawnSync('bash', ['-c', c], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 }); - const rangeBase = sh('git rev-parse HEAD').stdout.trim(); - expect(sh('echo "export const fix = 1;" >> src/a.ts && git commit -qam fix').status).toBe(0); - const stopHead = sh('git rev-parse HEAD').stdout.trim(); - env.GSTACK_APPROVALS_MIRROR = '0'; - delete env.GSTACK_APPROVALS_DIR; - const a = spawnSync(path.join(BIN, 'gstack-approvals'), ['add', '--ask', `Owner grant: one scoped fix-check after round 2 (review_loop_grant ${stopHead.slice(0, 12)})`, '--words', 'do it', '--by', 'GStack Minder', '--scope', 'this /ship invocation', '--json'], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 }); - expect(a.status, a.stderr).toBe(0); - return ['--pass', '1', '--last', 'fix-check', '--fix-checks', '1', '--fixed-blocking', '--adversarial-ran', '--range-base', rangeBase, '--grant', JSON.parse(a.stdout).added[0]]; -} - describe('Capy pass program (fake host, real bins)', () => { test('Step 11 notes its own growth from its first dispatch, not from the pass\'s starting reading', async () => { const { dir, env } = repo(); @@ -140,6 +124,25 @@ describe('Capy pass program (fake host, real bins)', () => { expect(again).not.toContain('REVIEW_LOG_START:'); }, 240_000); + // Value: protects=a stop on a second-model blocker binds: Step 11 with no logStart starts one adversarial-review token per voice + // row it will log (the native adversarial and the second-model reader), so neither row is logged unbound; fails_when=the + // default starts one token for two voice rows, the second-model row logs uncaptured and gstack-ship-receipt stop refuses + // STOP_UNBOUND (CAPY-1 on yc-software/qm#3973, GSKI-1 on gskills#45 and #46); seam=the pass program's voices start + test('Step 11 with no logStart starts one token per voice row it logs, so a second-model blocker can bind its stop', async () => { + const { dir, env } = repo(); + const out = path.join(dir, '.state/run/p1'); + const h = host(dir, env); + const base = { base: 'main', out, pass: 'x22p1', planFlags: ['--depth-floor', 'full'] }; + expect(await runPass(h, base)).toContain('NEXT: judge (Phase 4)'); + const models = { 'outside-voice': { model_id: 'openai/gpt-6.1-sol' }, 'adversarial-native': { model_id: 'anthropic/claude-opus-5-5', reasoning_mode: 'high' } }; + const res = await runPass(h, { ...base, stage: 'voices', models }); + const starts = res.split('\n').filter(l => l.startsWith('REVIEW_LOG_START: adversarial-review')); + expect(starts.length).toBe(2); + expect(new Set(starts.map(l => l.split('token=')[1])).size).toBe(2); + const m = JSON.parse(fs.readFileSync(path.join(out, 'pass-manifest.json'), 'utf8')); + expect(Object.keys(m.log_starts).sort()).toEqual(['voices:adversarial-review', 'voices:adversarial-review#2']); + }, 240_000); + test('a repeat pass reads the range: diffBase reaches the specialists and the Red Team, byte for byte the render CLI at that base', async () => { const { dir, env } = repo(); const sh = (c: string) => spawnSync('bash', ['-c', c], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 }); diff --git a/test/review-pass-step11.test.ts b/test/review-pass-step11.test.ts index b6c54c860..eccff7fe0 100644 --- a/test/review-pass-step11.test.ts +++ b/test/review-pass-step11.test.ts @@ -28,7 +28,8 @@ describe('Capy pass program (fake host, real bins)', () => { expect(voices.indexOf('REVIEW_LOG_START: adversarial-review')).toBeLessThan(voices.indexOf('DISPATCHED:')); expect(voices).toContain('NEXT: judge the voices'); const m = JSON.parse(fs.readFileSync(path.join(out, 'pass-manifest.json'), 'utf8')); - expect(Object.keys(m.log_starts ?? {}).sort()).toEqual(['pass:review', 'voices:adversarial-review']); + expect(voices).toMatch(/REVIEW_LOG_START: adversarial-review #2 token=\S+/); + expect(Object.keys(m.log_starts ?? {}).sort()).toEqual(['pass:review', 'voices:adversarial-review', 'voices:adversarial-review#2']); }, 240_000); // Value: protects=Step 11 on its own --out (the head moved after a fix round) renders and sends only the voices, so its ledger verifies clean; fails_when=pass renders the plan's first and specialists stages for a voices-only program, leaving BRIEF specialist-batched NOT_SENT in the ledger; diff --git a/test/review-plan-cli.test.ts b/test/review-plan-cli.test.ts index 32f34ae06..7f98a611d 100644 --- a/test/review-plan-cli.test.ts +++ b/test/review-plan-cli.test.ts @@ -319,9 +319,9 @@ describe('gstack-review-plan --post-review stop names the edit ruling (GST-3775) const p = run(r, ['--pass', '3', '--last', 'full', '--range-base', passHead, '--post-review']); expect(p.status, p.stderr).toBe(0); expect(p.stdout).toContain("a fix followed the read-only final review: the lane's Captain decides (R51)"); - expect(p.stdout).toContain(`record that ruling once per edited path (each path shell-quoted; the owner-ref is the relay this open /ship run needs): gstack-approvals rule --finding 'edit:src/a.ts' --head ${head} --reason ' l.startsWith('NEXT: '))!.matchAll(/gstack-approvals rule --finding ('(?:[^']|'\\'')*') --head /g)].map(m => m[1]!); expect(findings).toHaveLength(2); const parsed = spawnSync('sh', ['-c', `printf '%s\\n' ${findings.join(' ')}`], { cwd: r.dir, encoding: 'utf8', timeout: 10_000 }); @@ -329,3 +329,64 @@ describe('gstack-review-plan --post-review stop names the edit ruling (GST-3775) expect(run(r, ['--pass', '3', '--last', 'full', '--range-base', passHead, '--fixed-below']).stdout).not.toContain('--finding edit:'); }, 30_000); }); + +// Value: protects=an owner's edit: ruling on an edit after the read-only final review is honoured by the plan as finish +// honours it, so the ruled edit ships as a note and only the targeted reader receipt write asks for, or nothing, follows; +// fails_when=the plan still counts the ruled range as a fix (FIX_RANGE runtime_lines>0, NEXT: stop or voices, GST-3814 on +// #4819), or a ruling clears a path it does not name or bytes edited after it; seam=bin/gstack-review-plan --range-base reading +// the approval record +describe('gstack-review-plan honours edit rulings in the fix range (GST-3814)', () => { + const env = (r: { state: string }) => { const e: NodeJS.ProcessEnv = { ...process.env, GSTACK_STATE_ROOT: r.state, GSTACK_APPROVALS_MIRROR: '0' }; delete e.GSTACK_APPROVALS_DIR; return e; }; + const plan = (r: { dir: string; state: string }, args: string[]) => spawnSync(BIN, ['--base', 'main', '--gate-tagged', '0', ...args], { cwd: r.dir, encoding: 'utf8', timeout: 60_000, env: env(r) }); + const rule = (r: { dir: string; state: string }, file: string, head: string) => spawnSync(path.join(path.dirname(BIN), 'gstack-approvals'), ['rule', '--finding', `edit:${file}`, '--head', head, '--reason', 'the docs-audit rename after the final review ships as a disclosed note', '--words', 'ship it with the note', '--by', 'GStack Minder (GSTA-36)'], { cwd: r.dir, encoding: 'utf8', timeout: 60_000, env: env(r) }); + const after = ['--pass', '3', '--last', 'full', '--fixed-below']; + function edited(files: Record, message = 'docs audit edit after the final review') { + const r = repo({ 'src/a.ts': 'export const a = 1;\n', 'src/b.ts': 'export const b = 1;\n' }); + const git = (...a: string[]) => spawnSync('git', a, { cwd: r.dir, encoding: 'utf8', timeout: 10_000 }).stdout.trim(); + const passHead = git('rev-parse', 'HEAD'); + for (const [p, text] of Object.entries(files)) fs.appendFileSync(path.join(r.dir, p), text); + git('add', '.'); git('commit', '-qm', message); + return { r, git, passHead, head: git('rev-parse', 'HEAD') }; + } + test('every path ruled at the head: the range plans as no fix and the stop is gone', () => { + const { r, passHead, head } = edited({ 'src/a.ts': 'export const c = 3;\n' }); + expect(plan(r, [...after, '--range-base', passHead]).stdout).toMatch(/^NEXT: stop \(a fix followed the read-only final review/m); + expect(rule(r, 'src/a.ts', head).status).toBe(0); + const p = plan(r, [...after, '--range-base', passHead]); + expect(p.status, p.stderr).toBe(0); + expect(p.stdout).toMatch(new RegExp(`^RULED_EDIT: src/a\\.ts \\(ruled at ${head.slice(0, 12)} by GStack Minder \\(GSTA-36\\), approval a-[0-9a-f]{12}\\)$`, 'm')); + expect(p.stdout).toContain(`FIX_RANGE: runtime_lines=0 base=${passHead} ruled=1`); + expect(p.stdout).toMatch(/^NEXT: done \(every edit since --range-base is ruled a note \(RULED_EDIT\)/m); + expect(p.stdout).not.toContain("Captain decides"); + expect(JSON.parse(plan(r, [...after, '--range-base', passHead, '--json']).stdout).fix_range).toMatchObject({ runtime_lines: 0, ruled: ['src/a.ts'] }); + }, 60_000); + test('every path ruled on a targeted-class diff: the one targeted reader reads HEAD, since no record covers the ruled bytes', () => { + const { r, passHead, head } = edited({ 'src/a.ts': 'export const c = 3;\n' }); + expect(rule(r, 'src/a.ts', head).status).toBe(0); + const p = spawnSync(BIN, ['--base', 'main', '--gate-tagged', '1', ...after, '--range-base', passHead], { cwd: r.dir, encoding: 'utf8', timeout: 60_000, env: env(r) }); + expect(p.stdout).toContain('TARGETED: classes=gate'); + expect(p.stdout).toMatch(/^NEXT: targeted \(the loop is done and every edit since --range-base is ruled a note, but no targeted record covers the ruled bytes: one targeted reader reads HEAD/m); + expect(p.stdout).toMatch(/^DISPATCH: targeted targeted /m); + }, 60_000); + test('a gate finding no file ruling covers (a CI skip marker in the commit message) keeps the stop', () => { + const { r, passHead, head } = edited({ 'src/a.ts': 'export const c = 3;\n' }, 'docs audit edit [skip ci]'); + expect(rule(r, 'src/a.ts', head).status).toBe(0); + const p = plan(r, [...after, '--range-base', passHead]); + expect(p.stdout).toContain('RULED_EDIT: src/a.ts'); + expect(p.stdout).toMatch(/^NEXT: stop \(a fix followed the read-only final review/m); + }, 60_000); + test('a path with no ruling, or edited again after its ruling, still stops', () => { + const partial = edited({ 'src/a.ts': 'export const c = 3;\n', 'src/b.ts': 'export const d = 4;\n' }); + expect(rule(partial.r, 'src/a.ts', partial.head).status).toBe(0); + const p = plan(partial.r, [...after, '--range-base', partial.passHead]); + expect(p.stdout).toMatch(/^NEXT: stop \(a fix followed the read-only final review/m); + expect(p.stdout).toContain('RULED_EDIT: src/a.ts'); + const later = edited({ 'src/a.ts': 'export const c = 3;\n' }); + expect(rule(later.r, 'src/a.ts', later.head).status).toBe(0); + fs.appendFileSync(path.join(later.r.dir, 'src/a.ts'), 'export const e = 5;\n'); later.git('commit', '-qam', 'edit it again'); + const q = plan(later.r, [...after, '--range-base', later.passHead]); + expect(q.stdout).toMatch(/^NEXT: stop \(a fix followed the read-only final review/m); + expect(q.stdout).toContain('RULED_EDIT_REFUSED: src/a.ts ('); + expect(q.stdout).not.toMatch(/^RULED_EDIT: /m); + }, 60_000); +}); diff --git a/test/review-plan-pr-rounds.test.ts b/test/review-plan-pr-rounds.test.ts index c48ed7c29..0757b55e6 100644 --- a/test/review-plan-pr-rounds.test.ts +++ b/test/review-plan-pr-rounds.test.ts @@ -76,7 +76,7 @@ describe('PR round cap', () => { for (const roundGrant of [undefined, 'a-000000000001']) { const stop = nextStep(h({ priorFull: 3, fullPasses: 1, last: 'full', fixedBlocking: true, roundGrant }), 'standard'); expect(stop.step).toBe('stop'); - expect(stop.reason).toContain("the lane's Captain decides (ship with the note, park, or keep the fix and run /ship again for one more read-only full review of the final head)"); + expect(stop.reason).toContain("the lane's Captain decides (ship with the note, park, or keep the fix and run /gstack-ship again for one more read-only full review of the final head)"); expect(stop.reason).not.toContain('fix-check grant'); expect(stop.reason).not.toContain('does not buy a fix round'); } diff --git a/test/ship-finish-edit-ruling.test.ts b/test/ship-finish-edit-ruling.test.ts index 327c69fdc..f8547882a 100644 --- a/test/ship-finish-edit-ruling.test.ts +++ b/test/ship-finish-edit-ruling.test.ts @@ -88,7 +88,7 @@ describe('finish honours an edit ruling after the final review (GST-3775)', () = for (const p of ['test/x.test.ts', routed]) expect(rule(f, p, stopHead).status).toBe(0); const r = finish(f, reviewed, post); expect([r.status, r.stdout]).toEqual([3, expect.stringContaining(`${STOPPED} (${routed})`)]); - expect(lineOf(r.stdout, 'RULED_EDIT_REFUSED')).toBe(`RULED_EDIT_REFUSED: ${routed} (no file at ${stopHead.slice(0, 12)}: a ruling covers a file git holds under this spelling, never a deletion; keep the edit and run /ship again, docs/ship-policy.md#ruled-edits)`); + expect(lineOf(r.stdout, 'RULED_EDIT_REFUSED')).toBe(`RULED_EDIT_REFUSED: ${routed} (no file at ${stopHead.slice(0, 12)}: a ruling covers a file git holds under this spelling, never a deletion; keep the edit and run /gstack-ship again, docs/ship-policy.md#ruled-edits)`); expect(r.stdout).toContain('RULED_EDIT: test/x.test.ts ('); expect(r.stdout).toMatch(new RegExp(`^RULED_NOTE: edit:test/\\uFFFDy\\.test\\.ts at .* \\(no RULED_EDIT at this head; not applied\\)$`, 'm')); }); diff --git a/test/ship-receipt-carry-mixed.test.ts b/test/ship-receipt-carry-mixed.test.ts index 0600e2509..d7aff4471 100644 --- a/test/ship-receipt-carry-mixed.test.ts +++ b/test/ship-receipt-carry-mixed.test.ts @@ -66,7 +66,7 @@ function founderstar(resolvedSave = 84, baseBlock = 0) { return { ...x, head, sides }; } -const scopedPacket = (err: string) => /one fix-check reviewer reads (\S+), then rerun carry/.exec(err)?.[1]; +const scopedPacket = (err: string) => /one scoped reader \(not a review round\) reads (\S+), then rerun carry/.exec(err)?.[1]; const eligible = (err: string) => /^RECHECK: advisory range_diff_lines=(\d+) range_diff_sha256=([0-9a-f]{64}) packet=(\S+);/m.exec(err); const recordAt = (f: ShipFx, name: string, v: object) => { const file = path.join(f.root, name); fs.writeFileSync(file, JSON.stringify(v)); return file; }; diff --git a/test/ship-rereview-triggers.test.ts b/test/ship-rereview-triggers.test.ts index 4ead8f7bb..708590406 100644 --- a/test/ship-rereview-triggers.test.ts +++ b/test/ship-rereview-triggers.test.ts @@ -642,7 +642,7 @@ describe('preflight carry route for a spliced hunk (GST-442)', () => { f.gh(`case "$1 $2" in "pr list") echo 9 ;; "pr view") cat '${view}' ;; *) exit 1 ;; esac`); const r = f.run(PREFLIGHT, ['--base', 'main']); expect(lineOf(r.stdout, 'CARRY')).toBe('CARRY: refused (RECEIPT_CARRY_SCOPED_REVIEW)'); - expect(r.stdout).toMatch(/^NEXT: carry route \(Step 1\.4\): .*fix what the base merge broke.*commit and push.*writes the packet.*one fix-check reviewer.*--scoped-review /m); + expect(r.stdout).toMatch(/^NEXT: carry route \(Step 1\.4\): .*fix what the base merge broke.*commit and push.*writes the packet.*one scoped reader \(not a review round\).*--scoped-review /m); expect(fs.existsSync(path.join(f.work, '.git', 'gstack', `scoped-review-${head.slice(0, 12)}.md`))).toBe(false); const wrote = f.run(path.join(BIN, 'gstack-ship-receipt'), ['carry', '--pr', '9', '--base', 'main']); expect([wrote.status, fs.existsSync(path.join(f.work, '.git', 'gstack', `scoped-review-${head.slice(0, 12)}.md`))]).toEqual([EXIT.refused, true]);