From 7deee4292c3d96d97640960c95ef3857ae1d47e1 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Tue, 24 Nov 2026 00:52:13 -0800 Subject: [PATCH] After a fix, the second review round is always a full review (#4783) After a blocking fix, /ship's second review round is now always a full review, with every reviewer recorded alongside the pass, instead of a narrower re-check whose reply could go missing. Why: the narrower re-check ran one reviewer outside the pass record, so a missing reply or a blocker it found never reached the verdict. 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> --- bin/gstack-review-dispatch | 4 +- bin/gstack-review-plan | 7 +- .../round-two-is-always-a-full-review.md | 1 + .../scoped-review-runs-its-fix-reader.md | 1 - docs/review-policy.md | 66 ++++++++------- docs/ship-policy.md | 6 +- lib/review-depth.ts | 25 +++--- lib/review-pass.ts | 5 +- ship/DRIVER.md | 6 +- ship/DRIVER.md.tmpl | 6 +- ship/sections/review-army.md | 5 +- ship/sections/review-army.md.tmpl | 5 +- .../files/lib/review-depth.ts.json | 2 +- .../files/ship/sections/review-army.md.json | 2 +- .../review-pins/replays/GST-3562-part-3.json | 1 + test/helpers/gst3562-replay.ts | 13 ++- test/review-depth-lean.test.ts | 21 +++++ test/review-depth.test.ts | 80 ++++++++++--------- test/review-pass-program-steps.test.ts | 44 ++++++---- test/review-pass.test.ts | 54 ++++++------- test/review-plan-cli.test.ts | 14 ++-- test/ship-driver.test.ts | 11 +-- .../round-two-is-always-a-full-review.json | 4 + 23 files changed, 216 insertions(+), 167 deletions(-) create mode 100644 changelog.d/round-two-is-always-a-full-review.md delete mode 100644 changelog.d/scoped-review-runs-its-fix-reader.md create mode 100644 test/fixtures/review-pins/replays/GST-3562-part-3.json create mode 100644 test/size-ledger/ship/round-two-is-always-a-full-review.json diff --git a/bin/gstack-review-dispatch b/bin/gstack-review-dispatch index c4a1c9201..43db384b0 100755 --- a/bin/gstack-review-dispatch +++ b/bin/gstack-review-dispatch @@ -90,7 +90,8 @@ const HELP = `gstack-review-dispatch — verbatim reviewer briefs and loss-free takes no --extras, and a reviewer pass refuses to resume its manifest. is letters, digits and dashes, read as lowercase (P1 is p1): the manifest, reader titles and a resume use that form. A fix-check reader (stage specialists) renders from decision 3.5's --fix-list, --hunks, --tests and --callers files. - --diff-base sets every reader's base, a scoped pass's Red Team included (the targeted reader keeps the merge base). + --diff-base sets every reader's base, except the targeted reader and, before Step 11 has run (no --adversarial-ran), + the native adversarial and outside voice, which keep the merge base. An existing manifest for the same --pass is reused (resumed). --extras: [{"name","prompt_file","first"?,"model"?}] --audit-only skips the plan: the --extras readers are the whole pass (Step 14.5's docs audit) Before anything is written (and again before stage renders), each reviewer's diff is read once with a @@ -436,6 +437,7 @@ function pass(): number { const m = buildManifest({ pass: id, out, ledger: flag('--ledger') ?? path.join(out, 'review-ledger.jsonl'), base, diffBase, root, checklistRoot: flag('--checklist-root') ?? ROOT, dispatches: step === 'fix-check' ? p.dispatches : p.dispatches.filter(d => d.role !== 'fix-check'), next: step, planLines, learnings: readFile(flag('--learnings-file'), 'learnings') ?? null, extras, targetedClasses: p.targeted?.classes, mergeBase, rangeBase: flag('--diff-base') ? undefined : rangeBase, + voiceBase: mergeBase && diffBase !== mergeBase && !planArgs.includes('--adversarial-ran') ? mergeBase : undefined, fixCheck: step === 'fix-check' && (flag('--fix-list') || flag('--hunks') || flag('--tests')) ? { fix_list: flag('--fix-list')!, hunks: flag('--hunks')!, tests: flag('--tests')!, callers: flag('--callers') } : undefined, ...planExclude(p.review_exclude), ...(p.readers ? { readers: p.readers } : {}), voices: own.includes('--voices') }); const over = ceiling('gstack-review-dispatch pass', base, m.out, m.readers, m.diff_base, (m.review_exclude as PlanExclude) ?? null); diff --git a/bin/gstack-review-plan b/bin/gstack-review-plan index 841952833..9da5de1c5 100755 --- a/bin/gstack-review-plan +++ b/bin/gstack-review-plan @@ -65,13 +65,14 @@ const HELP = `gstack-review-plan — the review depth of the next /ship step (do --gated a,b specialists the hit-rate stats tag GATE_CANDIDATE --force a,b|all specialists forced by prompt flags (--all-specialists is all): at standard and full depth they join the batched specialist's checklists, where maintainability, performance and simplification are read only when - forced; light runtime-0 docs and scoped passes dispatch them one reader each; targeted is no specialist and + forced; light runtime-0 docs dispatch them one reader each; targeted is no specialist and refuses (exit 2): the plan dispatches it itself --reviewed-numbers the numeric-claim fingerprint the outside voice already reviewed --depth-floor standard|full raise the depth to at least this (never lowers it); /ship passes its prompt flag on every run --range-base the fix range's base (this pass's PASS_HEAD; with --post-review --last fix-check, the last fix-check's - commit): after a fixed blocker on a diff below full depth, a - committed range of at most ${SCOPED_RANGE_LINES} runtime lines plans a scoped pass; anything unread plans the full pass + commit): after a fixed blocker, round 2 is a full pass on the range; below full depth, a + committed range of at most ${SCOPED_RANGE_LINES} runtime lines now also gets a full pass (no scoped pass) that keeps + the Red Team and, on a range with runtime lines, the native adversarial; anything unread plans the full pass --no-tiers specialists, audits and watchers at the host's default effort too (as gstack-config review_effort_tiers off does) --json the plan as JSON (depth, runtime_lines, rules, errors with input and repair, gate_scan, per-dispatch exclude) --pass1-depth pass 1's REVIEW_DEPTH depth: full, or absent, keeps pass 2 full diff --git a/changelog.d/round-two-is-always-a-full-review.md b/changelog.d/round-two-is-always-a-full-review.md new file mode 100644 index 000000000..102d55230 --- /dev/null +++ b/changelog.d/round-two-is-always-a-full-review.md @@ -0,0 +1 @@ +**After a blocking fix, /ship's second review round is always a full review whose every reader is recorded with the pass, instead of a narrower re-check whose result could go missing.** diff --git a/changelog.d/scoped-review-runs-its-fix-reader.md b/changelog.d/scoped-review-runs-its-fix-reader.md deleted file mode 100644 index edd5b7248..000000000 --- a/changelog.d/scoped-review-runs-its-fix-reader.md +++ /dev/null @@ -1 +0,0 @@ -**A small second review round checks the fix again.** When /ship's second round is a short pass over a small fix, its instructions once more tell the agent to run the reviewer that checks that fix; the last release's wording had dropped that step. diff --git a/docs/review-policy.md b/docs/review-policy.md index dc3cc6e2a..be9a6a4dd 100644 --- a/docs/review-policy.md +++ b/docs/review-policy.md @@ -90,9 +90,9 @@ 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 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 +3. **Two rounds is the cap** (R51): a full pass is a round of this table, and + /ship plans no fix-check (GST-3562 A) and no [scoped pass](#scoped-pass) + (GST-3562 part 3). 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 @@ -285,7 +285,7 @@ the same grant, whichever row records it: | none | full pass 1 on the whole diff | | a full pass with no edits | done | | a full pass (`--last full`) with no fix flag, when the PR has its own unreviewed runtime commits since `--range-base` | stop: `review_required_no_readers` (exit 3), not done; see [troubleshooting](troubleshooting.md#review-required-no-readers) | -| a full pass that fixed a blocking finding, below the cap, on a diff below full depth with a fix range of at most 150 runtime lines | scoped pass on the range | +| a full pass that fixed a blocking finding, below the cap, on a diff below full depth with a fix range of at most 150 runtime lines | full pass on the range (never a scoped pass, GST-3562), with the Red Team and, when the range changes runtime lines, the native adversarial pass again | | a full pass that fixed a blocking finding, below the cap (full depth, a larger range, or a range or depth it could not read) | full pass on the range | | a full pass whose fix touched a gate-class path, below the cap | full pass on the range | | a full pass that fixed only below-floor findings | full pass on the range (round 2; GST-3562 A plans no new fix-check) | @@ -317,26 +317,29 @@ finding the voices queued counts as `--blocking-open`, never a new Step 9), and the stop or the granted fix-check it names stands. -A **scoped pass** is pass 2 after a blocking fix when pass 1 and the diff both -ran below full depth (no gate class, no depth error, no `--depth-floor full`). -A full pass 1 always gets a full pass 2: `--pass1-depth` carries pass 1's -`REVIEW_DEPTH`, and an absent flag counts as full. The fix range -`RANGE_BASE..HEAD` must have at most `SCOPED_RANGE_LINES` (150) runtime lines, counted -as the depth counts them (`gstack-review-plan --range-base $PASS_HEAD` prints -`FIX_RANGE:`). The range holds only the PR's own change since `RANGE_BASE`: when -a base merge lands inside it, what the base brought (a file only main changed, -or main's lines in a file both changed) is not counted, and neither is its gate -class (GST-2229, harness-evals #354). It dispatches one fix-check on the range, the Red Team on the -range, the native adversarial pass when the range changes runtime lines, every -force-included specialist and the outside voice when published numbers changed. -Step 11's voices that have not run yet stay listed, as on a full pass 2. It -writes a full-pass `review` row with `"scope":"scoped"`, so it counts toward -the cap, and a blocker it leaves open stops for the owner as before. A fix that -touched a gate-class path (read from the range with its own scope and gate -scan), a larger range, an empty range, or a -range, classifier or depth it cannot read keeps the full pass 2. The 150-line figure is a starting value from -a 24-PR backtest (GSTA-152 D6), to revisit once classified findings carry -`raised_by`. +The **scoped pass is retired** (GST-3562 part 3, 2026-11-24): every round 2 is a +full round, planned through the normal pass manifest and recorded in it, so no +reader runs outside the pass record. The scoped pass's fix-check was a reader +`gstack-review-dispatch` left out of the manifest, so its reply never reached +verify or judge. Where `nextStep` planned a scoped pass (a blocking fix after a +pass 1 and a diff that both ran below full depth, with a fix range +`RANGE_BASE..HEAD` of at most `SCOPED_RANGE_LINES` (150) runtime lines, counted +as the depth counts them: `gstack-review-plan --range-base $PASS_HEAD` prints +`FIX_RANGE:`), it now plans a full pass on the range that keeps every reader the +scoped pass ran: a full-effort Red Team that excludes nothing, the native +adversarial pass again when the range changes runtime lines (even after Step 11 +ran it), every force-included specialist, the outside voice when published +numbers changed, and Step 11's voices that have not run yet. The driver's +`--diff-base RANGE_BASE` sets every reader's base except the targeted reader's +and, before Step 11 has run (no `--adversarial-ran`), the native adversarial's and +the outside voice's, which keep the merge base and read the whole PR. The range holds only +the PR's own change since `RANGE_BASE`: when a base merge lands inside it, what +the base brought is not counted, and neither is its gate class (GST-2229, +harness-evals #354). A full pass 1, a fix that touched a gate-class path, a larger +range, or a range, classifier or depth it cannot read gets the plain full pass 2. +An old `review` row with `"scope":"scoped"` still counts toward the cap. The +no-loss replay against main's table is +`test/fixtures/review-pins/replays/GST-3562-part-3.json`. The same floor and the same `NO FINDINGS` rule apply to `/review` on its own; its re-review loop keeps its three-cycle fix cap (`CYCLES`), and a pass that @@ -577,8 +580,7 @@ handoffs/GSTA-167/noloss5-results.md). A fixed blocking finding, a CRITICAL or an open blocker raises a light diff to standard for the next step (`step=standard`): its specialists read at least 50 lines -and the Red Team runs, so a raise never dispatches less than light did. When the -next step is a scoped pass, the raise applies to the scoped set only. A fix-check +and the Red Team runs, so a raise never dispatches less than light did. A fix-check is the same at every depth. **Fail closed.** Each of these makes the depth full and is listed in `errors[]` with @@ -647,9 +649,10 @@ the specialists, audits and watchers at the host default too ### Behavior changes - Pass 2 after a blocking fix on a diff below full depth, with a fix range of at - most 150 runtime lines, is a [scoped pass](#scoped-pass): a fix-check and the Red + most 150 runtime lines, was a [scoped pass](#scoped-pass): a fix-check and the Red Team on the range, plus the native adversarial pass (on the range once Step 11 has - run, otherwise on the whole branch), instead of the specialist army. + run, otherwise on the whole branch), instead of the specialist army. GST-3562 + part 3 retired it: that pass 2 is now a full pass on the range. - A tests-only diff (runtime 0) dispatches one batched reader on the Testing checklist, beside the core checklist and the gate scan (GST-2547). Before, it dispatched nothing, so the only review was the author's own core read; R51 gives @@ -1289,8 +1292,9 @@ ones, and the arm lost blockers. `bin/gstack-review-dispatch` closes both ends: dashes, read as lowercase (`P1` is `p1`); any other character is refused. Audit readers marked first, then the specialists with the other audit readers, then the Red Team, then Step 11's voices. A QA extra is refused before any reader is created: Step 9.2.1's probes - are the parent's. `--diff-base` sets every reader's base, a scoped pass's Red - Team included; the targeted reader keeps the merge base. Each reviewer keeps its plan entry and is rendered by the same code as + are the parent's. `--diff-base` sets every reader's base, the Red + Team included; the targeted reader keeps the merge base, and so do the native + adversarial pass and the outside voice before Step 11 has run (no `--adversarial-ran`). Each reviewer keeps its plan entry and is rendered by the same code as `render`, once its inputs exist; the Red Team's findings file is the specialists' `merged.jsonl` lines byte for byte. A brief leaves the bin in indexed chunks of at most 65,536 characters (`chunk`), so no tool output line carries a whole brief and a @@ -1299,7 +1303,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 and the read-only final review, none), a + unchanged by the gstack Capy skill. A full repeat pass takes `--diff-base` (RANGE_BASE; 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 649ab664c..4ea14d825 100644 --- a/docs/ship-policy.md +++ b/docs/ship-policy.md @@ -1808,9 +1808,9 @@ construction: pass. `NO FINDINGS` is the expected reviewer result for a clean range, never a 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) 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 + [transition table](review-policy.md#transitions); a full pass counts as a + round, and /ship plans neither a fix-check nor a [scoped pass](review-policy.md#scoped-pass): any code change + after round 1 gets a full round 2, with no exception (GST-3562 A and part 3). 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 lane's Captain diff --git a/lib/review-depth.ts b/lib/review-depth.ts index 16868a049..cdd9eb803 100644 --- a/lib/review-depth.ts +++ b/lib/review-depth.ts @@ -29,7 +29,7 @@ export const FULL_PASS_CAP = 2; export const SMALL_DIFF_LINES = 50; export const RED_TEAM_LINES = 200; export const LARGE_DIFF_LINES = 100; -/** The largest fix range, in runtime lines, a pass 2 after a blocking fix reviews as a scoped pass (GSTA-152 D6); a starting value. */ +/** The largest fix range, in runtime lines, whose full pass 2 after a blocking fix keeps the readers the retired scoped pass ran (GSTA-152 D6, GST-3562 part 3). */ export const SCOPED_RANGE_LINES = 150; /** The checklists the batched specialist always reads on code and gate class, whatever the depth or scope (GSTA-167 part 2). */ export const LIGHT_FIXED: readonly Specialist[] = ['testing', 'security']; @@ -412,14 +412,17 @@ export interface History { * dispatch keeps one full-effort reader that excludes nothing (the reader the fix-check was). The table sets it; prCapped's * spreads carry it; the dispatch reads it, never the reason text. readOnly marks the read-only final review: the dispatcher * stages it on the PR's merge base whatever --diff-base the driver passes, and Step 3's edit guard applies no fix on it. + * rangeReaders (GST-3562 part 3): this full pass stands where main planned a scoped pass after a small blocking fix, so it + * also dispatches the readers that pass ran: the Red Team, and the native adversarial when the fix range has runtime lines, + * even after Step 11 ran it. */ -export interface NextStep { step: Step; reason: string; keepReader?: true; readOnly?: true } +export interface NextStep { step: Step; reason: string; keepReader?: true; readOnly?: true; rangeReaders?: true } /** * The transition table (docs/review-policy.md#transitions). Pass 1 is full. A fixed - * blocking finding earns a second full pass on the range, scoped when `depth` (known - * only to planReview) is below full and the fix range has at most SCOPED_RANGE_LINES - * runtime lines; any other fix earns a full second pass on the range too, except a light pass whose fix range + * blocking finding earns a second full pass on the range, never a scoped pass (GST-3562 part 3); below full depth with at + * most SCOPED_RANGE_LINES runtime lines in the fix range it keeps the readers main's scoped pass ran (keepReader, + * rangeReaders); any other fix earns a full second pass on the range too, except a light pass whose fix range * changes no runtime lines (GST-3562 A: no new fix-check is planned, and the step's keepReader keeps the full-effort reader * the fix-check was); two rounds is the cap (R51), and capStep says what a fix after the cap gets. * The cap limits fix rounds, not Step 11's voices: on gate class any stop waits for them (GST-967), @@ -518,7 +521,7 @@ function loopStep(h: History, depth?: Depth): NextStep { const keep = h.touchedGate ? 'a fix touched a gate-class path' : depth === undefined ? 'the depth is unknown' : h.pass1Depth === 'full' ? 'pass 1 ran at full depth' : depth === 'full' ? 'the diff is at full depth' : typeof n !== 'number' || !Number.isFinite(n) || n < 0 ? 'the fix range was not read' : n > SCOPED_RANGE_LINES ? `the fix range has ${n} runtime lines (> ${SCOPED_RANGE_LINES})` : null; if (keep) return { step: 'full', reason: `a blocking finding was fixed and ${keep}: full pass on the range` }; - return { step: 'scoped', reason: `a blocking finding was fixed on a ${depth} diff with ${n} runtime lines in the fix range (<= ${SCOPED_RANGE_LINES}): scoped pass on the range` }; + return { step: 'full', reason: `a blocking finding was fixed on a ${depth} diff with ${n} runtime lines in the fix range: full pass on the range, never a scoped pass, so every reader is in the pass record (GST-3562)`, keepReader: true, rangeReaders: true }; } return { step: 'full', reason: 'below-floor fixes changed code after round 1: round 2 is a full pass on the range, never a fix-check (R51, GST-3562 A)', keepReader: true }; } @@ -685,18 +688,20 @@ export function planReviewAt(i: PlanInput, table: (h: History, depth: Depth) => const raised = !full && (raise || runtimeLines <= SMALL_DIFF_LINES); const lines = full ? i.diffLines : Math.max(runtimeLines, raised ? SMALL_DIFF_LINES : 0); const checklists = batchChecklists(dcls, i, skipped); - if (checklists.length) add('specialist', 'batched', specialist, full ? [] : docsAndOutputs, { checklists }); - const redTeam = dcls === 'gate' || (dcls === 'code' && (lines > RED_TEAM_LINES || !!i.criticalFound || raised)); + if (checklists.length) add('specialist', 'batched', specialist, full || (next.rangeReaders && SPECIALISTS.some(forcedBy(i))) ? [] : docsAndOutputs, { checklists }); + const redTeam = dcls === 'gate' || !!next.rangeReaders || (dcls === 'code' && (lines > RED_TEAM_LINES || !!i.criticalFound || raised)); if (redTeam) add('red-team', 'red-team', 'full'); else skipped.push(`red-team (${dcls} class${dcls === 'code' ? `, ${lines} runtime lines, no critical` : ''})`); const codeLike = dcls === 'code' || dcls === 'gate'; + const rangeAdversarial = !!next.rangeReaders && (h.rangeRuntimeLines ?? 0) > 0; if (h.fullPasses === 0 || (!i.adversarialRan && codeLike)) { - if (codeLike) add('adversarial-native', 'adversarial', 'full'); + if (codeLike || rangeAdversarial) add('adversarial-native', 'adversarial', 'full'); else skipped.push(`adversarial-native (${dcls} class)`); if (codeLike || i.numbers.publishes) add('outside-voice', 'outside-voice', 'host'); else skipped.push(`outside-voice (${dcls} class, no numeric claims)`); } else { - skipped.push('adversarial-native and outside-voice (run once per invocation)'); + if (rangeAdversarial) add('adversarial-native', 'adversarial', 'full'); + skipped.push(rangeAdversarial ? 'outside-voice (run once per invocation)' : 'adversarial-native and outside-voice (run once per invocation)'); if (numbersChanged) add('outside-voice', 'outside-voice (numbers changed)', 'host'); } } else if (next.step === 'scoped') { diff --git a/lib/review-pass.ts b/lib/review-pass.ts index 1bbd55684..298a1d881 100644 --- a/lib/review-pass.ts +++ b/lib/review-pass.ts @@ -135,7 +135,7 @@ const STAGE_OF: Record = { specialist: 'specialists', 'fix-check' export function buildManifest(o: { pass: string; out: string; ledger: string; base: string; diffBase: string; root: string; checklistRoot: string; dispatches: Array; next: string; planLines: string[]; learnings?: string | null; extras?: Extra[]; - targetedClasses?: readonly string[]; mergeBase?: string; rangeBase?: string; fixCheck?: FixCheckFiles; reviewExclude?: Record; disclosure?: string; readers?: EffectiveReaders; voices?: boolean; + targetedClasses?: readonly string[]; mergeBase?: string; rangeBase?: string; voiceBase?: string; fixCheck?: FixCheckFiles; reviewExclude?: Record; disclosure?: string; readers?: EffectiveReaders; voices?: boolean; }): Manifest { if (o.voices && o.extras?.length) throw new BriefError(`Step 11's voices pass sends no audit reader, so it takes no --extras: ${o.extras.map(e => e.name).join(', ')}`); const readers: PassReader[] = []; @@ -155,6 +155,7 @@ export function buildManifest(o: { const keep = (d.keep ?? []).filter(s => !excerpt.includes(s)); readers.push({ reader, stage, title: `ship ${o.pass} ${reader}`, state: 'planned', role, name, effort: d.effort, exclude, checklists: d.checklists, ...(policy.length ? { policy_exclude: policy.map(shellQuote).join(' ') } : {}), ...(keep.length ? { keep } : {}), ...(excerpt.length ? { excerpt } : {}), + ...((role === 'adversarial-native' || role === 'outside-voice') && o.voiceBase ? { diff_base: o.voiceBase } : {}), ...(role === 'targeted' ? { classes: [...(o.targetedClasses ?? [])], diff_base: o.mergeBase ?? o.diffBase } : {}), ...(role === 'adversarial-native' && d.classes?.length ? { classes: [...d.classes], diff_base: o.mergeBase ?? o.diffBase } : {}), ...(d.model === 'cross-family' ? { cross_family: true } : d.model && d.model !== 'lane' ? { model: { model_id: d.model } } : {}), @@ -241,7 +242,7 @@ export function renderStage(m: Manifest, stage: Stage, t: SectionTexts, diffFor: } let slice: Record = {}; if (role === 'outside-voice') { - const s = sliceDiff(diffFor(m.diff_base, r), REVIEW_DIFF_MAX_BYTES); + const s = sliceDiff(diffFor(r.diff_base ?? m.diff_base, r), REVIEW_DIFF_MAX_BYTES); const diffFile = path.join(briefs, 'outside-voice.diff'); fs.writeFileSync(diffFile, s.text, { mode: 0o600 }); Object.assign(slots, { diff_file: diffFile, diff_bytes: String(s.bytes), diff_sha256: createHash('sha256').update(s.text).digest('hex'), ...(s.sliced ? { diff_slice: sliceNote(s, REVIEW_DIFF_MAX_BYTES) } : {}) }); diff --git a/ship/DRIVER.md b/ship/DRIVER.md index a5c842007..fa715b93b 100644 --- a/ship/DRIVER.md +++ b/ship/DRIVER.md @@ -81,9 +81,9 @@ both run as written. `Coverage:` and Step 8's line come from `--audit`. 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 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), and `scoped` also runs its `FIX_CHECK:` reader; `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 +one program. Prints `Pre-Landing Review:`, `Gate edits:`. `NEXT: stop` stops; `full` +(every round 2): 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 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)`). diff --git a/ship/DRIVER.md.tmpl b/ship/DRIVER.md.tmpl index a6896d606..e9c3706a3 100644 --- a/ship/DRIVER.md.tmpl +++ b/ship/DRIVER.md.tmpl @@ -79,9 +79,9 @@ both run as written. `Coverage:` and Step 8's line come from `--audit`. 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 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), and `scoped` also runs its `FIX_CHECK:` reader; `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 +one program. Prints `Pre-Landing Review:`, `Gate edits:`. `NEXT: stop` stops; `full` +(every round 2): 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 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)`). diff --git a/ship/sections/review-army.md b/ship/sections/review-army.md index f9cc70928..dd32a719b 100644 --- a/ship/sections/review-army.md +++ b/ship/sections/review-army.md @@ -24,8 +24,7 @@ record none. When an older grant still puts `--round-grant ` there, run `gst 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` dispatch is one full-effort reviewer on the -`gstack-review-plan --fix-check-prompt` prompt with `git diff $RANGE_BASE` as the hunks; the pass's manifest leaves it out (`FIX_CHECK: planned`), so run it yourself beside the pass. +Round 2 is always a `full` pass on the range, never a scoped one: every reader it plans is in the pass's manifest. 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 @@ -796,7 +795,6 @@ but missing dispatched output still blocks continuation, even with a QA exceptio else `issues_found`. N counts unresolved defects now, not original totals; missing coverage, deferred and noted findings are not defects. `SCOPE` is the policy (`frozen`, `diff-plus-blocking` or `all`); `RANGE_BASE_OR_NULL` is `""` from pass 2, else `null`. -- A `scoped` pass adds `"scope":"scoped"`; it is a full-pass row and counts toward the cap. - `REVIEW_START`: this pass's Step 9 token captured before reading the diff; never recapture at persistence to certify unreviewed fixes. - `COMPLETED`: checklist and dispatched specialists/Red Team finish, and all required probes pass. @@ -837,7 +835,6 @@ logged a CRITICAL, `--adversarial-ran` once Step 11's native pass ran, `--review 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. 1. **Dispatched reviewer output missing:** STOP and name each failed specialist or diff --git a/ship/sections/review-army.md.tmpl b/ship/sections/review-army.md.tmpl index 1e2831152..074464a05 100644 --- a/ship/sections/review-army.md.tmpl +++ b/ship/sections/review-army.md.tmpl @@ -22,8 +22,7 @@ record none. When an older grant still puts `--round-grant ` there, run `gst 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` dispatch is one full-effort reviewer on the -`gstack-review-plan --fix-check-prompt` prompt with `git diff $RANGE_BASE` as the hunks; the pass's manifest leaves it out (`FIX_CHECK: planned`), so run it yourself beside the pass. +Round 2 is always a `full` pass on the range, never a scoped one: every reader it plans is in the pass's manifest. 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 @@ -206,7 +205,6 @@ but missing dispatched output still blocks continuation, even with a QA exceptio else `issues_found`. N counts unresolved defects now, not original totals; missing coverage, deferred and noted findings are not defects. `SCOPE` is the policy (`frozen`, `diff-plus-blocking` or `all`); `RANGE_BASE_OR_NULL` is `""` from pass 2, else `null`. -- A `scoped` pass adds `"scope":"scoped"`; it is a full-pass row and counts toward the cap. - `REVIEW_START`: this pass's Step 9 token captured before reading the diff; never recapture at persistence to certify unreviewed fixes. - `COMPLETED`: checklist and dispatched specialists/Red Team finish, and all required probes pass. @@ -247,7 +245,6 @@ logged a CRITICAL, `--adversarial-ran` once Step 11's native pass ran, `--review 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. 1. **Dispatched reviewer output missing:** STOP and name each failed specialist or 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 756dae4e6..2139e7b1f 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":"e6f1395136db91c611ec576795c27fb1cc360eb0318ce3a01d585e383d96c665","replay":"GST-3562-part-2"} +{"sha":"b66e114dbc579e17f6092678cfd385716583654bb06c0f17f4646ad87432276d","replay":"GST-3562-part-3"} 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 499c26f46..abc07e247 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":"bcb16b5626ab4227c31224103ff77fe0ac7a57d9049701b5dbc4c8727038857f","replay":"GST-3562-part-2b"} +{"sha":"6ecc9565ecc639e867993a8db3dd12bb1c0d382cb46716b50c43ebd45afa4bde","replay":"GST-3562-part-3"} diff --git a/test/fixtures/review-pins/replays/GST-3562-part-3.json b/test/fixtures/review-pins/replays/GST-3562-part-3.json new file mode 100644 index 000000000..83d0c51c2 --- /dev/null +++ b/test/fixtures/review-pins/replays/GST-3562-part-3.json @@ -0,0 +1 @@ +{"replay": "GST-3562-part-3", "justification": "GST-3562 part 3 (Captain GStack Minder's ruling of 2026-11-24 under CREW rule 15, scoped by approval a-6ec01c09edf8): the scoped review step is dropped. Deterministic no-loss replay, no paid run. lib/review-depth.ts: after a blocking fix in round 1 on a diff below full depth with a fix range of at most 150 runtime lines, loopStep plans a full pass on the range (keepReader, plus a new rangeReaders flag) instead of main's scoped pass, whose fix-check reader bin/gstack-review-dispatch left out of the manifest; planReview's full step with rangeReaders always dispatches the Red Team and, when the fix range has runtime lines, the native adversarial again even after Step 11 ran it, as main's scoped pass did. Every other full step plans the same readers as before. test/review-depth-lean.test.ts replays main's table frozen at 0408128 against this branch over the scoped-reachable grid main's GST-3562 grid never reached: docs, tests, code, risk and mixed fixtures x panels all, off and risk x light and standard depth (20 and 400 diff lines, and --depth-floor standard at 120 and 400) x fix ranges of 0, 1, 24 and 150 runtime lines x adversarialRan true and false x no numbers, unchanged numbers and changed numbers x targeted none or money x force none or security, with history fullPasses 1, last full, fixedBlocking true: 5,760 cases. 2,304 are kind g (576 each for docs, tests, code and mixed, all under panel all), where main planned a scoped pass and the branch plans a full pass; test/helpers/gst3562-replay.ts asserts per case that the full pass keeps a full-effort reader excluding nothing main's fix-check read and every other reader main dispatched (Red Team, native adversarial, outside voice, forced specialists by role, targeted), and that each specialist main dispatched is read by a branch specialist under its name or batched checklist that excludes no path main's specialist read. Forced specialists keep their paths: with rangeReaders and a force-included specialist, the batched specialist excludes no docs or outputs, as main's scoped pass dispatched each forced specialist with no exclusion. Pending Step 11 voices read the merge base on a full round 2: bin/gstack-review-dispatch pass, given --diff-base and no --adversarial-ran, stages the native adversarial and outside voice on the merge base (buildManifest's voiceBase in lib/review-pass.ts), where main's scoped pass kept them, while the Red Team and specialists read the range; once Step 11 has run they read the given --diff-base as before. 2,688 are kind a (lean-mode fix-checks already covered by GST-3562 A), and 768 (the risk fixture under panels all and risk, at full depth) plan the same as main. No case drops a reader, every case plans a full step, and none dispatches a fix-check. The existing GST-3562 A grid's counts are unchanged. ship/sections/review-army.md and ship/DRIVER.md: workflow prose only. The line #4781 added (run the scoped repeat's fix-check reader yourself beside the pass) becomes 'round 2 is always a full pass on the range, never a scoped one: every reader it plans is in the pass's manifest', and the scoped review-log row and the 'scoped is 3 too' decision line go, because nextStep no longer plans a scoped step; every reviewer brief cut from the section 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 c22610aa5..bf420becf 100644 --- a/test/helpers/gst3562-replay.ts +++ b/test/helpers/gst3562-replay.ts @@ -19,12 +19,15 @@ * 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). + * g. main planned a scoped pass after a small blocking fix; the branch plans a full pass on the same range that keeps main's + * readers the way kind a does, so no reader runs outside the pass record (GST-3562 part 3; Captain GStack Minder, 2026-11-24), + * and each specialist main dispatched is read by a branch specialist under its name or checklist excluding no more paths. */ 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' | 'f'; +export type Gst3562Kind = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g'; export function asMainBeforeGst3562(input: PlanInput, plan: ReviewPlan): { plan: ReviewPlan; kind?: Gst3562Kind } { const main = planReviewAt(input, mainNextStep); @@ -38,15 +41,21 @@ export function asMainBeforeGst3562(input: PlanInput, plan: ReviewPlan): { plan: : 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' + : was.step === 'scoped' && now.step === 'full' && now.reason.includes('never a scoped pass') ? 'g' : 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') { + if (kind === 'a' || kind === 'g') { 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))) : !plan.dispatches.some(p => p.role === d.role || (d.role === 'targeted' && p.role === 'adversarial-native' && !!p.classes?.length))); expect([h, plan.mode, lost]).toEqual([h, plan.mode, []]); } + if (kind === 'g') { + const unread = main.dispatches.filter(d => d.role === 'specialist' && !plan.dispatches.some(p => p.role === 'specialist' + && (p.name === d.name || !!p.checklists?.includes(d.name as never)) && p.exclude.every(e => d.exclude.includes(e)))); + expect([h, unread]).toEqual([h, []]); + } return { plan: main, kind }; } diff --git a/test/review-depth-lean.test.ts b/test/review-depth-lean.test.ts index 35a9bb4b3..4bd89ff67 100644 --- a/test/review-depth-lean.test.ts +++ b/test/review-depth-lean.test.ts @@ -195,6 +195,27 @@ describe('GST-3562 A no-loss replay across panels, prior rounds, round grants, t }); }); +describe('GST-3562 part 3 no-loss replay: round 2 after a small blocking fix is a full pass, never a scoped one', () => { + // Value: protects=rule 15's no-loss rule for review depth: every case where main at 0408128 planned a scoped pass (a blocking fix on a below-full diff with a fix range of at most 150 runtime lines) now plans a full pass that keeps main's full-effort reader, Red Team, native adversarial, outside voice, forced specialists and targeted reader; fails_when=the full round 2 skips a reader main's scoped pass dispatched (the adversarial "run once per invocation", the Red Team on a docs or tests diff) or a scoped step returns; + // why_new=GST-3562 part 3 (Captain GStack Minder, 2026-11-24); seam=planReview, asMainBeforeGst3562; no_claim=what the kept readers find + test('every scoped-reachable case is an allowed kind, and each scoped pass it replaces keeps its readers', () => { + const kinds: Record = {}; + const fixtures: Record = { docs: ['docs/a.md'], tests: ['test/a.test.ts'], code: ['src/app.ts'], risk: ['lib/billing.ts'], mixed: ['src/app.ts', 'docs/a.md'] }; + const counted = scanNumbers({ 'docs/a.md': ['recall 87% (26/30)'] }); + const depths = [{ diffLines: 20 }, { diffLines: 400 }, { diffLines: 120, floor: 'standard' as const }, { diffLines: 400, floor: 'standard' as const }]; + for (const [name, paths] of Object.entries(fixtures)) for (const panel of ['all', 'off', 'risk'] as const) for (const depth of depths) for (const rangeRuntimeLines of [0, 1, 24, 150]) for (const adversarialRan of [true, false]) + for (const reviewed of [undefined, 'same', 'stale'] as const) for (const targeted of [undefined, { classes: ['money'] }]) for (const force of [undefined, ['security']]) { + const numbers = reviewed ? counted : none; + const input = base({ paths, ...depth, numbers, ...(reviewed ? { reviewedNumbers: reviewed === 'same' ? counted.fingerprint : 'stale' } : {}), history: { fullPasses: 1, last: 'full', fixedBlocking: true, rangeRuntimeLines }, adversarialRan, ...(targeted ? { targeted } : {}), ...(force ? { force } : {}), shape: lean({ panel }) }); + const plan = planReview(input); + expect([name, panel, depth, plan.next.step, plan.dispatches.some(d => d.role === 'fix-check')]).toEqual([name, panel, depth, 'full', false]); + const { kind } = asMainBeforeGst3562(input, plan); + kinds[`${name}:${kind ?? 'same'}`] = (kinds[`${name}:${kind ?? 'same'}`] ?? 0) + 1; + } + expect(kinds).toEqual({ 'docs:a': 576, 'docs:g': 576, 'tests:a': 576, 'tests:g': 576, 'code:a': 576, 'code:g': 576, 'risk:a': 384, 'risk:same': 768, 'mixed:a': 576, 'mixed:g': 576 }); + }, 60_000); +}); + describe('C6 platform depth (FOUN-32, founderstar#496): a planned skip needs the platform review at the exact head', () => { test('runtime code never fits the platform depth, even with no runtime lines (a registered generated output, a mode-only change)', () => { const none = scanNumbers({}); diff --git a/test/review-depth.test.ts b/test/review-depth.test.ts index c122380f1..7f42be876 100644 --- a/test/review-depth.test.ts +++ b/test/review-depth.test.ts @@ -701,28 +701,23 @@ describe('review depth: diff commands and the rules hash', () => { }); }); -describe('D6: the scoped second pass after a blocking fix (GSTA-152 PR B)', () => { - const r = (p: ReturnType) => p.dispatches.map(d => `${d.role}:${d.name}`); +describe('D6 retired: round 2 after a small blocking fix is a full pass, never a scoped one (GSTA-152 PR B, GST-3562 part 3)', () => { + // Value: protects=Captain GStack Minder's 2026-11-24 ruling: after a blocking fix in round 1, round 2 is a full pass on the range planned through the normal manifest, keeping every reader main's scoped pass ran (the full-effort Red Team that excludes nothing, the native adversarial on a range with runtime lines, pending Step 11 voices, forced specialists, the outside voice when numbers changed) and dispatching no fix-check; fails_when=a scoped step or a fix-check dispatch returns, or the full round 2 drops one of those readers; + // why_new=GST-3562 part 3 (the scoped pass's fix-check ran outside the pass record, so its reply never reached verify or judge); seam=planReview; no_claim=what the readers find const fixed = (rangeRuntimeLines: number | null | undefined, o: Partial = {}): PlanInput['history'] => ({ fullPasses: 1, last: 'full', fixedBlocking: true, rangeRuntimeLines, ...o }); // gstack-evals#19: a standard diff, pass 1 fixed one CRITICAL from a QA probe, the fix range was 3 files +18/-6 of runtime. const n19 = (o: Partial = {}) => mixed({ perPath: per({ 'src/a.ts': 300, 'src/b.ts': 100, 'src/c.ts': 60, 'test/a.test.ts': 80 }), diffLines: 540, scope: { SCOPE_BACKEND: 'true' }, history: fixed(24), adversarialRan: true, ...o }); + const fixCheck = (p: ReturnType) => p.dispatches.some(d => d.role === 'fix-check'); - test('the #19 shape plans one fix-check, the Red Team and the native adversarial pass, not the specialist army', () => { - const before = planReview(n19({ history: { fullPasses: 1, last: 'full', fixedBlocking: true } })); - expect(before.next.step).toBe('full'); - expect(roles(before)).toEqual(['specialist:batched:medium', 'red-team:red-team:full']); + test('the #19 shape plans a full pass with the full-effort Red Team and the native adversarial again, never a fix-check', () => { const p = planReview(n19()); - expect(p.next.step).toBe('scoped'); - expect(p.next.reason).toContain('24 runtime lines'); - expect(r(p)).toEqual(['fix-check:fix-check', 'red-team:red-team', 'adversarial-native:adversarial']); - expect(p.dispatches.every(d => d.effort === 'full' && d.exclude.length === 0)).toBe(true); + expect(p.next).toMatchObject({ step: 'full', keepReader: true, rangeReaders: true, reason: expect.stringContaining('24 runtime lines in the fix range: full pass on the range, never a scoped pass') }); + expect(roles(p)).toEqual(['specialist:batched:medium', 'red-team:red-team:full', 'adversarial-native:adversarial:full']); + expect(fixCheck(p)).toBe(false); + expect(p.dispatches.some(d => d.role === 'red-team' && d.effort === 'full' && d.exclude.length === 0)).toBe(true); }); - test('Step 11 voices that have not run yet stay listed, as on a full pass 2', () => { - const p = planReview(n19({ adversarialRan: false })); - expect(r(p)).toEqual(['fix-check:fix-check', 'red-team:red-team', 'adversarial-native:adversarial', 'outside-voice:outside-voice']); - expect(p.skipped).toContain('specialists (scoped pass)'); - expect(planReview(n19()).skipped).toEqual(expect.arrayContaining(['specialists (scoped pass)', 'outside-voice (scoped pass)'])); - expect(planReview(n19({ force: ['security'] })).skipped).toContain('specialists (scoped pass; forced ones dispatched)'); + test('Step 11 voices that have not run yet stay listed, as on any full pass 2', () => { + expect(roles(planReview(n19({ adversarialRan: false })))).toEqual(['specialist:batched:medium', 'red-team:red-team:full', 'adversarial-native:adversarial:full', 'outside-voice:outside-voice:host']); }); test.each([ ['full depth (a gate tag)', { gateTagged: 1 }], @@ -738,25 +733,36 @@ describe('D6: the scoped second pass after a blocking fix (GSTA-152 PR B)', () = expect(p.dispatches.some(d => d.role === 'specialist')).toBe(true); }); test('a force-included specialist and changed published numbers keep their reviewers', () => { - expect(r(planReview(n19({ force: ['security'] })))).toEqual(['fix-check:fix-check', 'specialist:security', 'red-team:red-team', 'adversarial-native:adversarial']); + expect(batch(planReview(n19({ force: ['security'] })))).toContain('security'); const numbers = scanNumbers({ 'docs/bench.md': ['3x faster'] }); - expect(r(planReview(n19({ numbers, reviewedNumbers: 'old' })))).toContain('outside-voice:outside-voice (numbers changed)'); - expect(r(planReview(n19({ numbers, reviewedNumbers: numbers.fingerprint })))).not.toContain('outside-voice:outside-voice (numbers changed)'); + expect(roles(planReview(n19({ numbers, reviewedNumbers: 'old' })))).toContain('outside-voice:outside-voice (numbers changed):host'); + expect(roles(planReview(n19({ numbers, reviewedNumbers: numbers.fingerprint })))).not.toContain('outside-voice:outside-voice (numbers changed):host'); }); - test('150 is scoped, 151 is full, and a docs-only range is scoped without the native adversarial pass', () => { + // Value: protects=main's scoped pass dispatched a forced specialist on its own with no exclusion, so a forced checklist keeps reading the docs and outputs the batched reader would exclude; fails_when=a docs-only blocking fix with --force security plans a batched security reader that excludes the docs it should read; + // why_new=GST-3562 part 3 round-1 review (the forced security checklist read nothing on a docs-only fix); seam=planReview; no_claim=what the reader finds + test('a docs-only blocking fix with a forced specialist keeps its paths: the batched specialist carries it and excludes nothing', () => { + const p = planReview(mixed({ perPath: per({ 'docs/a.md': 40 }), diffLines: 40, history: fixed(0), adversarialRan: true, force: ['security'] })); + expect(p.next).toMatchObject({ step: 'full', rangeReaders: true }); + const spec = p.dispatches.filter(d => d.role === 'specialist'); + expect(spec.map(d => [d.name, d.checklists, d.exclude])).toEqual([['batched', ['security'], []]]); + const unforced = planReview(mixed({ perPath: per({ 'docs/a.md': 40, 'src/a.ts': 20 }), diffLines: 60, history: fixed(0), adversarialRan: true })); + expect(unforced.dispatches.find(d => d.role === 'specialist')!.exclude).not.toEqual([]); + }); + test('150 and 151 are both full; a range with no runtime lines keeps the Red Team without the native adversarial after Step 11', () => { expect(SCOPED_RANGE_LINES).toBe(150); - expect(planReview(n19({ history: fixed(150) })).next.step).toBe('scoped'); - expect(planReview(n19({ history: fixed(151) })).next.step).toBe('full'); + expect(planReview(n19({ history: fixed(150) })).next).toMatchObject({ step: 'full', rangeReaders: true }); + const wide = planReview(n19({ history: fixed(151) })); + expect([wide.next.step, wide.next.rangeReaders, fixCheck(wide)]).toEqual(['full', undefined, false]); const docs = planReview(n19({ history: fixed(0) })); - expect(docs.next.step).toBe('scoped'); - expect(r(docs)).toEqual(['fix-check:fix-check', 'red-team:red-team']); + expect([docs.next.step, fixCheck(docs)]).toEqual(['full', false]); + expect(roles(docs)).toEqual(['specialist:batched:medium', 'red-team:red-team:full']); }); - test('a light diff with a fixed blocker gets the scoped set: the raise adds the Red Team, never the standard army', () => { + test('a light diff with a fixed blocker gets the full pass at standard: the raise adds the Red Team', () => { const p = planReview(mixed({ perPath: per({ 'src/app.ts': 30 }), history: fixed(12), adversarialRan: true })); - expect(p.next.step).toBe('scoped'); - expect(r(p)).toEqual(['fix-check:fix-check', 'red-team:red-team', 'adversarial-native:adversarial']); + expect([p.next.step, p.stepDepth, fixCheck(p)]).toEqual(['full', 'standard', false]); + expect(roles(p)).toEqual(['specialist:batched:medium', 'red-team:red-team:full', 'adversarial-native:adversarial:full']); }); - test('the scoped pass counts toward the cap: a fix after it gets the read-only full review, and a blocker it leaves stops for the owner', () => { + test('the full round 2 counts toward the cap: a fix after it gets the read-only full review, a blocker it leaves stops for the owner, and an old scoped row still counts as a round', () => { expect(nextStep(fixed(10, { fullPasses: FULL_PASS_CAP }), 'standard')).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') }); expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', blockingOpen: true, rangeRuntimeLines: 10 }, 'light').step).toBe('stop'); const at = (m: number) => new Date(Date.UTC(2026, 9, 28, 10, m)).toISOString(); @@ -769,14 +775,14 @@ describe('D6: the scoped second pass after a blocking fix (GSTA-152 PR B)', () = expect(s.fix_checks).toBeUndefined(); expect(s.dispatches).toEqual({ specialist: 1, 'adversarial-native': 2, 'fix-check': 1, 'red-team': 1 }); }); - test('nextStep without a depth keeps the full pass (planReview is where depth is known)', () => { - expect(nextStep(fixed(10)).step).toBe('full'); - expect(nextStep(fixed(10), 'full').step).toBe('full'); - expect(nextStep(fixed(10), 'standard').step).toBe('scoped'); + test('nextStep never plans a scoped step: without a depth, at full and below full', () => { + for (const d of [undefined, 'full', 'standard', 'light'] as const) expect(nextStep(fixed(10), d).step).toBe('full'); + expect(nextStep(fixed(10), 'standard').rangeReaders).toBe(true); + expect(nextStep(fixed(10), 'full').rangeReaders).toBeUndefined(); }); - test('REVIEW_PLAN prints the chosen step and its reason', () => { + test('REVIEW_PLAN prints the full step and its reason', () => { const line = reviewPlanLine(planReview(n19()), 2); - expect(line).toMatch(/^REVIEW_PLAN: class=code pass=2 next=scoped dispatches=3 numbers=no fingerprint=none reason="[^"]*24 runtime lines[^"]*"$/); + expect(line).toMatch(/^REVIEW_PLAN: class=code pass=2 next=full dispatches=\d+ numbers=no fingerprint=none reason="[^"]*24 runtime lines[^"]*never a scoped pass[^"]*"$/); expect(reviewPlanLine(planReview(n19({ history: fixed(151) })), 2)).toContain('reason="a blocking finding was fixed'); }); test('DEPTH_RULES changes when the scoped-range constant does', () => { @@ -793,14 +799,12 @@ describe('D6: the scoped second pass after a blocking fix (GSTA-152 PR B)', () = expect(res.stdout.trim()).not.toBe(DEPTH_RULES); } finally { fs.rmSync(dir, { recursive: true, force: true }); } }); - test('consumers name the scoped step: the Step 9 template and the transitions table', () => { + test('consumers name the full round 2: the Step 9 template and the transitions table', () => { const tmpl = fs.readFileSync(path.join(ROOT, 'ship/sections/review-army.md.tmpl'), 'utf8'); expect(tmpl).toContain('--range-base $PASS_HEAD'); - expect(tmpl).toContain('`scoped` is 3 too.'); - expect(tmpl).toContain('"scope":"scoped"'); expect(tmpl).toContain('raised_by'); const policy = fs.readFileSync(path.join(ROOT, 'docs/review-policy.md'), 'utf8'); - expect(policy).toContain('| a full pass that fixed a blocking finding, below the cap, on a diff below full depth with a fix range of at most 150 runtime lines | scoped pass on the range |'); + expect(policy).toContain('| a full pass that fixed a blocking finding, below the cap, on a diff below full depth with a fix range of at most 150 runtime lines | full pass on the range (never a scoped pass, GST-3562)'); }); }); diff --git a/test/review-pass-program-steps.test.ts b/test/review-pass-program-steps.test.ts index 79a442ccc..95d26d9bd 100644 --- a/test/review-pass-program-steps.test.ts +++ b/test/review-pass-program-steps.test.ts @@ -215,9 +215,9 @@ describe('Capy pass program (fake host, real bins)', () => { expect(res).toContain('NEXT: judge (Phase 4)'); }, 240_000); - // Value: protects=the Capy pass program runs a scoped repeat with no fix-check files, dispatches its Red Team and leaves the fix-check to Step 3.5 as GST-619 does on the CLI; fails_when=the program stops a scoped plan for missing files or creates a fix-check reader in the scoped manifest; - // why_new=#3670 Step 11 (adversarial 1, red team 1), re-scoped to GST-619's model in the merge of main; seam=none; no_claim=the Step 3.5 fix-check itself - test('a scoped repeat runs without fixCheck files and leaves its fix-check to Step 3.5 (GST-619)', async () => { + // Value: protects=the Capy pass program runs the full round 2 that replaced the scoped pass with no fix-check files, plans no fix-check and dispatches the Red Team in the manifest (GST-3562 part 3); fails_when=the program stops the round for missing files, plans a fix-check, or leaves the Red Team out; + // why_new=#3670 Step 11 (adversarial 1, red team 1), re-scoped to GST-3562 part 3's full round 2; seam=none; no_claim=what the readers find + test('a full round 2 on a small fix range runs without fixCheck files, plans no fix-check and dispatches the Red Team (GST-3562 part 3)', async () => { const { dir, env } = repo(); 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(); @@ -225,31 +225,41 @@ describe('Capy pass program (fake host, real bins)', () => { const planFlags = ['--pass', '1', '--last', 'full', '--fixed-blocking', '--pass1-depth', 'standard', '--range-base', rangeBase]; const h = host(dir, env); const res = await runPass(h, { base: 'main', out: path.join(dir, '.state/run/s1'), pass: 'x22s1', diffBase: rangeBase, planFlags }); - expect(res).toContain('next=scoped'); + expect(res).toContain('next=full'); expect(res).not.toContain('STOP:'); - expect(res).toContain('FIX_CHECK: planned'); + expect(res).not.toContain('FIX_CHECK:'); expect(h.creates.map(c => c.title)).not.toContain('ship x22s1 fix-check'); expect(h.creates.map(c => c.title)).toContain('ship x22s1 red-team'); + const m = JSON.parse(fs.readFileSync(path.join(dir, '.state/run/s1/pass-manifest.json'), 'utf8')) as { readers: { role?: string }[] }; + expect(m.readers.some(r => r.role === 'red-team')).toBe(true); + expect(m.readers.some(r => r.role === 'fix-check')).toBe(false); }, 240_000); - // Value: protects=a scoped pass run through the Capy program as the driver now says, with no diffBase, gives the pending Step 11 voices the merge base and only the Red Team the fix range (GST-619); fails_when=the program sends a scoped pass a base of its own or the voices read the range before Step 11 ran; - // why_new=#3670 merge fix-check (row 454); the driver test "a scoped repeat pass passes no diffBase" is the failing-first half; seam=none; no_claim=an explicit --diff-base, which GST-619 lets win - test('a scoped pass run as the driver says keeps the merge base for the Step 11 voices; only the Red Team reads the fix range', async () => { + // Value: protects=a full round 2 run through the Capy program as the driver says (--diff-base RANGE_BASE) gives the Red Team and specialists the fix range, and the Step 11 voices that have not run yet the merge base, so they read the whole PR; once Step 11 ran (--adversarial-ran) the voices read the range; + // fails_when=a pending native adversarial or outside voice reads only the fix range, or a voice that already ran ignores --diff-base; why_new=GST-3562 part 3 round-1 second-model review (first-time Step 11 voices read only the fix range); seam=none; no_claim=what the readers find + test('a full round 2 run as the driver says reads the fix range, except pending Step 11 voices, which read the merge base until Step 11 has run', async () => { const { dir, env } = repo(); const sh = (c: string) => spawnSync('bash', ['-c', c], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 }); const mergeBase = sh('git merge-base main HEAD').stdout.trim(); const rangeBase = sh('git rev-parse HEAD').stdout.trim(); expect(sh('echo "export const fix = 2;" >> src/a.ts && git commit -qam fix').status).toBe(0); - const out = path.join(dir, '.state/run/s2'); + type M = { diff_base: string; readers: { role?: string; stage: string; diff_base?: string }[] }; + const at = (m: M, r: { diff_base?: string }) => r.diff_base ?? m.diff_base; const planFlags = ['--pass', '1', '--last', 'full', '--fixed-blocking', '--pass1-depth', 'standard', '--range-base', rangeBase]; - const res = await runPass(host(dir, env), { base: 'main', out, pass: 'x22s2', planFlags }); - expect(res).toContain('next=scoped'); - const m = JSON.parse(fs.readFileSync(path.join(out, 'pass-manifest.json'), 'utf8')) as { diff_base: string; readers: { role?: string; stage: string; diff_base?: string }[] }; - expect(m.diff_base).toBe(mergeBase); - expect(m.readers.find(r => r.role === 'red-team')!.diff_base).toBe(rangeBase); - const voices = m.readers.filter(r => r.stage === 'voices'); - expect(voices.length).toBeGreaterThan(0); - for (const v of voices) expect(v.diff_base ?? m.diff_base).toBe(mergeBase); + for (const [pass, flags, voiceBase] of [['x22s2', planFlags, mergeBase], ['x22s3', [...planFlags, '--adversarial-ran'], rangeBase]] as const) { + const out = path.join(dir, '.state/run', pass); + const res = await runPass(host(dir, env), { base: 'main', out, pass, diffBase: rangeBase, planFlags: [...flags] }); + expect(res).toContain('next=full'); + const m = JSON.parse(fs.readFileSync(path.join(out, 'pass-manifest.json'), 'utf8')) as M; + expect(m.diff_base).toBe(rangeBase); + expect(at(m, m.readers.find(r => r.role === 'red-team')!)).toBe(rangeBase); + const specialists = m.readers.filter(r => r.stage === 'specialists'); + expect(specialists.length).toBeGreaterThan(0); + for (const s of specialists) expect(at(m, s)).toBe(rangeBase); + const voices = m.readers.filter(r => r.role === 'adversarial-native' || r.role === 'outside-voice'); + expect(voices.length).toBeGreaterThan(0); + for (const v of voices) expect(at(m, v)).toBe(voiceBase); + } }, 240_000); // Value: protects=the program's final NEXT line survives a return that its reader outputs push to the 32 KB cap, and a pass whose out is not / says it skipped the parts; fails_when=finish() cuts the tail line, the room ignores the parts trailer, or parts are skipped without a line; diff --git a/test/review-pass.test.ts b/test/review-pass.test.ts index 84f260249..fcbc9a5d7 100644 --- a/test/review-pass.test.ts +++ b/test/review-pass.test.ts @@ -237,10 +237,10 @@ describe('the Capy skill loader', () => { }); -describe('a scoped pass after a blocker fix (GST-619)', () => { - // Value: protects=the pass command accepts the scoped plan gstack-review-plan writes after a blocking fix, invoked as GEVA-2 ran it: the Red Team reviews the fix range, Step 11's voices still pending keep the whole branch, the fix-check is named outside the manifest for Step 3.5, and a resumed pass names it again; fails_when=pass refuses the scoped plan, stages the Red Team on the merge base, stages pending Step 11 voices on the range, drops the fix-check silently, or puts it in the manifest; - // why_new=GEVA-82 on 1.91.379.0 hit BRIEF_RENDER_FAILED on every scoped pass and rendered briefs by hand; seam=none; no_claim=the fix-check's own brief - function scoped(flags: string[], explicitMergeBase = false) { +describe('round 2 after a small blocker fix is a full pass in the manifest (GST-619, GST-3562 part 3)', () => { + // Value: protects=the pass command plans the full round 2 gstack-review-plan writes after a small blocking fix, invoked as GEVA-2 ran it: every reader is in the manifest (the full-effort Red Team, the native adversarial, the pending outside voice), no fix-check is named outside it, a resumed pass resumes them, and --diff-base reaches every reader; fails_when=pass plans a scoped step again, names a fix-check outside the manifest whose reply never reaches verify or judge, or a reader ignores --diff-base; + // why_new=GST-3562 part 3 (Captain GStack Minder, 2026-11-24: the scoped pass's fix-check ran outside the pass record); GEVA-82 on 1.91.379.0 hit BRIEF_RENDER_FAILED on the scoped pass it replaces; seam=none; no_claim=what the readers find + function round2(flags: string[], diffBase?: 'merge' | 'range') { 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'); @@ -251,15 +251,15 @@ describe('a scoped pass after a blocker fix (GST-619)', () => { fs.mkdirSync(path.join(dir, '.state'), { recursive: true }); fs.writeFileSync(path.join(dir, '.state/plan.md'), 'Check the plan items against the fix.\n'); fs.writeFileSync(extras, JSON.stringify([{ name: 'plan', prompt_file: path.join(dir, '.state/plan.md') }])); - const args = ['pass', '--base', 'main', '--out', out, '--pass', 'p2', '--extras', extras, ...(explicitMergeBase ? ['--diff-base', mergeBase] : []), '--', '--pass', '1', '--last', 'full', '--pass1-depth', 'standard', '--fixed-blocking', ...flags, '--range-base', rangeBase.slice(0, 7)]; + const args = ['pass', '--base', 'main', '--out', out, '--pass', 'p2', '--extras', extras, ...(diffBase ? ['--diff-base', diffBase === 'merge' ? mergeBase : rangeBase] : []), '--', '--pass', '1', '--last', 'full', '--pass1-depth', 'standard', '--fixed-blocking', ...flags, '--range-base', rangeBase.slice(0, 7)]; const p = bin(dir, env, args); expect(p.status, p.stdout + p.stderr).toBe(0); - expect(p.stdout).toMatch(/^NEXT: scoped /m); - expect(p.stdout).toMatch(/^FIX_CHECK: planned effort=full \(Step 3\.5 runs it on its own; not in this manifest\)$/m); + expect(p.stdout).toMatch(/^NEXT: full .*never a scoped pass/m); + expect(p.stdout).not.toMatch(/^FIX_CHECK:/m); const mf = path.join(out, 'pass-manifest.json'); - return { dir, env, args, mf, mergeBase, rangeBase, m: JSON.parse(fs.readFileSync(mf, 'utf8')) as Manifest }; + return { dir, env, args, mf, mergeBase, rangeBase, stdout: p.stdout, m: JSON.parse(fs.readFileSync(mf, 'utf8')) as Manifest }; } - const settle = (s: ReturnType, stage: string) => { + const settle = (s: ReturnType, stage: string) => { if (stage !== 'specialists') expect(bin(s.dir, s.env, ['stage', '--manifest', s.mf, '--stage', stage]).status).toBe(0); const m = JSON.parse(fs.readFileSync(s.mf, 'utf8')) as Manifest; const reply = path.join(s.dir, '.state/reply.txt'); @@ -268,36 +268,28 @@ describe('a scoped pass after a blocker fix (GST-619)', () => { return JSON.parse(fs.readFileSync(s.mf, 'utf8')) as Manifest; }; - test('GEVA-2\'s invocation: the Red Team reads the fix range, the pending Step 11 voices read the whole branch, and the fix-check is named outside the manifest', () => { - const s = scoped([]); - expect(s.m.next).toBe('scoped'); + test('GEVA-2\'s invocation: every reader, the full-effort Red Team and the pending Step 11 voices included, is in the manifest, and no fix-check runs outside it', () => { + const s = round2([]); + expect(s.m.next).toBe('full'); expect(s.m.diff_base).toBe(s.mergeBase); - expect(s.m.readers.map(r => [r.reader, r.diff_base ?? null])).toEqual([['red-team', s.rangeBase], ['adversarial-native', null], ['outside-voice', null], ['audit/plan', null]]); - settle(s, 'specialists'); - const m = settle(s, 'red-team'); - const redTeam = fs.readFileSync(m.readers.find(r => r.reader === 'red-team')!.file!, 'utf8'); - expect(redTeam).toContain(s.rangeBase); - expect(redTeam).not.toContain(s.mergeBase); - expect(bin(s.dir, s.env, ['stage', '--manifest', s.mf, '--stage', 'voices']).status).toBe(0); - const voices = JSON.parse(fs.readFileSync(s.mf, 'utf8')) as Manifest; - const outsideBrief = voices.readers.find(r => r.reader === 'outside-voice')!.file!; - expect(fs.readFileSync(outsideBrief, 'utf8')).toContain(`The supplied branch diff is the file ${path.join(path.dirname(outsideBrief), 'outside-voice.diff')} `); - expect(fs.readFileSync(path.join(path.dirname(outsideBrief), 'outside-voice.diff'), 'utf8')).toContain('+export const v1 = 1;'); + expect(s.m.readers.map(r => [r.reader, r.diff_base ?? null])).toEqual([['specialist-batched', null], ['red-team', null], ['adversarial-native', null], ['outside-voice', null], ['audit/plan', null]]); + expect(s.m.readers.find(r => r.reader === 'red-team')).toMatchObject({ effort: 'full' }); + expect(s.m.readers.find(r => r.reader === 'red-team')!.exclude).toBeUndefined(); const again = bin(s.dir, s.env, s.args); expect(again.status, again.stdout + again.stderr).toBe(0); - expect(again.stdout).toMatch(/^FIX_CHECK: planned effort=full /m); - expect(again.stdout).toContain('readers=4 resumed'); + expect(again.stdout).not.toMatch(/^FIX_CHECK:/m); + expect(again.stdout).toContain(`readers=${s.m.readers.length} resumed`); }, 120_000); - test('after Step 11 ran (--adversarial-ran), the whole scoped pass reads the fix range', () => { - const s = scoped(['--adversarial-ran']); + test('after Step 11 ran (--adversarial-ran), the driver\'s --diff-base RANGE_BASE stages every reader on the fix range, the native adversarial included', () => { + const s = round2(['--adversarial-ran'], 'range'); expect(s.m.diff_base).toBe(s.rangeBase); - expect(s.m.readers.map(r => [r.reader, r.diff_base ?? null])).toEqual([['red-team', s.rangeBase], ['adversarial-native', null], ['audit/plan', null]]); + expect(s.m.readers.map(r => [r.reader, r.diff_base ?? null])).toEqual([['specialist-batched', null], ['red-team', null], ['adversarial-native', null], ['audit/plan', null]]); }, 120_000); - // Value: protects=an explicit --diff-base reaches every reader, the Red Team included; fails_when=a scoped pass asked to read the whole branch still stages its Red Team on the fix range; why_new=GST-738 (outside voice); seam=none; no_claim=none - test('an explicit --diff-base widens the scoped Red Team too (GST-738)', () => { - const s = scoped([], true); + // Value: protects=an explicit --diff-base reaches every reader, the Red Team included; fails_when=a round 2 asked to read the whole branch still stages its Red Team on the fix range; why_new=GST-738 (outside voice); seam=none; no_claim=none + test('an explicit --diff-base on the merge base widens the Red Team too (GST-738)', () => { + const s = round2([], 'merge'); expect(s.m.diff_base).toBe(s.mergeBase); const m = settle(s, 'specialists') && settle(s, 'red-team'); const redTeam = fs.readFileSync(m.readers.find(r => r.reader === 'red-team')!.file!, 'utf8'); diff --git a/test/review-plan-cli.test.ts b/test/review-plan-cli.test.ts index ba65c3fb7..0af3dbdd5 100644 --- a/test/review-plan-cli.test.ts +++ b/test/review-plan-cli.test.ts @@ -391,7 +391,7 @@ describe('gstack-review-plan: review depth', () => { }); }); -describe('gstack-review-plan: the scoped second pass (GSTA-152 D6)', () => { +describe('gstack-review-plan: the full round 2 on a small fix range (GSTA-152 D6, GST-3562 part 3)', () => { const code = (n: number, tag = 'v') => Array.from({ length: n }, (_, i) => `export const ${tag}${i} = ${i};`).join('\n') + '\n'; function fixed(lines: number): { r: { dir: string; state: string }; rangeBase: string } { const r = repo({ 'src/a.ts': code(80) }); @@ -403,17 +403,17 @@ describe('gstack-review-plan: the scoped second pass (GSTA-152 D6)', () => { } const pass2 = ['--pass', '1', '--last', 'full', '--fixed-blocking', '--adversarial-ran', '--pass1-depth', 'standard']; const full1 = ['--pass', '1', '--last', 'full', '--fixed-blocking', '--adversarial-ran', '--pass1-depth', 'full']; - test('--range-base with a small fix range plans NEXT: scoped with a fix-check and the Red Team, and counts it as pass 2', () => { + test('--range-base with a small fix range plans a full pass 2 with the batched specialist, the Red Team and the native adversarial, and no fix-check', () => { const { r, rangeBase } = fixed(24); const out = run(r, [...pass2, '--range-base', rangeBase]).stdout; - expect(out).toMatch(/^REVIEW_PLAN: class=code pass=2 next=scoped dispatches=3 /m); + expect(out).toMatch(/^REVIEW_PLAN: class=code pass=2 next=full dispatches=3 /m); expect(out).toContain(`FIX_RANGE: runtime_lines=24 base=${rangeBase}`); - expect(out).toMatch(/^NEXT: scoped \(a blocking finding was fixed on a light diff with 24 runtime lines in the fix range/m); - expect(out).toContain('DISPATCH: fix-check fix-check effort=full'); + expect(out).toMatch(/^NEXT: full \(a blocking finding was fixed on a light diff with 24 runtime lines in the fix range: full pass on the range, never a scoped pass, so every reader is in the pass record \(GST-3562\)\)$/m); + expect(out).not.toContain('DISPATCH: fix-check'); + expect(out).toMatch(/^DISPATCH: specialist batched effort=\S+ checklists=/m); expect(out).toContain('DISPATCH: red-team red-team effort=full'); expect(out).toContain('DISPATCH: adversarial-native adversarial effort=full'); - expect(out).not.toContain('DISPATCH: specialist'); - expect(JSON.parse(run(r, [...pass2, '--range-base', rangeBase, '--json']).stdout)).toMatchObject({ next: { step: 'scoped' }, fix_range: { base: rangeBase, runtime_lines: 24 } }); + expect(JSON.parse(run(r, [...pass2, '--range-base', rangeBase, '--json']).stdout)).toMatchObject({ next: { step: 'full', keepReader: true, rangeReaders: true }, fix_range: { base: rangeBase, runtime_lines: 24 } }); }); test('a 151-line range, no --range-base, an unknown range base and uncommitted fixes keep the full pass 2', () => { const big = fixed(151); diff --git a/test/ship-driver.test.ts b/test/ship-driver.test.ts index bf0ff3054..6777d5f75 100644 --- a/test/ship-driver.test.ts +++ b/test/ship-driver.test.ts @@ -189,12 +189,13 @@ describe('variant G: the call plan, observe budget, waits and audit readers (GST for (const text of [doc, capy]) expect(text).not.toMatch(/\b270 ?s\b|duration_seconds: 240|at most 240 s/); }); - // 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 and the read-only final review pass no diffBase, in the driver and the Capy skill', () => { + // Value: protects=the driver and the Capy skill give diffBase to a full repeat pass only, so the read-only final review reads the whole PR, and the driver plans no scoped repeat (every round 2 is full, GST-3562 part 3); fails_when=either text passes RANGE_BASE to every repeat pass again, or the driver names a scoped step again; + // why_new=#3670 merge fix-check (row 454): an explicit --diff-base wins in pass() (GST-619); GST-3562 part 3 retired the scoped pass; seam=none; no_claim=the parent's adherence + test('the read-only final review passes no diffBase and no repeat pass is scoped, in the driver and the Capy skill', () => { const f = flat(doc); 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).toContain('(`diffBase` RANGE_BASE on a `full` round 2 only, never on the `READ_ONLY:` final review, which reads the whole PR and takes no fix)'); + expect(phase).not.toContain('scoped'); expect(phase).not.toMatch(/`diffBase`: RANGE_BASE;/); const capy = flat(read('capy/skill/gstack/SKILL.md')); expect(capy).toContain('a full repeat pass, `diffBase: ""`'); @@ -206,7 +207,7 @@ describe('variant G: the call plan, observe budget, waits and audit readers (GST 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 a `full` round 2 only, never on a scoped pass or the `READ_ONLY:` final review', + '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 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 '); }); diff --git a/test/size-ledger/ship/round-two-is-always-a-full-review.json b/test/size-ledger/ship/round-two-is-always-a-full-review.json new file mode 100644 index 000000000..a377a90c6 --- /dev/null +++ b/test/size-ledger/ship/round-two-is-always-a-full-review.json @@ -0,0 +1,4 @@ +{ + "bytes": -327, + "why": "Round 2 after a blocking fix is always a full pass: the scoped-pass instructions are removed (GST-3562 part 3)" +}