/ship no longer reports zero blockers when the second-model review found one (GST-3075) (#4485)

When /ship stopped on a second-model review finding marked "Blocks:
yes", the record it left on the PR said no blockers were found; now the
finding is counted and /ship will not write that record until it is
fixed or ruled.

Why: `ready` and the merge step trust that record, so an undercount let
a blocked PR look clean.

Nothing to do: the next /ship run logs Step 11's findings and checks
them before writing.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: h2p1/red-team#1 reader=red-team
Review-Finding: h2p1/red-team#2 reader=red-team
Review-Finding: h2p1/red-team#3 reader=red-team
Review-Finding: v1/outside-voice#1 reader=outside-voice
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-18 12:51:14 +00:00
1 parent bbf48aa7ef
commit 07611a00a7
19 files changed
+190 -16

No files matched your search

@@ -1 +1 @@
{"sha":"72d45950b82d885fea5aa67a05b516912f54e5080ceeb360cfad44380b282dd0","replay":"GST-1821"}
{"sha":"18b1627a6886fe2e0f0e6cc80a33ac2ee138ac2c8996f51bcb68a108f281acb6","replay":"GST-3075"}
+1
View File
@@ -0,0 +1 @@
{"replay":"GST-3075","justification":"GST-3075 (a /ship record counts the second-model review's blockers): ship/sections/adversarial.md changes only Step 11's review-log persistence prose for the lead, the gstack-review-log call that records each voice attempt (it now adds via:ship and a FINDINGS array) and one FINDINGS bullet saying what that array holds and that an open blocker makes gstack-ship-receipt write refuse. No reviewer reads that prose. Deterministic no-loss check, no paid run: every brief body lib/review-brief.ts cuts from the ship sections keeps its pinned hash (test/fixtures/review-pins/brief-bodies unchanged; test/review-packets-removed.test.ts 'every reviewer brief cut from the ship sections is byte-identical to its pinned body' passes at this tree). No reader, depth, dispatch, brief, checklist or finding rule changes; CREW rule 15 exempts non-reviewer /ship prose."}
+2 -2
View File
@@ -21,8 +21,8 @@ describe('late defers from Step 11', () => {
{ skill: 'adversarial-review', via: 'ship', timestamp: '2026-10-26T10:25:00Z', findings: [{ fingerprint: 'd:1:w', blocking: true, action: 'deferred' }] },
];
const s = summarizeReviewLoop(rows, '2026-10-26T09:30:00Z');
expect(s).toEqual({ passes: 2, blocking_found: 3, deferred: 2, noted: 0, fixed: 1, scope: 'frozen', rounds: 2 });
expect(reviewLoopLine(s)).toBe('REVIEW_LOOP: passes=2 blocking_found=3 deferred=2 noted=0 fixed=1 scope=frozen');
expect(s).toEqual({ passes: 2, blocking_found: 4, deferred: 3, noted: 0, fixed: 1, scope: 'frozen', rounds: 2 });
expect(reviewLoopLine(s)).toBe('REVIEW_LOOP: passes=2 blocking_found=4 deferred=3 noted=0 fixed=1 scope=frozen');
expect(LATE_DEFER_SKILL).toBe('review-late-defer');
// A `review` row logged without a start token would be the newest review row and read UNVERIFIED; the late-defer row is not a diff review at all.
expect(reviewFreshness(late, 'abc')).toBeUndefined();
+3 -3
View File
@@ -381,16 +381,16 @@ describe('gstack-review-scope (bin)', () => {
{ skill: 'review', timestamp: '2026-10-26T10:40:00Z', findings: [{ fingerprint: 'e:1:v', blocking: true, action: 'fixed' }] },
];
fs.writeFileSync(path.join(logDir, `${branch}-reviews.jsonl`), rows.map(r => JSON.stringify(r)).join('\n') + '\n{not json\n');
const expected = { passes: 2, blocking_found: 2, deferred: 1, noted: 1, fixed: 1, scope: 'frozen', rounds: 2 };
const expected = { passes: 2, blocking_found: 3, deferred: 1, noted: 1, fixed: 1, scope: 'frozen', unrecorded: 1, rounds: 2 };
const out = path.join(repo.root, 'review-loop.json');
const r = runBin(repo, 'gstack-review-scope', ['summary', '--no-ledger', '--since', '2026-10-26T09:30:00Z', '--out', out, '--json']);
expect(r.status).toBe(EXIT.ok);
expect(r.err).toContain('REVIEW_LOOP: passes=2 blocking_found=2 deferred=1 noted=1 fixed=1 scope=frozen');
expect(r.err).toContain('REVIEW_LOOP: passes=2 blocking_found=3 deferred=1 noted=1 fixed=1 scope=frozen unrecorded=1');
expect(JSON.parse(r.out)).toEqual(expected);
expect(JSON.parse(fs.readFileSync(out, 'utf8'))).toEqual(expected);
const plain = runBin(repo, 'gstack-review-scope', ['summary', '--no-ledger', '--since', '2026-10-26T08:00:00Z']);
expect(plain.status).toBe(EXIT.ok);
expect(plain.out.trim()).toBe('REVIEW_LOOP: passes=3 blocking_found=3 deferred=1 noted=1 fixed=2 scope=frozen');
expect(plain.out.trim()).toBe('REVIEW_LOOP: passes=3 blocking_found=4 deferred=1 noted=1 fixed=2 scope=frozen unrecorded=1');
const noSince = runBin(repo, 'gstack-review-scope', ['summary', '--json']);
expect(noSince.status).toBe(EXIT.fail);
expect(noSince.err).toContain('(REVIEW_SCOPE_INPUT;');
+104
View File
@@ -0,0 +1,104 @@
/**
* GST-3075: a /ship receipt written at a stopped head read blocking_found=0 while the second-model review's
* `Blocks: yes` findings had stopped the run. Step 11's voice findings reached no review-log row (only a later
* Step 9 row carries queued Step 11 records, and a run that stops after Step 11 logs none), so
* `gstack-review-scope summary --no-ledger` counted nothing and write recorded the undercount.
* Synthetic fixture: one clean Step 9 pass, then the Step 11 row as /ship now logs it.
*/
import { afterEach, describe, expect, setDefaultTimeout, test } from 'bun:test';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { EXIT } from '../lib/headless-artifacts';
import { summarizeReviewLoop } from '../lib/review-scope';
import { extractReceipt, unruledOpenBlockers } from '../lib/ship-receipt';
import { cleanup, makeFixtureRepo, runBin, type FixtureRepo } from './helpers/restamp-fixture';
setDefaultTimeout(60_000);
const repos: FixtureRepo[] = [];
afterEach(() => { while (repos.length) cleanup(repos.pop()!); });
const SINCE = '2026-11-18T01:00:00Z';
const at = (min: number) => new Date(Date.parse(SINCE) + min * 60_000).toISOString();
const FP = 'src/auth.ts:42:security';
const review = (min: number, pass: number, findings: object[]) => ({ skill: 'review', via: 'ship', timestamp: at(min), status: findings.length ? 'issues_found' : 'clean', review_scope: 'frozen', pass, findings });
const voices = (min: number, findings: object[]) => ({ skill: 'adversarial-review', via: 'ship', timestamp: at(min), status: 'issues_found', source: 'outside-voice', phase: 'adversarial', gate: 'informational', completed: true, findings });
const blocker = { fingerprint: FP, severity: 'CRITICAL', blocking: true, raised_by: 'outside-voice', action: 'open' };
const belowFloor = { fingerprint: FP, severity: 'INFORMATIONAL', blocking: false, raised_by: 'outside-voice', action: 'noted' };
function branchWith(rows: object[]): FixtureRepo {
const repo = makeFixtureRepo({ prefix: 'gst3075-' });
repos.push(repo);
repo.git('checkout', '-qb', 'feat');
const slug = runBin(repo, 'gstack-slug', ['--get', 'SLUG']).out.trim();
const logDir = path.join(repo.home, 'projects', slug);
fs.mkdirSync(logDir, { recursive: true });
fs.writeFileSync(path.join(logDir, 'feat-reviews.jsonl'), rows.map(r => JSON.stringify(r) + '\n').join(''));
return repo;
}
/** /ship Step 19's two commands: the summary (--no-ledger, as ship/sections/pr-body.md runs it), then write. */
function summaryThenWrite(repo: FixtureRepo) {
const loopFile = path.join(repo.root, 'review-loop.json');
const s = runBin(repo, 'gstack-review-scope', ['summary', '--since', SINCE, '--no-ledger', '--out', loopFile]);
expect(s.status).toBe(EXIT.ok);
const body = path.join(repo.root, 'body.md');
fs.writeFileSync(body, '## Summary\n');
const w = runBin(repo, 'gstack-ship-receipt', ['write', '--pr', '42', '--base', 'main', '--session-kind', 'unattended', '--review-loop', '@' + loopFile, '--body', body]);
return { loop: JSON.parse(fs.readFileSync(loopFile, 'utf8')), w, body: fs.readFileSync(body, 'utf8') };
}
describe('GST-3075: the receipt counts the voices\' blockers and refuses one still open', () => {
test('a Blocks: yes voice finding left open at the stop counts in blocking_found, and write refuses with RECEIPT_BLOCKER_OPEN', () => {
const { loop, w, body } = summaryThenWrite(branchWith([review(0, 1, []), voices(20, [blocker])]));
expect(loop).toMatchObject({ passes: 1, blocking_found: 1, rounds: 1, open: [FP] });
expect(w.status).toBe(EXIT.refused);
expect(w.err).toContain('(RECEIPT_BLOCKER_OPEN; ');
expect(w.err).toContain('docs/troubleshooting.md#receipt-blocker-open)');
expect(w.err).toContain(FP);
expect(w.out).toBe('');
expect(body).toBe('## Summary\n');
});
test('negative control: a Blocks: no voice finding leaves blocking_found at 0 and the receipt is written', () => {
const { loop, w } = summaryThenWrite(branchWith([review(0, 1, []), voices(20, [belowFloor])]));
expect(loop).toMatchObject({ passes: 1, blocking_found: 0 });
expect(loop.open).toBeUndefined();
expect(w.status).toBe(EXIT.ok);
expect(extractReceipt(w.out).receipt).toMatchObject({ review_loop: { passes: 1, blocking_found: 0 } });
});
test('a voice blocker the next Step 9 pass fixed counts once as found and fixed, and the receipt is written', () => {
const { loop, w } = summaryThenWrite(branchWith([review(0, 1, []), voices(20, [blocker]), review(40, 2, [{ ...blocker, action: 'fixed' }])]));
expect(loop).toMatchObject({ passes: 2, blocking_found: 1, fixed: 1, rounds: 2 });
expect(loop.open).toBeUndefined();
expect(w.status).toBe(EXIT.ok);
expect(extractReceipt(w.out).receipt).toMatchObject({ review_loop: { blocking_found: 1, fixed: 1 } });
});
test('a voice row is never a pass or a round, a deferred or gate finding is not open, and an owner ruling closes one', () => {
const s = summarizeReviewLoop([review(0, 1, []), voices(20, [blocker, { fingerprint: 'a.ts:1:gate', severity: 'CRITICAL', blocking: true, gate: 'RH1', action: 'open' }]), { skill: 'review-late-defer', via: 'ship', timestamp: at(30), findings: [{ ...blocker, action: 'deferred' }] }], SINCE);
expect(s).toMatchObject({ passes: 1, rounds: 1, blocking_found: 2, deferred: 1 });
expect(s.open).toBeUndefined();
expect(unruledOpenBlockers({ open: [FP, 'p3/outside-voice#2'] }, [{ finding: FP }])).toEqual(['p3/outside-voice#2']);
expect(unruledOpenBlockers({ passes: 1 }, [])).toEqual([]);
});
test('a blocker a Step 9 row fixed and the next Step 11 row raised again stays open', () => {
const s = summarizeReviewLoop([review(0, 1, []), voices(20, [blocker]), review(40, 2, [{ ...blocker, action: 'fixed' }]), voices(60, [blocker])], SINCE);
expect(s).toMatchObject({ passes: 2, blocking_found: 1, open: [FP] });
});
test('a fix trailer from before the Step 11 row that raised the blocker again does not close it', () => {
const rows = [review(0, 1, [{ ...blocker, action: 'fixed' }]), voices(20, [blocker])];
const s = summarizeReviewLoop(rows, SINCE, [], [], [{ finding: FP, reader: 'outside-voice', commit: 'a'.repeat(40) }]);
expect(s).toMatchObject({ blocking_found: 1, fixed: 1, open: [FP] });
expect(summarizeReviewLoop([...rows, review(40, 2, [{ ...blocker, action: 'fixed' }])], SINCE).open).toBeUndefined();
});
test('a ruling on the fingerprint closes a blocker that carries a ledger id, and a ruling at another head does not', () => {
const s = summarizeReviewLoop([review(0, 1, []), voices(20, [{ ...blocker, ledger_id: 'p1/outside-voice#1' }])], SINCE);
expect(s.open).toEqual([{ id: 'p1/outside-voice#1', fingerprint: FP }]);
expect(unruledOpenBlockers({ open: s.open }, [{ finding: FP, head: 'abc' }], h => h === 'abc')).toEqual([]);
expect(unruledOpenBlockers({ open: s.open }, [{ finding: FP, head: 'old' }], h => h === 'abc')).toEqual(['p1/outside-voice#1']);
});
});
@@ -0,0 +1,4 @@
{
"bytes": 613,
"why": "GST-3075: Step 11's row logs via ship and its findings, so a voice blocker left open at a stop counts and the receipt write refuses"
}