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>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-24 08:52:13 +00:00
1 parent c34b967346
commit 7deee4292c
23 files changed
+216 -167

No files matched your search

+1 -1
View File
@@ -1 +1 @@
{"sha":"e6f1395136db91c611ec576795c27fb1cc360eb0318ce3a01d585e383d96c665","replay":"GST-3562-part-2"}
{"sha":"b66e114dbc579e17f6092678cfd385716583654bb06c0f17f4646ad87432276d","replay":"GST-3562-part-3"}
@@ -1 +1 @@
{"sha":"bcb16b5626ab4227c31224103ff77fe0ac7a57d9049701b5dbc4c8727038857f","replay":"GST-3562-part-2b"}
{"sha":"6ecc9565ecc639e867993a8db3dd12bb1c0d382cb46716b50c43ebd45afa4bde","replay":"GST-3562-part-3"}
@@ -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)."}
+11 -2
View File
@@ -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 };
}
+21
View File
@@ -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<string, number> = {};
const fixtures: Record<string, string[]> = { 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({});
+42 -38
View File
@@ -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<typeof planReview>) => 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']> = {}): 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<PlanInput> = {}) => 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<typeof planReview>) => 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)');
});
});
+27 -17
View File
@@ -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 <run dir>/<pass dir> 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;
+23 -31
View File
@@ -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<typeof scoped>, stage: string) => {
const settle = (s: ReturnType<typeof round2>, 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');
+7 -7
View File
@@ -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);
+6 -5
View File
@@ -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: "<RANGE_BASE>"`');
@@ -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 <rec>');
});
@@ -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)"
}