Review and shipping tools: seven small fixes to exclusions, issue links, PR description checks, build outputs, known-red tests and telemetry (GST-3464) (#4672)

Fixes seven small bugs in the review and shipping tools: bad exclusion
keys now refuse, `Review-Finding:` lines are no longer issue references,
older commits' issue mentions name their commit, and wording checks skip
the PR's short opening lines.

A native binary the checkout builds at a path its committed `.gitignore`
names is no longer flagged as a download; the grouped-merge test gate
can read the list of tests already failing on main from a file; and
telemetry no longer logs a duplicate onboarding event when a run crosses
midnight.

Nothing to do; each fix has a test that fails on main.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: Davmunrey <108531295+Davmunrey@users.noreply.github.com>
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p2/red-team#1 reader=red-team
Review-Finding: p2/outside-voice#1 reader=outside-voice
Review-Finding: p2/outside-voice#2 reader=outside-voice
This commit is contained in:
authored and GitHub committed 2026-11-22 10:48:36 +00:00
1 parent 8ffd2b85f1
commit f7e16a54fc
19 files changed
+263 -22

No files matched your search

+11
View File
@@ -91,6 +91,17 @@ describe('an invalid exclusion list on the base is set aside, never loosened (GS
expect('code' in q && q.code).toBe('POLICY_INVALID');
}, 120_000);
// Value: protects=only the two exclusion keys themselves are set aside: an unknown key that merely starts with one of their names
// (review_exclude_paths[0]) is an error of its own and still refuses; fails_when=the key filter is unanchored and drops that key
// with the list; seam=lib/ship-policy.ts finish; no_claim=the wording of the refusal
test('an unknown key that starts with an exclusion key name still refuses', () => {
const repo = repoWith({ review_exclude_paths: patterns(65), 'review_exclude_paths[0]': 'data/**' });
const r = plan(repo);
expect(r.status).toBe(EXIT.refused);
expect(r.err).toContain('POLICY_INVALID');
expect(r.out).not.toContain('REVIEW_EXCLUDE: fallback');
}, 120_000);
// Value: protects=the merge step reads a base that fails only on its exclusion list, with its other keys, so the PR that fixes
// the list can land; fails_when=gstack-ship-queue refuses POLICY_INVALID on it; seam=loadBasePolicy; no_claim=land's checks
test('the queue reads such a base with its other keys', () => {
+50
View File
@@ -110,6 +110,56 @@ describe('review-sweep inventory diff', () => {
// Value: protects=a start walk that stopped at its bounds cannot tell a repository it never reached from a new one, so what the end walk finds past it is a note, never a quarantine;
// fails_when=a partial start turns pre-existing repositories into FETCH_VIOLATION and FETCH_RERUN_SPENT on runs where nobody fetched; why_new=ship-c-p1 specialist-batched#1 (CRITICAL); seam=sweepResult; no_claim=that a partial sweep sees every fetch
// Value: protects=a native executable the checkout's own build writes at a path its committed root .gitignore names exactly (bin/gstack-cso-core,
// GSTA-745) is printed as FETCH_IGNORED build-output, not a download; fails_when=a stage that builds the repo stops /ship with FETCH_VIOLATION, or
// the exemption lets through a download under an ignored directory or glob, a non-executable at that path, or a path a reader added to .gitignore;
// seam=inventory; no_claim=which reader built it
test('a native build output the committed .gitignore names exactly is ignored; every other new big file is still a download', async () => {
const root = tmp();
const checkout = path.join(root, 'checkout');
repoAt(checkout, 'https://github.com/me/app.git');
fs.writeFileSync(path.join(checkout, '.gitignore'), 'bin/gstack-cso-core\n/bin/gstack-cso-core.exe\ndist/\n*.tar\n');
const env = { ...process.env, GIT_AUTHOR_NAME: 't', GIT_AUTHOR_EMAIL: 't@example.invalid', GIT_COMMITTER_NAME: 't', GIT_COMMITTER_EMAIL: 't@example.invalid' };
expect(spawnSync('bash', ['-c', 'git add .gitignore && git commit -q -m base'], { cwd: checkout, encoding: 'utf8', env, timeout: 30_000 }).status).toBe(0);
fs.mkdirSync(path.join(checkout, 'bin')); fs.mkdirSync(path.join(checkout, 'dist'));
const start = inventory([root], checkout, []);
await Bun.sleep(30);
const big = (rel: string, head: number[]) => { const p = path.join(checkout, rel); fs.writeFileSync(p, Buffer.from(head)); fs.truncateSync(p, BIG_BYTES); return p; };
const elf = [0x7f, 0x45, 0x4c, 0x46];
const core = big('bin/gstack-cso-core', elf);
const exe = big('bin/gstack-cso-core.exe', [0x4d, 0x5a, 0x90, 0x00]);
const found = [big('dist/blob.bin', elf), big('bin/chats.tar', elf), big('bin/notes.txt', [0x68, 0x69, 0x0a, 0x0a])];
const r = sweepResult(start, inventory([root], checkout, []));
expect(r.found.map(f => f.path).sort()).toEqual([...found].sort());
expect([...r.ignored!].sort((a, b) => a.path < b.path ? -1 : 1)).toEqual([{ path: core, reason: 'build-output' as const }, { path: exe, reason: 'build-output' as const }]);
expect(ignoredLines('specialists', 1, r.ignored!)[0]).toContain('reason=build-output');
fs.rmSync(core); fs.writeFileSync(core, 'not a binary\n'); fs.truncateSync(core, BIG_BYTES);
fs.appendFileSync(path.join(checkout, '.gitignore'), 'bin/notes.txt\n');
const later = sweepResult(start, inventory([root], checkout, []));
expect(later.found.map(f => f.path).sort()).toEqual([...found, core, exe].sort());
expect(later.ignored ?? []).toEqual([]);
});
// Value: protects=a build output already on disk when a stage starts is never counted, as on main where it sat in start.big;
// fails_when=an uncommitted .gitignore edit or a git timeout at the end walk moves it from ignored to big and the stage is voided as FETCH_VIOLATION;
// why_new=ship-4672 p1/red-team#1; seam=sweepDiff; no_claim=files the stage itself wrote
test('a build output ignored at the start of a stage and big at its end is not a download', () => {
const core = '/r/checkout/bin/gstack-cso-core';
const start = { at: 1, roots: ['/r'], repos: {}, big: {}, ignored: { [core]: { reason: 'build-output' as const } } };
const r = sweepResult(start, { at: 2, roots: ['/r'], repos: {}, big: { [core]: BIG_BYTES }, ignored: {} });
expect([r.verdict, r.found]).toEqual(['clean', []]);
});
// Value: protects=only a build output is excused at its start path; fails_when=a fixture-marker or local-remote directory swapped for a big
// download at the same path reads clean; why_new=ship-4672 p2/outside-voice#1; seam=sweepDiff; no_claim=a build output replaced in place
test('an ignored directory swapped for a big file at the same path is still a download', () => {
for (const reason of ['fixture-marker', 'local-remote'] as const) {
const dir = '/r/fixtures/root';
const r = sweepResult({ at: 1, roots: ['/r'], repos: {}, big: {}, ignored: { [dir]: { reason } } }, { at: 2, roots: ['/r'], repos: {}, big: { [dir]: BIG_BYTES }, ignored: {} });
expect([r.verdict, r.found.map(f => f.path)]).toEqual(['violation', [dir]]);
}
});
test('a partial start inventory makes what the end walk finds a partial note, not a violation', () => {
const root = tmp();
const checkout = path.join(root, 'checkout');
+24
View File
@@ -32,6 +32,15 @@ describe('issue intent (pure)', () => {
// meaning; fails_when=the bare-#N rule reads the numbers as this repository's issues (Refs lines and fix-#N prompts for issues that do not exist here), or
// a closure, reference, filler or version word in the parentheses is taken for a repository name (the issue then vanishes from Refs and from the fix-#N
// offer as a phantom cross-repo reference); why_new=the intent tests cover owner/repo#N as the only cross form; seam=none; no_claim=none beyond protects
// Value: protects=/ship's Review-Finding trailer names a review ledger entry (p1/red-team#3) or a fingerprint, never an issue, so it adds no
// Refs line to the PR body (#4371); fails_when=the cross-repo owner/repo#N rule reads the ledger id as an issue in repository p1/red-team;
// seam=mentionsIn; no_claim=none beyond protects
test('a Review-Finding trailer is not an issue reference; the rest of the message still is (#4371)', () => {
const m = mentionsIn('fix: pre-landing review fixes (owner/other#9)\n\nReview-Finding: p1/red-team#3 reader=red-team\nreview-finding: p2/adversarial-native#3 reader=codex\nReview-Finding: lib/x.ts:10:correctness reader=core\n\nFixes #14\n');
expect(m.map(x => [x.repo ? `${x.repo}#${x.issue}` : `#${x.issue}`, x.intent])).toEqual([['owner/other#9', 'refs'], ['#14', 'fixes']]);
expect(renderIssueLines(resolveLinks(mentionsIn('fix\n\nReview-Finding: p1/red-team#3 reader=red-team\n'), [], () => true))).toEqual([]);
});
test('a parenthesised named reference is a cross-repo reference, never a same-repo Refs or promotion candidate', () => {
const named = mentionsIn('ship-queue: screen verdict from the run (gbrain #7625, #7606)\n\nPorts the fix from (gbrain PR #7630) and (acme/tools issue #4).\n');
expect(named.map(x => [x.repo ?? '', x.issue, x.intent])).toEqual([['gbrain', 7625, 'refs'], ['gbrain', 7606, 'refs'], ['gbrain', 7630, 'refs'], ['acme/tools', 4, 'refs']]);
@@ -99,6 +108,21 @@ describe('gstack-issue-links (bin)', () => {
});
// Value: protects=each reference line on stderr names the commit its mention came from; fails_when=entries after the first keep git log's
// trailing newline, so the older commit's label reads `commit :` with an empty id (#4378); why_new=the CLI tests ran one commit, whose entry
// has no leading newline; seam=none; no_claim=none beyond protects
test('labels a mention in an older commit with that commit, not an empty id', () => {
const repo = fixture();
const older = commit(repo, { 'lib/util.js': "exports.add = (a, b) => a + b + 0;\n" }, 'tidy\n\nRefs #11\n').slice(0, 12);
const newer = commit(repo, { 'lib/util.js': "exports.add = (a, b) => a + b + 1;\n" }, 'tidy again\n\nRefs #12\n').slice(0, 12);
const env = ghShim(repo, { issues: { '11': { title: 't', body: 'b', comments: [] }, '12': { title: 'u', body: 'c', comments: [] } } });
const r = runBin(repo, 'gstack-issue-links', ['--base', 'main'], env);
expect(r.status).toBe(EXIT.ok);
expect(r.err).toContain(`reference #11 ← commit ${older}: Refs #11`);
expect(r.err).toContain(`reference #12 ← commit ${newer}: Refs #12`);
expect(r.err).not.toContain('commit :');
});
test('a named-reference list in a commit is cross-repo, and Fixes owner/repo#N for this repository closes it (GST-2967)', () => {
const repo = fixture();
commit(repo, { 'lib/util.js': "exports.add = (a, b) => a + b + 0;\n" }, 'docs audit: stop halting on prose (founderstar #837, harness-evals #393)\n\nFixes owner/repo#14\n');
+39
View File
@@ -75,6 +75,45 @@ describe('checkReceiptProse', () => {
// GST-412: the `## Approvals` block gstack-approvals renders quotes the owner's words, which can hold
// numbers (`one Step 11 pass` read as a gate `pass` claim of 11). Only that rendered block is skipped.
describe('the opening above the first fold is not prose', () => {
// Value: protects=a result the PR is about, quoted in its plain opening (58 fixed with gstack), is not read as review_loop.fixed;
// fails_when=check-prose reports RECEIPT_PROSE_MISMATCH review_loop.fixed body=58 on a correct receipt (GSTA-687, #4598);
// seam=checkReceiptProse; no_claim=numbers inside a fold, which stay claims
test('numbers above the first fold are skipped; claims inside the folds and in a body with no fold are still checked', () => {
const opening = 'gstack shows no gain in bug fixes: 58 fixed with gstack, 61 of 99 without.\nWhy: the old page claimed a gain.\n\n';
const folded = opening + '<details><summary>Pre-Landing Review</summary>\n\nReview: 2 passes, 1 fixed.\n</details>\n';
expect(checkReceiptProse(receipt, folded)).toEqual({ checked: 2, mismatches: [] });
expect(checkReceiptProse(receipt, opening + '<details><summary>Notes</summary>\n\n58 fixed with gstack.\n</details>\n').mismatches).toEqual([{ field: 'review_loop.fixed', prose: 58, receipt: 1 }]);
expect(checkReceiptProse(receipt, opening).mismatches).toEqual([{ field: 'review_loop.fixed', prose: 58, receipt: 1 }]);
expect(checkReceiptProse(receipt, '```\n<details>\n```\n' + opening + '<details><summary>x</summary>\n</details>\n').mismatches).toEqual([{ field: 'review_loop.fixed', prose: 58, receipt: 1 }]);
});
// Value: protects=only an opening R76 allows (3 lines, 600 characters) is skipped; fails_when=a body that leaves its review section
// unfolded above a late fold hides every receipt counter claim from the check; why_new=ship-4672 p1/specialist-batched#1; seam=checkReceiptProse
test('an opening longer than R76 allows is still checked', () => {
const long = 'What changed.\n\n## Pre-Landing Review\nReview: 2 passes, 9 fixed.\nmore\n<details><summary>Agent notes</summary>\n</details>\n';
expect(checkReceiptProse(receipt, long).mismatches).toEqual([{ field: 'review_loop.fixed', prose: 9, receipt: 1 }]);
expect(checkReceiptProse(receipt, 'x'.repeat(601) + '\n9 fixed.\n<details><summary>n</summary>\n</details>\n').mismatches).toEqual([{ field: 'review_loop.fixed', prose: 9, receipt: 1 }]);
});
// Value: protects=the opening is measured as the PR body shape check measures it (comments and the Agent notes marker do not count);
// fails_when=a 3-line opening followed by the marker or a comment line is checked whole and its subject number refuses the receipt;
// why_new=ship-4672 p2/red-team#1; seam=checkReceiptProse; no_claim=bodies the shape check refuses
test('a 3-line opening followed by the Agent notes marker or a comment is still skipped', () => {
const opening = 'gstack shows no gain: 58 fixed with gstack.\nWhy: the old page claimed a gain.\nNothing to do.\n';
const notes = '<details><summary>Agent notes</summary>\n\nReview: 2 passes, 1 fixed.\n</details>\n';
expect(checkReceiptProse(receipt, opening + '<!-- gstack:agent-notes -->\n' + notes).mismatches).toEqual([]);
expect(checkReceiptProse(receipt, opening + '<!-- a note -->\n' + notes).mismatches).toEqual([]);
});
// Value: protects=a code block in the opening counts at its full length, as the shape check counts it; fails_when=an opening over R76 because of
// a fence collapses to one line and hides its counter claims; why_new=ship-4672 p2/outside-voice#2; seam=checkReceiptProse
test('an opening over R76 because of a code block is still checked', () => {
const body = 'What changed.\n```\na\nb\nc\n```\n9 fixed.\n<details><summary>n</summary>\n</details>\n';
expect(checkReceiptProse(receipt, body).mismatches).toEqual([{ field: 'review_loop.fixed', prose: 9, receipt: 1 }]);
});
});
describe('the rendered Approvals block is not prose', () => {
const lanes = { ...receipt, gate: { unit: { pass: 1181, fail: 0, skip: 3 } } };
const row = (words: string): ApprovalRow => ({
+14
View File
@@ -411,6 +411,20 @@ describe('.pending marker', () => {
expect(parseJsonl().map(e => e.outcome)).toEqual(['chromium-install', 'deps-missing']);
});
test('a run still on yesterday\'s date never deletes today\'s marker, so a later run today sends nothing (#4597)', () => {
setConfig('telemetry', 'community');
fs.writeFileSync(path.join(tmpDir, 'bin', 'date'), '#!/bin/sh\nif [ "$*" = "-u +%Y-%m-%d" ] && [ -n "$FAKE_DAY" ]; then echo "$FAKE_DAY"; else PATH=/usr/bin:/bin exec date "$@"; fi\n', { mode: 0o755 });
const one = `${BIN}/gstack-telemetry-log --event-type onboarding --skill _setup_playwright --outcome chromium-install --no-sweep`;
run(one, { FAKE_DAY: '2026-11-22' });
run(one, { FAKE_DAY: '2026-11-21' });
run(one, { FAKE_DAY: '2026-11-22' });
expect(parseJsonl().map(e => e.outcome)).toEqual(['chromium-install', 'chromium-install']);
const markers = fs.readdirSync(path.join(tmpDir, 'analytics')).filter(f => f.startsWith('.onboarding-')).sort();
expect(markers).toEqual(['.onboarding-_setup_playwright--chromium-install-2026-11-21', '.onboarding-_setup_playwright--chromium-install-2026-11-22']);
run(one, { FAKE_DAY: '2026-11-23' });
expect(fs.readdirSync(path.join(tmpDir, 'analytics')).filter(f => f.startsWith('.onboarding-'))).toEqual(['.onboarding-_setup_playwright--chromium-install-2026-11-23']);
});
test('concurrent setup runs record an onboarding step once', () => {
setConfig('telemetry', 'community');
const one = `${BIN}/gstack-telemetry-log --event-type onboarding --skill _setup_playwright --outcome chromium-install --no-sweep`;