Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

Release check's docs-audit tests accept /ship's step for a stopped docs audit (GST-3569) (#4731)

Garry Tan50204fd64f80
diff --git a/changelog.d/fix-docsync-fixture-stopped-audit-flag.md b/changelog.d/fix-docsync-fixture-stopped-audit-flag.md
new file mode 100644
index 000000000..5fc954107
--- /dev/null
+++ b/changelog.d/fix-docsync-fixture-stopped-audit-flag.md
@@ -0,0 +1 @@
+**The release check's docs-audit tests accept /ship's step for a stopped docs audit again.** Three ship doc-sync cases failed the release check whenever the model followed /ship's instruction for a docs audit that stopped before its snapshot: the test fixture's audit snapshot left out the `--run` record that /ship always passes, and its command checker did not know the new flag. Nothing changes for users; this unblocks the stable release.
diff --git a/scripts/lib/windows-curation.ts b/scripts/lib/windows-curation.ts
index b87095b1b..575373f30 100644
--- a/scripts/lib/windows-curation.ts
+++ b/scripts/lib/windows-curation.ts
@@ -111,6 +111,10 @@ export const KNOWN_WINDOWS_INCOMPATIBLE: Array<{ file: string; reason: string }>
file: 'test/docsync-report-interface.test.ts',
reason: 'executes registered native documentation callbacks with their real Linux inotify write observer before the model boundary',
},
+ {
+ file: 'test/docsync-stopped-audit-snapshot.test.ts',
+ reason: 'spawns the installed bin/gstack-docs-candidate shebang script directly (Windows CreateProcess does not parse shebangs)',
+ },
{
file: 'test/setup-gbrain-fixture.test.ts',
reason: 'the fixture invokes real POSIX detector/verifier helpers through executable shebang wrappers',
diff --git a/test/docsync-stopped-audit-snapshot.test.ts b/test/docsync-stopped-audit-snapshot.test.ts
new file mode 100644
index 000000000..a822d8756
--- /dev/null
+++ b/test/docsync-stopped-audit-snapshot.test.ts
@@ -0,0 +1,81 @@
+import { afterAll, beforeAll, expect, test } from 'bun:test';
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import { spawnSync } from 'node:child_process';
+import { DOC_PATH, docsSnapshotArgv, fixtureDocs } from './helpers/docsync-fixture';
+import { docsCommandAllowed, docsToolFailures } from './helpers/docsync-observer';
+import { parseNDJSON, type SkillTestResult } from './helpers/session-runner';
+
+// Release gate census 45091322954 (main 79f3052f) and both bisects (45045564572, 45092795048) went red on
+// ship-docsync-recovery, -stale-before and -stale-after once /ship's docs steps named
+// `snapshot --carry-stopped <the stopped audit's Prepare snapshot>` (#4693, #4703). These are the parent's two post
+// snapshot commands from the stale-before rerun capture; <HOME> is the fixture home.
+const CAPTURED_45091322954 = [
+ '<HOME>/.claude/skills/gstack/bin/gstack-docs-candidate snapshot --out <HOME>/ship-docs-a2-post.json --audit-id ship-docs-a2 --mode edit --base 99d2eaf42c6e0e0da4f7da71760734a9f888b46f --select AGENTS.md --select CHANGELOG.md --select README.md --select TODOS.md --select VERSION --select app.ts --select handbook/reference/commands/widget.md.tmpl --select package.json --docs handbook --pre <HOME>/candidate-ship-docs-a2.json --carry-stopped <HOME>/candidate-ship-docs-a1.json',
+ '<HOME>/.claude/skills/gstack/bin/gstack-docs-candidate snapshot --out <HOME>/ship-docs-a2-post.json --audit-id ship-docs-a2 --mode edit --base 99d2eaf42c6e0e0da4f7da71760734a9f888b46f --select AGENTS.md --select CHANGELOG.md --select README.md --select TODOS.md --select VERSION --select app.ts --select handbook/reference/commands/widget.md.tmpl --select package.json --docs handbook --run <HOME>/ship-invocation.md --pre <HOME>/candidate-ship-docs-a2.json --carry-stopped <HOME>/candidate-ship-docs-a1.json',
+];
+
+let fixture: ReturnType<typeof fixtureDocs>;
+beforeAll(() => { fixture = fixtureDocs('updated'); });
+afterAll(() => fixture?.clean());
+
+function bashResult(command: string): SkillTestResult {
+ const parsed = parseNDJSON([
+ { type: 'assistant', parent_tool_use_id: null, message: { content: [
+ { type: 'tool_use', id: 'docs-command', name: 'Bash', input: { command, timeout: 10000 } },
+ ] } },
+ { type: 'user', parent_tool_use_id: null, message: { content: [
+ { type: 'tool_result', tool_use_id: 'docs-command', content: '', is_error: false },
+ ] }, tool_use_result: { stdout: '', stderr: '', interrupted: false, isImage: false } },
+ ].map(event => JSON.stringify(event)));
+ return { toolCalls: parsed.toolCalls, transcript: parsed.transcript, browseErrors: [], exitReason: 'success', duration: 0, output: '',
+ costEstimate: { inputChars: 0, outputChars: 0, estimatedTokens: 0, estimatedCost: 0, turnsUsed: 0 }, model: '', firstResponseMs: 0, maxInterTurnMs: 0 };
+}
+
+function snapshot(argv: string[]): { status: number | null; stderr: string } {
+ const run = spawnSync(argv[0]!, argv.slice(1), { cwd: fixture.repo, encoding: 'utf8', timeout: 30_000, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } });
+ return { status: run.status, stderr: run.stderr };
+}
+
+test('the captured --carry-stopped post snapshots are inside the declared interface', () => {
+ for (const captured of CAPTURED_45091322954) {
+ const command = captured.replaceAll('<HOME>', fixture.home);
+ expect(docsCommandAllowed(command, fixture), command).toBe(true);
+ expect(docsToolFailures(bashResult(command), fixture)).toEqual([]);
+ }
+});
+
+test('--carry-stopped still takes only a private .json under the fixture home', () => {
+ const head = CAPTURED_45091322954[1]!.replaceAll('<HOME>', fixture.home).replace(/ --carry-stopped \S+$/, '');
+ for (const value of ['candidate-ship-docs-a1.json', path.join(fixture.repo, 'a1.json'), path.join(fixture.home, 'a1.md'),
+ path.join(fixture.skills, 'a1.json'), '/etc/a1.json']) {
+ expect(docsCommandAllowed(`${head} --carry-stopped ${value}`, fixture), value).toBe(false);
+ }
+ expect(docsCommandAllowed(`${head} --carry-stopped`, fixture)).toBe(false);
+ expect(docsCommandAllowed(`${head} --carry-stopped ${fixture.home}/a1.json --carry-stopper ${fixture.home}/a1.json`, fixture)).toBe(false);
+});
+
+test('the fixture Prepare snapshot names the run, so a re-audit can carry a stopped audit as /ship says', () => {
+ const at = (name: string) => path.join(fixture.home, name);
+ const prepare = (id: string) => docsSnapshotArgv(fixture, id, at(`candidate-${id}.json`));
+ expect(prepare('a').slice(-2)).toEqual(['--run', fixture.invocation]);
+ const post = (argv: string[], id: string, extra: string[]) =>
+ [...argv.map(arg => arg === at(`candidate-${id}.json`) ? at(`${id}-post.json`) : arg), ...extra];
+
+ expect(snapshot(prepare('ship-docs-a1')).status).toBe(0);
+ fs.appendFileSync(path.join(fixture.repo, DOC_PATH), '\nEdited by an audit that stopped before its post snapshot.\n');
+ expect(snapshot(prepare('ship-docs-a2')).status).toBe(0);
+ const carried = snapshot(post(prepare('ship-docs-a2'), 'ship-docs-a2', ['--pre', at('candidate-ship-docs-a2.json'), '--carry-stopped', at('candidate-ship-docs-a1.json')]));
+ expect(carried).toEqual({ status: 0, stderr: '' });
+ const record = JSON.parse(fs.readFileSync(at('ship-docs-a2-post.json'), 'utf8'));
+ expect(record.earlier.map((e: { audit_id: string }) => e.audit_id)).toEqual(['ship-docs-a1']);
+ expect(Object.keys(record.earlier[0].edited)).toEqual([DOC_PATH]);
+
+ const unnamed = (id: string) => prepare(id).slice(0, -2);
+ expect(snapshot(unnamed('ship-docs-b1')).status).toBe(0);
+ expect(snapshot(unnamed('ship-docs-b2')).status).toBe(0);
+ const extra = ['--pre', at('candidate-ship-docs-b2.json'), '--carry-stopped', at('candidate-ship-docs-b1.json')];
+ expect(snapshot(post(unnamed('ship-docs-b2'), 'ship-docs-b2', extra)).stderr).toContain('--carry-stopped needs --pre and --run');
+ expect(snapshot(post(unnamed('ship-docs-b2'), 'ship-docs-b2', ['--run', fixture.invocation, ...extra])).stderr)
+ .toContain("is not this audit's Prepare snapshot (its audit id, HEAD or run differs)");
+});
diff --git a/test/helpers/docsync-fault-actor.ts b/test/helpers/docsync-fault-actor.ts
index c3161fdb7..f8cb3fa22 100644
--- a/test/helpers/docsync-fault-actor.ts
+++ b/test/helpers/docsync-fault-actor.ts
@@ -81,7 +81,7 @@ function stderrExcerpt(root: string, stderr: string): string {
*/
function installedSnapshot(s: DocsActorState, auditId: string, out: string): { record: DocsCandidateRecord; command: string } {
const repo = path.join(s.root, 'repo');
- const argv = docsSnapshotArgv({ repo, skills: path.join(s.root, '.claude/skills/gstack') }, auditId, out);
+ const argv = docsSnapshotArgv({ repo, skills: path.join(s.root, '.claude/skills/gstack'), invocation: path.join(s.root, 'ship-invocation.md') }, auditId, out);
const run = spawnSync(argv[0]!, argv.slice(1), { cwd: repo, encoding: 'utf8', timeout: SNAPSHOT_TIMEOUT_MS,
env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } });
const stderr = run.stderr || '';
diff --git a/test/helpers/docsync-observer.ts b/test/helpers/docsync-observer.ts
index 00f5c9860..80edaaed0 100644
--- a/test/helpers/docsync-observer.ts
+++ b/test/helpers/docsync-observer.ts
@@ -437,8 +437,8 @@ function literalDocsCommandAllowed(text: string, fixture: ReturnType<typeof fixt
if (rest[0] !== 'snapshot' || rest.length % 2 !== 1) return false;
const flags = rest.slice(1).filter((_, i) => i % 2 === 0);
const values = rest.slice(1).filter((_, i) => i % 2 === 1);
- return flags.every(flag => ['--out', '--audit-id', '--mode', '--base', '--select', '--docs', '--run', '--pre', '--carry'].includes(flag)) &&
- flags.filter(flag => flag === '--out').length === 1 && flags.every((flag, i) => !['--out', '--pre', '--carry'].includes(flag) || privateJson(values[i]));
+ return flags.every(flag => ['--out', '--audit-id', '--mode', '--base', '--select', '--docs', '--run', '--pre', '--carry', '--carry-stopped'].includes(flag)) &&
+ flags.filter(flag => flag === '--out').length === 1 && flags.every((flag, i) => !['--out', '--pre', '--carry', '--carry-stopped'].includes(flag) || privateJson(values[i]));
}
const marker = 'GSTACK_SESSION_KIND=spawned';
const start = path.join(fixture.skills, 'bin/gstack-skill-start').split(path.sep).join('/');
diff --git a/test/helpers/docsync-repo.ts b/test/helpers/docsync-repo.ts
index b98713fa1..23ac51c32 100644
--- a/test/helpers/docsync-repo.ts
+++ b/test/helpers/docsync-repo.ts
@@ -58,14 +58,15 @@ export interface DocsCandidateRecord {
/**
* The installed snapshot command for the fixture's audit selection: every tracked or new path except the
- * user's personal note, with the handbook docs root, against main's commit. Returned as argv; the first
- * element is the installed helper, so the command is the literal form the observation interface admits.
+ * user's personal note, with the handbook docs root, against main's commit, and the invocation record as its
+ * --run like /ship's Prepare. Returned as argv; the first element is the installed helper, so the command is
+ * the literal form the observation interface admits.
*/
-export function docsSnapshotArgv(fixture: { repo: string; skills: string }, auditId: string, out: string): string[] {
+export function docsSnapshotArgv(fixture: { repo: string; skills: string; invocation: string }, auditId: string, out: string): string[] {
const inventory = repoInventory(fixture.repo);
return [path.join(fixture.skills, 'bin/gstack-docs-candidate'), 'snapshot', '--out', out, '--audit-id', auditId,
'--mode', 'edit', '--base', gitAt(fixture.repo, 'rev-parse', 'main'),
- ...inventory.filter(p => p !== 'personal-note.txt').flatMap(p => ['--select', p]), '--docs', 'handbook'];
+ ...inventory.filter(p => p !== 'personal-note.txt').flatMap(p => ['--select', p]), '--docs', 'handbook', '--run', fixture.invocation];
}
/** Git blob id of content, the hash representation of `DocsCandidateRecord.hashes`. */