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
v1.93.2.0 GSTA-240 follow-up: native cookie cleanup waits for Edge to exit, plus three flaky-test repairs (#3805)
Garry Tan28d0fa8c5195
diff --git a/.gstack/pregate.json b/.gstack/pregate.jsonindex 74a99f1ad..6be73a295 100644--- a/.gstack/pregate.json+++ b/.gstack/pregate.json@@ -1,6 +1,6 @@{"$schema": "https://github.com/garrytan/gstack/docs/pregate.md#pregate-v1",- "runner": "bun test {files}",+ "runner": "bun test --timeout=30000 {files}","remote_gate": "bash scripts/ubicloud/pregate-remote.sh","dependencies": {".github/workflows/**": ["test/pregate-selection.test.ts", "test/free-tests-workflow-wiring.test.ts"],diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cac5ec077..98c26bd8f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,18 @@# Changelog+## [1.93.2.0] - 2026-11-02++**Native cookie import now waits for its browser to actually exit before it reports cleanup, and three more flaky tests from the 2026-11-01 flaky pass are repaired.** Windows drops a Job's process count to zero while terminated Edge processes are still shutting down and still hold the profile's files, so cleanup that trusted the count returned early and the next profile reset failed with a sharing violation.++### Fixed+- **`browse/src/cookie-import-native-job.ts`, `browse/src/cookie-import-native-worker.ts`, `browse/src/cookie-import-native.ts`**: the supervisor holds a handle to every process it sees in the import's Job and counts a process as active until that handle signals exit, not only until the Job's counter drops. The cleanup budget is now 20 s (was 5 s), because terminated Edge took up to 17.8 s to exit on a loaded Windows runner and 2 to 57 ms idle; an idle import returns as soon as its processes are gone. The parent's kill timer allows 2 s beyond that budget. Cleanup that still cannot confirm the exit reports `native_cleanup_failed`, as before. The real-Edge tests take their kill timers and time limits from the same constant.+- **`.gstack/pregate.json`**: the local pregate lane runs `bun test --timeout=30000 {files}`, the 30 s per-test timeout CI and the remote pregate already use, so a case that takes 5 s on a busy machine no longer fails only locally. The runner string is part of the pregate trust grant, so each machine records trust again on its first run after this change (the crew's remote pregate already passes `--allow-repo-commands`).+- **`test/gstack-ship-receipt.test.ts`**: the full `write` case, about 62 git calls, gets a 15 s timeout instead of bun's 5 s default.+- **`test/helpers/coverage-audit-evidence.ts`**: the plan-eng coverage audit detector credits complete reads placed by a literal `wc -c` byte count over in-cwd files, as it already did for `wc -l` (train gate 41209768188).++### Changed+- `test/helpers/docsync-contract.ts` names the missing `documentation_section` when a document-release completion fails the contract, so the next paid red says which field was absent.+## [1.93.1.0] - 2026-11-02- **`gstack-pregate clear --run-url` accepts a reusable-workflow lane's caller run.** A lane whose workflow file runs only through `workflow_call` (gbrain's `native-locks.yml`, run as a job of `test.yml`) was refused `workflow_mismatch` for every run since v1.92.62.0, because GitHub reports the caller's file as the run's workflow. A run of a workflow in the branch's own `.github/workflows/` with a job that says `uses: ./.github/workflows/<lane workflow>` now clears the lane, a job link inside that run too, as long as the lane's own job succeeded under the calling job (`<calling job> / <lane job>`, else `caller_job_skipped`), with callers read at pregate.json's recorded tree; the red and unfinished-run refusals still apply. Fix lines only suggest `gh workflow run` for a file with a `workflow_dispatch` trigger; otherwise they name the callers. An unrelated workflow still refuses. `test/pregate-clear-runs.test.ts` failed before the fix (GST-971).diff --git a/VERSION b/VERSIONindex a14f16fac..07854d86f 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.93.1.0+1.93.2.0diff --git a/agents-digest/gstack-AGENTS.md b/agents-digest/gstack-AGENTS.mdindex 79935aa44..fe4bb1956 100644--- a/agents-digest/gstack-AGENTS.md+++ b/agents-digest/gstack-AGENTS.md@@ -1,4 +1,4 @@-# gstack digest v1.93.1.0 — regenerate/re-copy after upgrading gstack+# gstack digest v1.93.2.0 — regenerate/re-copy after upgrading gstackBehavioral rules from gstack (https://github.com/garrytan/gstack), compressedfor agent hosts without a full skill install. The full skills add workflows,diff --git a/browse/src/cookie-import-native-job.ts b/browse/src/cookie-import-native-job.tsindex 60c678d2f..429024c6e 100644--- a/browse/src/cookie-import-native-job.ts+++ b/browse/src/cookie-import-native-job.ts@@ -47,6 +47,8 @@ export function parseNativeCookieDiagnostic(value: unknown): NativeCookieDiagnosreturn diagnostic;}+export const NATIVE_CLEANUP_MS = 20_000;+export interface NativeCookieJob {name: string;terminate(): void;@@ -64,10 +66,13 @@ export async function createNativeCookieJob(): Promise<NativeCookieJob> {let stage: NativeCookieDiagnostic['stage'] = 'job_create';let handle: number | bigint = 0;let closed = false;+ const held = new Map<number, number | bigint>();const close = () => {if (closed) return;closed = true;try {+ for (const member of held.values()) api.CloseHandle(member);+ held.clear();if (handle && !api.CloseHandle(handle)) throw new NativeCookieJobError('job_close', api.GetLastError());} finally {closeLibrary();@@ -93,7 +98,25 @@ export async function createNativeCookieJob(): Promise<NativeCookieJob> {const accounting = Buffer.alloc(48);if (closed) throw new NativeCookieJobError('job_query');if (!api.QueryInformationJobObject(handle, 1, ptr(accounting), accounting.byteLength, null)) throw new NativeCookieJobError('job_query', api.GetLastError());- return accounting.readUInt32LE(40);+ const listed = Buffer.alloc(8 + 8 * 1024);+ if (!api.QueryInformationJobObject(handle, 3, ptr(listed), listed.byteLength, null)) throw new NativeCookieJobError('job_query', api.GetLastError());+ for (let index = 0; index < Math.min(listed.readUInt32LE(4), 1024); index++) {+ const pid = Number(listed.readBigUInt64LE(8 + 8 * index));+ if (held.has(pid)) continue;+ const member = api.OpenProcess(0x00101000, 0, pid);+ if (!member) continue;+ const inJob = Buffer.alloc(4);+ if (api.IsProcessInJob(member, handle, ptr(inJob)) && inJob.readInt32LE(0) !== 0) held.set(pid, member);+ else api.CloseHandle(member);+ }+ let running = 0;+ for (const [pid, member] of held) {+ const state = api.WaitForSingleObject(member, 0);+ if (state === 0x102) running++;+ else if (state === 0) { api.CloseHandle(member); held.delete(pid); }+ else throw new NativeCookieJobError('job_query', api.GetLastError());+ }+ return Math.max(accounting.readUInt32LE(40), running);},close,};@@ -150,6 +173,8 @@ async function openKernel() {QueryInformationJobObject: { args: [FFIType.u64, FFIType.u32, FFIType.ptr, FFIType.u32, FFIType.ptr], returns: FFIType.i32 },AssignProcessToJobObject: { args: [FFIType.u64, FFIType.u64], returns: FFIType.i32 },OpenProcess: { args: [FFIType.u32, FFIType.i32, FFIType.u32], returns: FFIType.u64 },+ IsProcessInJob: { args: [FFIType.u64, FFIType.u64, FFIType.ptr], returns: FFIType.i32 },+ WaitForSingleObject: { args: [FFIType.u64, FFIType.u32], returns: FFIType.u32 },TerminateJobObject: { args: [FFIType.u64, FFIType.u32], returns: FFIType.i32 },CloseHandle: { args: [FFIType.u64], returns: FFIType.i32 },GetLastError: { args: [], returns: FFIType.u32 },diff --git a/browse/src/cookie-import-native-worker.ts b/browse/src/cookie-import-native-worker.tsindex 1d04e2afe..e23ca8d6f 100644--- a/browse/src/cookie-import-native-worker.ts+++ b/browse/src/cookie-import-native-worker.ts@@ -1,7 +1,7 @@import { spawn } from 'node:child_process';import { createInterface } from 'node:readline';import { writeSync } from 'node:fs';-import { createNativeCookieJob, joinNativeCookieJob, nativeCookieDiagnostic, parseNativeCookieDiagnostic, type NativeCookieDiagnostic, type NativeCookieJob } from './cookie-import-native-job';+import { createNativeCookieJob, joinNativeCookieJob, NATIVE_CLEANUP_MS, nativeCookieDiagnostic, parseNativeCookieDiagnostic, type NativeCookieDiagnostic, type NativeCookieJob } from './cookie-import-native-job';import type { PlaywrightCookie } from './cookie-import-browser';import { emptyBunConfig } from './bun-child-config';@@ -114,11 +114,11 @@ export async function superviseNativeCookieImport(void member.closed.then(() => { closed = true; }, () => { closed = true; });while (!reply && !closed && now() < deadline && !dependencies.signal?.aborted) await sleep(Math.min(20, deadline - now()));reply ??= { error: now() >= deadline ? 'native_timeout' : 'native_failed' };- const cleanupDeadline = now() + 5_000;+ const cleanupDeadline = now() + NATIVE_CLEANUP_MS;const graceDeadline = now() + ('cookies' in reply ? 2_000 : 0);- while ((!closed || job.activeProcesses() !== 0) && now() < graceDeadline) await sleep(20);+ while ((job.activeProcesses() !== 0 || !closed) && now() < graceDeadline) await sleep(20);if (job.activeProcesses() !== 0) job.terminate();- while ((!closed || job.activeProcesses() !== 0) && now() < cleanupDeadline) await sleep(20);+ while ((job.activeProcesses() !== 0 || !closed) && now() < cleanupDeadline) await sleep(20);if (!closed || job.activeProcesses() !== 0) return { error: 'native_cleanup_failed' };return reply;} catch (error) {diff --git a/browse/src/cookie-import-native.ts b/browse/src/cookie-import-native.tsindex 7632300a6..d0118c7e0 100644--- a/browse/src/cookie-import-native.ts+++ b/browse/src/cookie-import-native.ts@@ -6,6 +6,7 @@ import path from 'node:path';import { CookieImportError, normalizeCookieDomain, type PlaywrightCookie } from './cookie-import-browser';import { emptyBunConfig, findWindowsBunExe } from './bun-child-config';import { hashNativeFile, nativeCodeHashes, nativeCodeMatches, readNativeQualifications, type NativeQualifiedBuild } from './cookie-import-native-integrity';+import { NATIVE_CLEANUP_MS } from './cookie-import-native-job';type BrowserName = 'Chrome' | 'Chromium' | 'Brave' | 'Edge';@@ -123,7 +124,7 @@ export async function importNativeCookies(options: {const timer = setTimeout(() => {worker.kill();reject(new CookieImportError('Native cookie cleanup could not be confirmed within its deadline.', 'native_cleanup_failed'));- }, Math.max(0, deadline + 5_000 - Date.now()));+ }, Math.max(0, deadline + NATIVE_CLEANUP_MS + 2_000 - Date.now()));worker.stdout.setEncoding('utf8');worker.stdout.on('data', chunk => {output += chunk;diff --git a/browse/test/cookie-import-native-job.test.ts b/browse/test/cookie-import-native-job.test.tsindex 44b068d52..c835f3751 100644--- a/browse/test/cookie-import-native-job.test.ts+++ b/browse/test/cookie-import-native-job.test.ts@@ -10,7 +10,7 @@ import { Database } from 'bun:sqlite';import { dlopen, FFIType, ptr } from 'bun:ffi';import { nativeBrowserPaths } from '../src/cookie-import-native';import { NATIVE_BROWSER_VERSION_COMMAND } from '../src/cookie-import-native-integrity';-import { createNativeCookieJob, joinNativeCookieJob, NativeCookieJobError, nativeCookieDiagnostic, parseNativeCookieDiagnostic, type NativeCookieJob } from '../src/cookie-import-native-job';+import { createNativeCookieJob, joinNativeCookieJob, NATIVE_CLEANUP_MS, NativeCookieJobError, nativeCookieDiagnostic, parseNativeCookieDiagnostic, type NativeCookieJob } from '../src/cookie-import-native-job';import { nativeCookieEnvironment, NATIVE_COOKIE_NODE_SCRIPT, superviseNativeCookieImport, type NativeCookieMember, type NativeCookieReply, type NativeCookieRequest } from '../src/cookie-import-native-worker';import { decodeNativeCommandLine } from './fixtures/native-cookie-process-observer';import { createFixtureDeleteLease, FixtureDeleteError } from './fixtures/native-cookie-delete-lease';@@ -334,6 +334,8 @@ afterAll(() => {}}, 15_000);+const NATIVE_SUPERVISOR_MS = 25_000 + NATIVE_CLEANUP_MS;+const request: NativeCookieRequest = {nodeExecutable: 'C:\\fixture\\node.exe',nodeArchitecture: process.arch,@@ -349,6 +351,8 @@ const request: NativeCookieRequest = {function kernelContract(mode: string) {const script = `const calls = [];+ const polls = {};+ let listings = 0;globalThis.__nativeCookieFfi = {FFIType: { ptr: 'ptr', u64: 'u64', u32: 'u32', i32: 'i32' },ptr: buffer => buffer,@@ -358,8 +362,18 @@ function kernelContract(mode: string) {CreateJobObjectW: (security, name) => { calls.push(['create', security, name.toString('utf16le')]); return 42; },OpenJobObjectW: (access, inherit, name) => { calls.push(['open', access, inherit, name.toString('utf16le')]); return 42; },SetInformationJobObject: (handle, kind, buffer, length) => { calls.push(['limits', handle, kind, length, buffer.readUInt32LE(16)]); return 1; },- QueryInformationJobObject: (handle, kind, buffer, length) => { calls.push(['query', handle, kind, length]); buffer.writeUInt32LE(3, 40); return 1; },- OpenProcess: (access, inherit, pid) => { calls.push(['open-process', access, inherit, pid === process.pid]); return 999; },+ QueryInformationJobObject: (handle, kind, buffer, length) => {+ calls.push(['query', handle, kind, length]);+ if (kind === 1) buffer.writeUInt32LE(${mode === 'exiting' ? 0 : 3}, 40);+ if (kind === 3 && ${JSON.stringify(mode)} === 'exiting' && listings++ === 0) {+ buffer.writeUInt32LE(3, 4);+ [101, 102, 103].forEach((pid, index) => buffer.writeBigUInt64LE(BigInt(pid), 8 + 8 * index));+ }+ return 1;+ },+ OpenProcess: (access, inherit, pid) => { calls.push(['open-process', access, inherit, pid === process.pid]); return ${mode === 'exiting' ? '1000 + pid' : 999}; },+ IsProcessInJob: (member, job, result) => { calls.push(['in-job', member, job]); result.writeInt32LE(member === 1103 ? 0 : 1, 0); return 1; },+ WaitForSingleObject: (member, milliseconds) => { calls.push(['wait', member, milliseconds]); polls[member] ??= member - 1100; return polls[member]-- > 0 ? 0x102 : 0; },AssignProcessToJobObject: (job, process) => { calls.push(['assign', job, process]); return ${mode === 'join-fail' ? 0 : 1}; },TerminateJobObject: (job, code) => { calls.push(['terminate', job, code]); return 1; },CloseHandle: handle => { calls.push(['close', handle]); return 1; },@@ -378,6 +392,11 @@ function kernelContract(mode: string) {const active = job.activeProcesses();job.terminate(); job.close(); job.close();console.log(JSON.stringify({ name: job.name, active, calls }));+ } else if (${JSON.stringify(mode)} === 'exiting') {+ const job = await createNativeCookieJob();+ const active = [job.activeProcesses(), job.activeProcesses(), job.activeProcesses()];+ job.close();+ console.log(JSON.stringify({ active, calls }));} else {let error, diagnostic;try { await joinNativeCookieJob('Local\\\\gstack-cookie-12345678-1234-1234-1234-123456789abc'); } catch (caught) { error = caught.message; diagnostic = caught.diagnostic; }@@ -416,6 +435,15 @@ describe('production Windows Job Object API contract', () => {expect(result.calls.filter((call: unknown[]) => call[0] === 'close')).toEqual([['close', 42]]);});+ test('a member the Job no longer counts stays active until its process handle signals exit', () => {+ const result = kernelContract('exiting');+ expect(result.active).toEqual([2, 1, 0]);+ expect(result.calls).toContainEqual(['query', 42, 3, 8 + 8 * 1024]);+ expect(result.calls).toContainEqual(['open-process', 0x00101000, 0, false]);+ expect(result.calls.filter((call: unknown[]) => call[0] === 'in-job')).toEqual([['in-job', 1101, 42], ['in-job', 1102, 42], ['in-job', 1103, 42]]);+ expect(result.calls.filter((call: unknown[]) => call[0] === 'close')).toEqual([['close', 1103], ['close', 1101], ['close', 1102], ['close', 42]]);+ });+test('member assigns its own handle, never a discovered PID', () => {const result = kernelContract('join');expect(result.error).toBeUndefined();@@ -921,10 +949,36 @@ describe('owned native-cookie lifecycle', () => {expect(now).toBeLessThan(30_000);});+ test('cleanup waits for a member that is still exiting after the Job count reads zero', async () => {+ let now = 0;+ let held = false;+ let settleReply!: (reply: NativeCookieReply) => void;+ let settleClose!: () => void;+ const result = await superviseNativeCookieImport(request, {+ now: () => now,+ sleep: async milliseconds => {+ now += milliseconds;+ if (now >= 20) settleReply({ cookies: [] });+ if (now >= 200) settleClose();+ },+ createJob: async () => ({+ name: 'synthetic-owned-job', close() {}, terminate() {},+ activeProcesses: () => {+ if (now < 100) held = true;+ return now < 100 || (held && now < 5_000) ? 1 : 0;+ },+ }),+ startMember: () => ({ result: new Promise(resolve => { settleReply = resolve; }), closed: new Promise(resolve => { settleClose = resolve; }), stop() {} }),+ });+ expect(result).toEqual({ cookies: [] });+ expect(now).toBeGreaterThanOrEqual(5_000);+ expect(now).toBeLessThan(NATIVE_CLEANUP_MS);+ });+test('unconfirmed termination is reported as cleanup failure, never success', async () => {const run = simulation({ retainAfterTerminate: true });expect(await run.run).toEqual({ error: 'native_cleanup_failed' });- expect(run.state()).toMatchObject({ time: 30_000, terminated: 1, stopped: 1, jobClosed: 1 });+ expect(run.state()).toMatchObject({ time: 25_000 + NATIVE_CLEANUP_MS, terminated: 1, stopped: 1, jobClosed: 1 });});test('a process crash cannot strand remaining members', async () => {@@ -1029,11 +1083,11 @@ function safeLaunchEvidence(file: string): object {}function nativeSupervisor(input: NativeCookieRequest, env: NodeJS.ProcessEnv) {- const cleanupDeadline = performance.now() + 30_000;+ const cleanupDeadline = performance.now() + NATIVE_SUPERVISOR_MS;const child = ownFixtureChild(spawn(process.execPath, ['--no-env-file', '--no-install', '--no-macros', '--config=NUL', path.resolve(import.meta.dir, '../src/cookie-import-native-worker.ts')], { env, stdio: ['pipe', 'pipe', 'ignore'], windowsHide: true }));let output = '';child.stdout.on('data', chunk => { output += chunk; });- const timer = setTimeout(() => child.kill(), 30_000);+ const timer = setTimeout(() => child.kill(), NATIVE_SUPERVISOR_MS);const done = new Promise<NativeCookieReply>((resolve, reject) => {child.once('error', reject);child.once('close', () => {@@ -1131,7 +1185,7 @@ describe('native Windows process qualification', () => {}for (const parent of createdParents.reverse()) rmdirSync(parent);}- }, 65_000);+ }, 2 * NATIVE_SUPERVISOR_MS + 5_000);test.skipIf(process.platform !== 'win32')('a locked real Edge profile leaves its existing owner alive', async () => {const node = Bun.which('node');@@ -1166,7 +1220,7 @@ describe('native Windows process qualification', () => {await contender?.done.catch(() => {});await owner.done.catch(() => {});}- }, 65_000);+ }, 2 * NATIVE_SUPERVISOR_MS + 5_000);for (const mode of ['normal-close', 'stalled-close']) {test.skipIf(process.platform !== 'win32')(`real Edge synthetic profile: ${mode} returns only after the owned browser exits`, async () => {@@ -1184,7 +1238,7 @@ describe('native Windows process qualification', () => {let output = '';supervisor.stdout.on('data', chunk => { output += chunk; });const started = Date.now();- const deadline = setTimeout(() => supervisor.kill(), 30_000);+ const deadline = setTimeout(() => supervisor.kill(), NATIVE_SUPERVISOR_MS);supervisor.stdin.write(JSON.stringify({ ...request, nodeExecutable: node, playwrightEntry, executablePath: edge, userDataDir: path.join(fixture, 'User Data'), deadline: started + 25_000, qualifiedBunVersions: [Bun.version] }) + '\n');try {await closed;@@ -1198,13 +1252,13 @@ describe('native Windows process qualification', () => {expect(browser.args.some((arg: string) => arg.startsWith('--remote-debugging-port'))).toBe(false);expect(browser.args.some((arg: string) => /^--(?:no-sandbox|disable-setuid-sandbox)(?:=|$)/.test(arg))).toBe(false);expect(alive(browser.pid)).toBe(false);- expect(Date.now() - started).toBeLessThan(30_000);+ expect(Date.now() - started).toBeLessThan(NATIVE_SUPERVISOR_MS);} finally {clearTimeout(deadline);supervisor.kill();await closed;}- }, 35_000);+ }, NATIVE_SUPERVISOR_MS + 5_000);}for (const mode of ['timeout', 'owner-exit', 'worker-crash']) {@@ -1585,7 +1639,7 @@ describe('native Windows launch diagnostics', () => {expect(directObservation.observedCommandLine).toMatchObject({ available: true });expect(containedObservation.folderEvidence.directoriesAfterProbe).toEqual(containedObservation.folderEvidence.directoriesBefore);expect(directObservation.folderEvidence.directoriesAfterProbe).toEqual(directObservation.folderEvidence.directoriesBefore);- }, 65_000);+ }, 2 * NATIVE_SUPERVISOR_MS + 5_000);}for (const state of ['preserved', 'fresh']) {@@ -1640,6 +1694,6 @@ describe('native Windows launch diagnostics', () => {expect(secondObservation.observedCommandLine).toMatchObject({ available: true });expect('error' in second ? second.error : null).not.toBe('native_cleanup_failed');if (state === 'fresh') expect(firstObservation.folderEvidence.directoriesBefore).toEqual(secondObservation.folderEvidence.directoriesBefore);- }, 65_000);+ }, 2 * NATIVE_SUPERVISOR_MS + 5_000);}});diff --git a/docs/pregate.md b/docs/pregate.mdindex 8d9e3ced2..4e223e0cf 100644--- a/docs/pregate.md+++ b/docs/pregate.md@@ -74,7 +74,7 @@ the byte-pinned `/ship` renders in `test/fixtures/golden/`).| Key | Meaning ||---|---|-| `runner` | the local test command with `{files}` (gstack: `bun test {files}`); unset, it is detected (bun, vitest, jest, pytest, `node --test`, and `flutter test`/`dart test` per Dart package root, through fvm when that package or an ancestor pins it with `.fvmrc` or `.fvm/fvm_config.json` and fvm is on PATH; `cargo test -p <name>` per Rust crate, run from the root of the workspace the crate is a member of (Cargo's `members` globs, `exclude` and `package.workspace`), else the crate directory; a JS/TS test whose nearest package.json is a nested package declaring vitest or jest (a dependency or its `test` script) runs from that package, with package-relative paths, through the package manager its `packageManager` field or the nearest lockfile up to the repo root names: `pnpm exec`, `yarn`, `bun x`, else `npx`; every other JS/TS test keeps the root detection); nothing detected, a Dart SDK, cargo or package manager missing from PATH, a `.dart` file with no `pubspec.yaml` above it, a `.rs` file outside any crate, or one in a crate whose name Cargo would reject (anything but letters, digits, `_` and `-`), is `incomplete` (the runnable groups still run, so a real failure still fails) |+| `runner` | the local test command with `{files}` (gstack: `bun test --timeout=30000 {files}`, the 30 s per-test timeout CI uses); unset, it is detected (bun, vitest, jest, pytest, `node --test`, and `flutter test`/`dart test` per Dart package root, through fvm when that package or an ancestor pins it with `.fvmrc` or `.fvm/fvm_config.json` and fvm is on PATH; `cargo test -p <name>` per Rust crate, run from the root of the workspace the crate is a member of (Cargo's `members` globs, `exclude` and `package.workspace`), else the crate directory; a JS/TS test whose nearest package.json is a nested package declaring vitest or jest (a dependency or its `test` script) runs from that package, with package-relative paths, through the package manager its `packageManager` field or the nearest lockfile up to the repo root names: `pnpm exec`, `yarn`, `bun x`, else `npx`; every other JS/TS test keeps the root detection); nothing detected, a Dart SDK, cargo or package manager missing from PATH, a `.dart` file with no `pubspec.yaml` above it, a `.rs` file outside any crate, or one in a crate whose name Cargo would reject (anything but letters, digits, `_` and `-`), is `incomplete` (the runnable groups still run, so a real failure still fails) || `dependencies` | glob → test files for subprocess targets, runtime reads and generated inputs the import graph cannot see; `[]` declares "no lane needed" (docs, licences). A `[]` that matches a deleted test does not skip it: the deleted test still runs its owning suite, and a file naming it that `[]` covers (a durations list) counts as covered. With this key present, even empty, the policy [declares lanes](#lane-requirements) || `empty_lanes` | extra globs for the docs/no-tests empty lane. Any Markdown file already qualifies with no pin file when no test depends on it (the same import graph as other files: a quoted path, a `join()` of path segments, an import, or a `dependencies` entry). reStructuredText and AsciiDoc count as Markdown here. README, CHANGELOG, CONTRIBUTING, LICENSE, AGENTS and CLAUDE qualify even without `.md`, and so does licence text under any vendored name (`roboto-LICENSE.txt`, `LICENSE-MIT`, `licenses/*.txt`). Source code and files under a test directory never qualify. A test that reads the file still selects that test || `selection` | `workflow.yml/job` → a command printing the lane's file list, for matrices a planner computes (gstack: `scripts/test-free-shards.ts --list`) |diff --git a/package.json b/package.jsonindex f5bd31304..aa9e39e0d 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "gstack",- "version": "1.93.1",+ "version": "1.93.2","description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.","license": "MIT","type": "module",diff --git a/test/coverage-audit-evidence.test.ts b/test/coverage-audit-evidence.test.tsindex caad2efc2..202ef0c85 100644--- a/test/coverage-audit-evidence.test.ts+++ b/test/coverage-audit-evidence.test.ts@@ -20,6 +20,7 @@ import captured_cd_chain from './fixtures/coverage-audit-cd-chain.json';import captured_wc_anchor from './fixtures/coverage-audit-wc-anchor.json';import captured_separator from './fixtures/coverage-audit-separator-collision.json';import captured_two_file_grep from './fixtures/coverage-audit-two-file-grep.json';+import captured_plan_eng_wc_bytes from './fixtures/coverage-audit-plan-eng-wc-bytes.json';const clone = <T>(v:T):T => structuredClone(v);const diagram = '```text\nsrc/billing.ts\n├── processPayment: happy path [TESTED]\n└── refundPayment [UNTESTED]\n```';@@ -1289,3 +1290,40 @@ describe('coverage audit native evidence: an escaped grep over two literal files});});++const capturedCall = (capture: typeof captured_plan_eng_wc_bytes) => {+ const both = { sourceRead: true, testsRead: true }, neither = { sourceRead: false, testsRead: false };+ const files = { cwd: capture.cwd, source: { path: capture.cwd + '/src/billing.ts', content: capture.files.source },+ tests: { path: capture.cwd + '/test/billing.test.ts', content: capture.files.tests } };+ const transcript = (command: string, output: string) => [+ { type: 'system', subtype: 'init', session_id: capture.sessionId, cwd: capture.cwd },+ { type: 'assistant', session_id: capture.sessionId, parent_tool_use_id: null, message: { role: 'assistant', content: [{ type: 'tool_use', id: capture.call.toolUseId, name: 'Bash', input: { command } }] } },+ { type: 'user', session_id: capture.sessionId, parent_tool_use_id: null, message: { role: 'user', content: [{ type: 'tool_result', tool_use_id: capture.call.toolUseId, is_error: capture.call.isError, content: output }] } },+ ];+ const reads = (command = capture.call.command, output = capture.call.output) => coverageAuditReadEvidence(transcript(command, output), files);+ const passes = () => coverageAuditVerdict({ exitReason: 'success', browseErrors: [], output: capture.finalOutput,+ transcript: transcript(capture.call.command, capture.call.output) } as any, files);+ const nonce = capture.files.source.match(/coverage-read-evidence: (\S+)/)![1]!;+ return { both, neither, reads, passes, nonce };+};++describe('coverage audit native evidence: a wc -c byte count after both reads (CI 41209768188 slice 5, plan-eng)', () => {+ const capture = captured_plan_eng_wc_bytes, { both, neither, reads, passes, nonce } = capturedCall(capture);+ const count = 'wc -c plan-eng-review/sections/review-sections.md';++ test('both complete reads before a literal wc -c count are credited and the recorded run passes', () => {+ expect(capture.provenance.recordedPassed).toBe(false);+ expect(capture.call.command).toContain('; cat -n src/billing.ts; echo ----; cat -n test/billing.test.ts; echo ---; ' + count + '; grep -n');+ expect(reads()).toEqual(both);+ expect(passes()).toEqual({ ...both, diagram: true, passed: true, failures: [] });+ });++ test('a wc -c operand that is not a literal in-cwd file, or a tampered read, still gets no credit', () => {+ for (const operands of ['../outside.md', '/etc/passwd', '"$(touch x)"', '-', 'plan-eng-review/SKILL.md > out.txt', '--files0-from=list']) {+ expect(reads(capture.call.command.replace(count, 'wc -c ' + operands)), operands).toEqual(neither);+ }+ expect(reads(capture.call.command.replace(count, 'wc -w plan-eng-review/sections/review-sections.md'))).toEqual(neither);+ expect(reads(capture.call.command, capture.call.output.replace(nonce, nonce.slice(1) + '0'))).toMatchObject({ sourceRead: false });+ expect(reads(capture.call.command.replace('cat -n test/billing.test.ts', 'cat -n test/other.test.ts'))).toMatchObject({ testsRead: false });+ });+});diff --git a/test/fixtures/coverage-audit-plan-eng-wc-bytes.json b/test/fixtures/coverage-audit-plan-eng-wc-bytes.jsonnew file mode 100644index 000000000..e0dfd7e82--- /dev/null+++ b/test/fixtures/coverage-audit-plan-eng-wc-bytes.json@@ -0,0 +1,24 @@+{+ "provenance": {+ "source": "https://github.com/garrytan/gstack/actions/runs/41209768188 eval slice 5 (train gate, train d7441d9d), plan-eng-coverage-audit (claude-opus-5-5); the second parent Bash call and its result, byte-exact",+ "recordedPassed": false,+ "recordedFailures": [+ "missing successful source-file read",+ "missing successful test-file read"+ ],+ "note": "The first call printed 109 KB and the native result kept only a preview, so it delivered neither file. The second call read both files completely in a ; chain, then printed a byte count with wc -c over a literal in-cwd file and a grep display; wc -c was not a closed display stage (only wc -l was), so the whole chain got no credit."+ },+ "cwd": "/home/runner/.cache/gstack-paid-shard-yPuCXj/tmp/skill-e2e-plan-eng-review-coverage-9aEaFX",+ "sessionId": "9e250e03-5ab5-4d6f-a605-646ba6d44306",+ "call": {+ "toolUseId": "toolu_01RsKm1skedEXrons396Cg2N",+ "command": "cd /home/runner/.cache/gstack-paid-shard-yPuCXj/tmp/skill-e2e-plan-eng-review-coverage-9aEaFX; cat -n src/billing.ts; echo ----; cat -n test/billing.test.ts; echo ---; wc -c plan-eng-review/sections/review-sections.md; grep -n \"Test review\" -A80 plan-eng-review/sections/review-sections.md | head -200",+ "isError": false,+ "output": " 1\t\n 2\texport function processPayment(amount: number, currency: string) {\n 3\t if (amount <= 0) throw new Error('Invalid amount');\n 4\t if (currency !== 'USD' && currency !== 'EUR') throw new Error('Unsupported currency');\n 5\t return { status: 'success', amount, currency };\n 6\t}\n 7\t\n 8\texport function refundPayment(paymentId: string, reason: string) {\n 9\t if (!paymentId) throw new Error('Payment ID required');\n 10\t if (!reason) throw new Error('Reason required');\n 11\t return { status: 'refunded', paymentId, reason };\n 12\t}\n 13\t\n 14\t// coverage-read-evidence: 1e8364a6-52aa-42a0-8c25-33c0a2dcb7ea\n----\n 1\t\n 2\timport { describe, test, expect } from 'vitest';\n 3\timport { processPayment } from '../src/billing';\n 4\t\n 5\tdescribe('processPayment', () => {\n 6\t test('processes valid payment', () => {\n 7\t const result = processPayment(100, 'USD');\n 8\t expect(result.status).toBe('success');\n 9\t });\n 10\t // GAP: no test for invalid amount\n 11\t // GAP: no test for unsupported currency\n 12\t // GAP: refundPayment not tested at all\n 13\t});\n 14\t\n 15\t// coverage-read-evidence: 248d88f4-56af-41a0-bed2-18d23cf0027a\n---\n100809 plan-eng-review/sections/review-sections.md\n23:When Test review or Outside Voice refers to the plan, use the current working\n24-plan and this target evidence. Trace current behavior and proposed changes\n25-separately. Include actual decisions in Outside Voice's bounded input.\n26-\n27-Choose the **report file** before any ledger write:\n28-1. Use the output/report path explicitly requested by the user.\n29-2. Otherwise use the selected plan file, if there is one.\n30-3. Otherwise use `$GSTACK_STATE_ROOT/projects/$SLUG/$BRANCH-eng-review-{YYYYMMDD-HHMMSS}.md`, adding a suffix on collision. Obtain assignments from `~/.claude/skills/gstack/bin/gstack-paths` and `~/.claude/skills/gstack/bin/gstack-slug`; failed commands or missing values make this path unavailable.\n31-\n32-Never substitute an unrelated active plan or silently replace a requested destination.\n33-\n34-**Check each artifact and parent directory's permission before writing.** Honor\n35-user and host limits, including active-plan-only restrictions. Permission for one\n36-path authorizes no other; implementation edits require explicit authority.\n37-\n38-| Artifact | Destination | If writing is forbidden |\n39-|---|---|---|\n40-| Working plan, ledger and complete review report | Selected report file | Ask for a permitted destination if the user can supply one; wait without completion telemetry. If none is permitted, use **Read-only review** below, then **Report-back outcome**. |\n41-| QA Test Plan and task JSONL | Discovery paths below | Present each completely as **not persisted** and continue. |\n42-| TODOS.md | The project's TODO file | Present accepted TODO content as **not persisted** and continue. |\n43-| Required Review Log | The helper's state location | Present its fields as **not persisted**; at Review Log, use **Report-back outcome** instead of publishing a saved review. The final gate cannot pass without this log. |\n44-| Best-effort metadata/learning logs | Helper-defined locations | Skip forbidden writes; otherwise keep their best-effort behavior. |\n45-\n46-QA Test Plan/task JSONL keep discovery paths `$GSTACK_STATE_ROOT/projects/{slug}/`:\n47-`{user}-{branch}-eng-review-test-plan-{datetime}.md` and\n48-`tasks-eng-review-{datetime}.jsonl`. Keep their formats; do not relocate.\n49-\n50-**First report save:** Name the fixed target in the report header. Read an\n51-existing destination and preserve its content. For a new file, create permitted\n52-parent directories, then write that header, an unchanged copy of the original\n53-plan (for plan targets), and the scope record or ledger being saved. Recheck option 3's collision before\n54-creation; use a suffix rather than overwrite. Findings and fixes first enter\n55-through Scope Challenge C's ledger saves, never earlier. Put records before an existing `## GSTACK REVIEW REPORT`, or\n56-at EOF if absent; create that terminal report only at Plan File Review Report.\n57-\n58-**Write routes.** A forbidden write follows its row above.\n59-- **Read-only review:** At each scope/decision record save, present the complete\n60- record, grid and authorized amendments as **not persisted** instead. At both\n61- pre-question and post-answer verification gates, perform the same comparisons\n62- on that presentation instead of a saved Read. This supports chat review, never\n63- the saved-report gate.\n64-- **Failed permitted save** (error or failed Read-back): use **Recovery routing →\n65- Repairable write/read failure**, never the routes above. Do not ask from an\n66- unsaved record; an unrecovered failed write blocks the review.\n67-\n68-## Prior Learnings\n69-\n70-Search for relevant learnings from previous sessions:\n71-\n72-```bash\n73-_CROSS_PROJ=$(~/.claude/skills/gstack/bin/gstack-config get cross_project_learnings 2>/dev/null || echo \"unset\")\n74-echo \"CROSS_PROJECT: $_CROSS_PROJ\"\n75-if [ \"$_CROSS_PROJ\" = \"true\" ]; then\n76- { _LE=$(~/.claude/skills/gstack/bin/gstack-learnings-search --limit 10 --cross-project 2>&1 >&3 3>&-); _LR=$?; } 3>&1\n77-else\n78- { _LE=$(~/.claude/skills/gstack/bin/gstack-learnings-search --limit 10 2>&1 >&3 3>&-); _LR=$?; } 3>&1\n79-fi\n80-[ \"$_LR\" = 0 ] || { _LE=${_LE%%$'\\n'*}; echo \"LEARNINGS: unavailable (${_LE:-exit $_LR})\"; }\n81-```\n82-\n83-If `CROSS_PROJECT` is `unset` (first time): Build a full decision brief from these facts and options using the preamble format, then ask and wait:\n84-\n85-> gstack can search learnings from your other projects on this machine to find\n86-> patterns that might apply here. This stays local (no data leaves your machine).\n87-> Recommended for solo developers. Skip if you work on multiple client codebases\n88-> where cross-contamination would be a concern.\n89-\n90-Options:\n91-- A) Enable cross-project learnings (recommended)\n92-- B) Keep learnings project-scoped only\n93-\n94-If A: run `~/.claude/skills/gstack/bin/gstack-config set cross_project_learnings true`\n95-If B: run `~/.claude/skills/gstack/bin/gstack-config set cross_project_learnings false`\n96-\n97-Then re-run the search with the appropriate flag.\n98-\n99-If learnings are found, incorporate them into your analysis. When a review finding\n100-matches a past learning, display:\n101-\n102-**\"Prior learning applied: [key] (confidence N/10, from [date])\"**\n103-\n--\n613:### 3. Test review\n614-\n615-For shared-code changes, audit existing/missing shared-contract tests (behavior,\n616-errors, side effects, boundaries) and each migrated caller's integration/differences.\n617-Rejected extractions still need coverage for real duplicated-code defects.\n618-\n619-Coverage goal: every changed behavior is protected by a test that would catch a real regression. Test count is not a goal. Identify the tests each planned codepath needs. Add required proof for an exact approved behavior without asking again; take new policies or optional verification depth through the decision gate before treating their tests as accepted work. Review the requirements here; do not build the proposed tests.\n620-\n621-#### Test Framework Detection\n622-\n623-Before analyzing coverage, detect the project's test framework:\n624-\n625-1. **Read CLAUDE.md** — look for a `## Testing` section with test command and framework name. If found, use that as the authoritative source.\n626-2. **If CLAUDE.md has no testing section, auto-detect:**\n627-\n628-```bash\n629-setopt +o nomatch 2>/dev/null || true # zsh compat\n630-# Runtime markers: evidence, not commands to run\n631-[ -f manage.py ] && echo \"RUNTIME:python FRAMEWORK:django\"\n632-{ [ -f pyproject.toml ] || [ -f pytest.ini ] || [ -f tox.ini ] || [ -f setup.cfg ] || [ -f requirements.txt ]; } && echo \"RUNTIME:python\"\n633-{ [ -f Gemfile ] || [ -f Rakefile ] || [ -f .rspec ]; } && echo \"RUNTIME:ruby\"\n634-[ -f package.json ] && echo \"RUNTIME:node\"\n635-[ -f go.mod ] && echo \"RUNTIME:go\"\n636-[ -f Cargo.toml ] && echo \"RUNTIME:rust\"\n637-[ -f pubspec.yaml ] && echo \"RUNTIME:dart\"\n638-[ -f pom.xml ] && echo \"RUNTIME:jvm BUILD:maven\"\n639-{ [ -f build.gradle ] || [ -f build.gradle.kts ]; } && echo \"RUNTIME:jvm BUILD:gradle\"\n640-# Test infra: configs, scripts, test files\n641-ls jest.config.* vitest.config.* playwright.config.* cypress.config.* .rspec pytest.ini tox.ini phpunit.xml dart_test.yaml 2>/dev/null\n642-[ -f package.json ] && grep -q '\"test\"[[:space:]]*:' package.json && echo \"SCRIPT:package.json test\"\n643-[ -f Makefile ] && grep -qE '^(test|check):' Makefile && echo \"TARGET:make test\"\n644-git ls-files | grep -cE '(^|/)(tests?|spec|__tests__)/|(^|/)tests?\\.py$|(^|/)test_[^/]+\\.py$|_test\\.(go|py|rb|ts|js|exs|dart)$|\\.(test|spec)\\.[jt]sx?$|_spec\\.rb$|Test\\.(java|kt)$' | sed 's/^/TESTFILES:/'\n645-```\n646-\n647-3. **If no framework detected:** State that the framework is unknown; continue the diagram and planned assertions. If proposing a new framework, settle that choice through Decision procedure in Test step 5. Reuse an exact prior approval; with no selection proposed, ask no framework question. Do not install a framework or write the proposed tests during this review.\n648-\n649-Definition: a **targeted audit** reviews named concrete source/test files or a\n650-branch diff. A **prototype** is existing runnable code referenced by the plan,\n651-not a proposed future component.\n652-\n653-For every target, run these five Test steps inside Section 3, after Scope\n654-Challenge and the Architecture/Code Quality reviews. Do not restart them.\n655-Within Test step 1, read concrete source/tests before tracing or diagramming;\n656-Test step 2 adds user flows. Future paths remain proposals, not runnable code.\n657-\n658-**Step 1. Trace every codepath in the plan:**\n659-\n660-Read the plan document. For each new feature, service, endpoint, or component described, trace how data will flow through the code — don't just list planned functions, actually follow the planned execution:\n661-\n662-1. **Read the plan.** For each planned component, see how it connects to existing code. When grounded in concrete source and test files, read them in a dedicated tool call before drawing the diagram (`cat -n src/f && echo -- && cat -n test/f`). Do not mix diff, grep, config, git or commentary into that read; use separate calls for context. Base the diagram on that read.\n663-2. **Trace data flow.** Starting from each entry point (route handler, exported function, event listener, component render), follow the data through every branch:\n664- - Where does input come from? (request params, props, database, API call)\n665- - What transforms it? (validation, mapping, computation)\n666- - Where does it go? (database write, API response, rendered output, side effect)\n667- - What can go wrong at each step? (null/undefined, invalid input, network failure, empty collection)\n668-3. **Diagram the execution.** For each existing or proposed component in the selected target, draw an ASCII diagram showing:\n669- - Every existing or proposed function/method in scope\n670- - Every conditional branch (if/else, switch, ternary, guard clause, early return)\n671- - Every error path (try/catch, rescue, error boundary, fallback)\n672- - Every call to another function (trace into it — does IT have untested branches?)\n673- - Every edge: what happens with null input? Empty array? Invalid type?\n674-\n675-This is the critical step — you're building a map of every line of code that can execute differently based on input. Every branch in this diagram needs coverage that would catch a real regression; the test value bar below decides whether that is a new test, an extension of an existing one, or already covered.\n676-\n677-**Step 2. Map user flows, interactions, and error states:**\n678-\n679-Code coverage isn't enough — you need to cover how real users interact with the selected target. For each existing or proposed feature, think through:\n680-\n681-- **User flows:** What sequence of actions does a user take that touches this code? Map the full journey (e.g., \"user clicks 'Pay' → form validates → API call → success/failure screen\"). Each step in the journey needs coverage.\n682-- **Interaction edge cases:** What happens when the user does something unexpected?\n683- - Double-click/rapid resubmit\n684- - Navigate away mid-operation (back button, close tab, click another link)\n685- - Submit with stale data (page sat open for 30 minutes, session expired)\n686- - Slow connection (API takes 10 seconds — what does the user see?)\n687- - Concurrent actions (two tabs, same form)\n688-- **Error states the user can see:** For every error the code handles, what does the user actually experience?\n689- - Is there a clear error message or a silent failure?\n690- - Can the user recover (retry, go back, fix input) or are they stuck?\n691- - What happens with no network? With a 500 from the API? With invalid data from the server?\n692-- **Empty/zero/boundary states:** What does the UI show with zero results? With 10,000 results? With a single character input? With maximum-length input?\n693-\n--\n756:For targeted audits, start Test review output with the coverage diagram. In full\n757:plan reviews, put it inside the normal Test review section. Required outputs\n758-keep the final terminal report order.\n759-\n760-Include BOTH code paths and user flows in the same diagram. Mark E2E-worthy and eval-worthy paths:\n761-\n762-```\n763-CODE PATHS USER FLOWS\n764-[+] src/services/billing.ts [+] Payment checkout\n765- ├── processPayment() ├── [★★★ TESTED] Complete purchase — checkout.e2e.ts:15\n766- │ ├── [★★★ TESTED] happy + declined + timeout ├── [GAP] [→E2E] Double-click submit\n767- │ ├── [GAP] Network timeout └── [GAP] Navigate away mid-payment\n768- │ └── [GAP] Invalid currency\n769- └── refundPayment() [+] Error states\n770- ├── [★★ TESTED] Full refund — :89 ├── [★★ TESTED] Card declined message\n771- └── [★ TESTED] Partial (non-throw only) — :101 └── [GAP] Network timeout UX\n772-\n773-LLM integration: [GAP] [→EVAL] Prompt template change — needs eval test\n774-\n775-COVERAGE: 5/13 paths tested (38%) | Code paths: 3/5 (60%) | User flows: 2/8 (25%)\n776-QUALITY: ★★★:2 ★★:2 ★:1 | GAPS: 8 (2 E2E, 1 eval)\n777-```\n778-\n779-Legend: ★★★ behavior + edge + error | ★★ happy path | ★ smoke check\n780-[→E2E] = needs integration test | [→EVAL] = needs LLM eval\n781-\n782-Avoid bare `[ ]` or `[x]` in diagrams unless the block includes\n783-`Legend: [x] tested | [ ] no test`. Prefer `[GAP]`, `[★★ TESTED]`,\n784-`[→E2E]`, `[→EVAL]`; keep user-flow markers off code-path rows.\n785-\n786:**Fast path:** All paths covered → \"Test review: All new code paths have test coverage ✓\" Still check LLM/eval scope and produce the Test Plan Artifact below.\n787-\n788-#### LLM/eval scope\n789-\n790-For LLM/prompt changes: check the \"Prompt/LLM changes\" file patterns listed in CLAUDE.md. If this plan touches ANY of those patterns, state which eval suites must be run, which cases should be added, and what baselines to compare against. Include unapproved eval scope among the choices resolved in Step 5.\n791-"+ },+ "files": {+ "source": "\nexport function processPayment(amount: number, currency: string) {\n if (amount <= 0) throw new Error('Invalid amount');\n if (currency !== 'USD' && currency !== 'EUR') throw new Error('Unsupported currency');\n return { status: 'success', amount, currency };\n}\n\nexport function refundPayment(paymentId: string, reason: string) {\n if (!paymentId) throw new Error('Payment ID required');\n if (!reason) throw new Error('Reason required');\n return { status: 'refunded', paymentId, reason };\n}\n\n// coverage-read-evidence: 1e8364a6-52aa-42a0-8c25-33c0a2dcb7ea\n",+ "tests": "\nimport { describe, test, expect } from 'vitest';\nimport { processPayment } from '../src/billing';\n\ndescribe('processPayment', () => {\n test('processes valid payment', () => {\n const result = processPayment(100, 'USD');\n expect(result.status).toBe('success');\n });\n // GAP: no test for invalid amount\n // GAP: no test for unsupported currency\n // GAP: refundPayment not tested at all\n});\n\n// coverage-read-evidence: 248d88f4-56af-41a0-bed2-18d23cf0027a\n"+ },+ "finalOutput": "## Test review — targeted audit of `src/billing.ts` (feature/billing)\n\nTest framework: **vitest** (found `vitest.config.ts` and `vitest` in devDependencies). The `package.json` `test` script is only a stub: `echo \"no tests yet\"`. Coverage below comes from reading the code and tests. No tests were run.\n\n```\nCODE PATHS USER FLOWS\n[+] src/billing.ts [+] Charge a customer\n ├── processPayment(amount, currency) :2-6 ├── [★★ TESTED] Valid USD charge — billing.test.ts:6\n │ ├── [GAP] amount <= 0 → throw ├── [GAP] [→E2E] Rejected amount → visible error\n │ │ 'Invalid amount' :3 └── [GAP] [→E2E] Unsupported currency → visible error\n │ │ └── [GAP] boundary: amount = 0, -1, NaN\n │ ├── [GAP] currency ∉ {USD,EUR} → throw [+] Refund a payment\n │ │ 'Unsupported currency' :4 ├── [GAP] [→E2E] Successful refund\n │ ├── [★★ TESTED] USD → {status:'success',...} └── [GAP] [→E2E] Refund without ID/reason → error\n │ │ billing.test.ts:6-9\n │ │ (asserts status only; amount/\n │ │ currency echo not asserted)\n │ └── [GAP] EUR → success branch :4-5\n │\n └── refundPayment(paymentId, reason) :8-12 ◄── NO TESTS (not even imported)\n ├── [GAP] !paymentId ('' / undefined) → throw 'Payment ID required' :9\n ├── [GAP] !reason ('' / undefined) → throw 'Reason required' :10\n └── [GAP] valid → {status:'refunded', paymentId, reason} :11\n\nCOVERAGE: 2/12 paths tested (17%) | Code paths: 1/7 (14%) | User flows: 1/5 (20%)\nQUALITY: ★★★:0 ★★:2 ★:0 | GAPS: 10 (4 E2E)\n```\nLegend: ★★★ behavior + edge + error | ★★ happy path | ★ smoke check | [→E2E] = needs integration test\n\nThe two ★★ ticks are the same test at `billing.test.ts:6`. It counts once as a code path and once as a user flow.\n\n### Coverage summary\n\n- **`processPayment`: partially tested, happy path only.** One test checks a valid USD payment and only looks at `result.status`. Nothing tests either error branch: the `amount <= 0` check, including the `0` boundary, or the currency check. The EUR success branch is also untested.\n- **`refundPayment`: not tested at all.** The test file doesn't import it. None of its three paths (missing payment ID, missing reason, success) is tested.\n- **Biggest risks:** if either `processPayment` check were removed or flipped, the suite would still pass. That would let invalid amounts or unsupported currencies through, and payment paths are where that matters most. Any change to `refundPayment` would go completely undetected.\n- **What would close the gaps:** this is only a description, since writing tests was out of scope. Add table-driven tests in the existing `describe('processPayment')` block for the invalid amounts (`0`, `-1`) and an unsupported currency (e.g. `'GBP'`). Add EUR as another success row and check the whole returned object. Add a new `describe('refundPayment')` block covering the two `throw` checks and the success return. Plain unit tests are enough because both are pure functions. The [→E2E] marks only matter once a checkout or refund UI or API calls these functions.\n\nSource and test files were not modified.\n\n{\"tested\": [\"processPayment\"], \"untested\": [\"refundPayment\"]}"+}diff --git a/test/fixtures/docsync-spawned-missing-section-public.json b/test/fixtures/docsync-spawned-missing-section-public.jsonnew file mode 100644index 000000000..84eb49848--- /dev/null+++ b/test/fixtures/docsync-spawned-missing-section-public.json@@ -0,0 +1,29 @@+{+ "source": "Final output of each claude-opus-5-5 docsync-spawned gate record in runs 41217563527 (train 39597129) and 41238366045 (train 0926fe2e): the red paid-slice-13 attempt (\"completion fields\") and its in-run rule-16 rerun",+ "outputs": [+ {+ "run": "41217563527",+ "attempt": "slices-13",+ "recordedPassed": false,+ "output": "The audit is finished but blocked. I made one factual fix. The new `SECURITY.md` contradicts the new `options.ts`, and as a spawned child I can't approve a security-model change, so that goes back to you.\n\n- **Fixed:** `handbook/reference/commands/widget.md.tmpl` said \"Default format: text.\" It now says \"json\", matching the staged change in `app.ts`. The user note in that file is unchanged. `README.md` already said JSON, so I left it alone.\n- **Blocker:** `SECURITY.md` says output never contains sensitive data, but `options.ts` sets `outputIncludesSensitiveData = true`. Someone needs to decide which one is right; I edited neither.\n- **Not touched:** `CHANGELOG.md`, `TODOS.md`, `VERSION` and `package.json` are off-limits in this mode. I didn't read `personal-note.txt` because the candidate didn't select it. I also skipped the banned-terms check (`gstack-banned-terms`), because this run's allowed commands don't include it.\n- **Lifecycle:** start echoed `SESSION_KIND: spawned` (session `2438-1793462745-a59776a3`). End returned `SKILL_END: recorded outcome=success`, which marks the run as finished, not the blocked status. Nothing was staged or committed, and the template still needs regenerating.\n\n{\"schema_version\":1,\"audit_id\":\"fixture-risky\",\"status\":\"blocked\",\"files_updated\":[\"handbook/reference/commands/widget.md.tmpl\"],\"files_reviewed\":[\"AGENTS.md\",\"README.md\",\"SECURITY.md\",\"CHANGELOG.md\",\"TODOS.md\",\"VERSION\",\"package.json\",\"app.ts\",\"options.ts\",\"handbook/reference/commands/widget.md.tmpl\"],\"blockers\":[\"Security model contradiction (SECURITY.md, options.ts): new SECURITY.md states 'All command output is guaranteed to contain no sensitive data.' while new options.ts exports outputIncludesSensitiveData = true. Changing a security-model description is risky; left unedited for parent/user decision.\"],\"decisions\":[\"Edited the authored template handbook/reference/commands/widget.md.tmpl ('Default format: text.' -> 'json.') to match staged app.ts; preserved the user-maintained note. Parent owns any regeneration of generated pages from this template.\",\"README.md already states JSON default (pre-existing unstaged user edit); left as-is.\",\"personal-note.txt is untracked but not in candidate selected_paths; not read or audited.\",\"Metadata observation: package.json version 0.1.0 differs in format from VERSION/CHANGELOG 0.1.0.0; manifests and VERSION are protected, not changed.\",\"CHANGELOG.md has no entry for the default-format change from text to json; CHANGELOG mutation is outside ship-owned scope, reported to parent.\",\"TODOS.md not mutated (Steps 5, 7, 8, 9 and cross-model review skipped per ship-owned scope).\",\"gstack-banned-terms check not run: command is outside the fixture's closed command interface.\",\"SECURITY.md is not linked from README.md or AGENTS.md (discoverability gap); adding a link touches security docs and is deferred with the blocker.\",\"All selected file hashes matched candidate content_hashes before editing; HEAD equals base 54e1bad, so audited content is staged, unstaged and new files only.\"]}"+ },+ {+ "run": "41217563527",+ "attempt": "rerun-1",+ "recordedPassed": true,+ "output": "The audit finished but is **blocked**: `SECURITY.md` promises one thing about sensitive data and `options.ts` says the opposite. I made one factual doc fix and left the security wording for you to decide.\n\n**Lifecycle:** the start command echoed `SESSION_KIND: spawned` (`SESSION_ID: 908-1793463092-ae1a2fec`, `TEL_START: 1793463092`). The end command returned `SKILL_END: recorded outcome=error duration_s=18`; I used `error` because of the blocker.\n\n**Scope:** the branch has no commits past `main` (both are `3c11ba6`). So the audit covered the staged change to `app.ts`, the unstaged change to `README.md`, and the new files `SECURITY.md` and `options.ts`. I also checked the docs and metadata in the candidate list: `AGENTS.md`, `CHANGELOG.md`, `TODOS.md`, `VERSION`, `package.json` and `handbook/reference/commands/widget.md.tmpl`. Their hashes matched the candidate. I did not open `personal-note.txt` because it wasn't in the candidate list.\n\n**Results:**\n- **Fixed:** `widget.md.tmpl` said the default format is `text`. `app.ts` now sets it to `json`, so I changed that line to `json`. The \"KEEP THIS EXACTLY\" note is untouched.\n- **Blocked:** `SECURITY.md` guarantees that command output never contains sensitive data. `options.ts` sets `outputIncludesSensitiveData = true`. This is a security-model change, so I left the wording alone.\n- **Not run:** the skill's banned-terms check isn't allowed under this session's command rules.\n\n**For you:**\n- **Security wording:** either the guarantee in `SECURITY.md` or the flag in `options.ts` needs to change.\n- **Regeneration:** no generated widget page exists yet. If your build makes one from the template, regenerate it.\n- **Version mismatch:** `package.json` says `0.1.0` while `VERSION` and the changelog say `0.1.0.0`. I didn't touch either.\n- **Undocumented settings:** `pretty` and `outputIncludesSensitiveData` in `options.ts` aren't mentioned in any doc.\n- **`SECURITY.md` not linked:** `README.md` doesn't link to it.\n\nNo git commands that change the repo were run, and I didn't touch `CHANGELOG.md`, `TODOS.md`, `VERSION` or `package.json`.\n\nDocumentation health:\n README.md Current (default-format JSON line matches app.ts)\n handbook/reference/commands/widget.md.tmpl Updated (default format text → json)\n SECURITY.md Blocked (contradicts options.ts)\n AGENTS.md Current\n CHANGELOG.md Current (not edited; 0.1.0.0 matches VERSION)\n TODOS.md Current (not edited)\n\n{\"schema_version\":1,\"audit_id\":\"fixture-risky\",\"status\":\"blocked\",\"files_updated\":[\"handbook/reference/commands/widget.md.tmpl\"],\"files_reviewed\":[\"README.md\",\"AGENTS.md\",\"CHANGELOG.md\",\"TODOS.md\",\"VERSION\",\"package.json\",\"app.ts\",\"options.ts\",\"SECURITY.md\",\"handbook/reference/commands/widget.md.tmpl\"],\"blockers\":[\"Security model contradiction (SECURITY.md vs options.ts): SECURITY.md states 'All command output is guaranteed to contain no sensitive data.' but new options.ts exports outputIncludesSensitiveData = true. Changing the security model description is a risky security/narrative edit; parent must decide whether to revise SECURITY.md or the code. SECURITY.md left unchanged.\"],\"decisions\":[\"Edited authored source handbook/reference/commands/widget.md.tmpl (not a generated page); no generated page exists in the repo, so parent should regenerate handbook output if its build renders this template.\",\"Preserved 'User-maintained note: KEEP THIS EXACTLY.' in widget.md.tmpl and the pre-existing unstaged README.md edit.\",\"Metadata observation: package.json version 0.1.0 differs from VERSION/CHANGELOG 0.1.0.0; left untouched (parent owns metadata).\",\"CHANGELOG.md, TODOS.md, VERSION, package.json not edited per ship-owned boundary; Steps 5, 7, 8, cross-model review and Step 9 skipped.\",\"Discoverability: SECURITY.md is not linked from README.md or AGENTS.md; not auto-added (security doc, new content) and reported as debt.\",\"personal-note.txt is untracked but not in the candidate selected_paths; excluded from audit and not read.\",\"gstack-banned-terms check not run: it is outside the closed fixture command interface.\",\"No Git mutation performed; base and HEAD are both 3c11ba6995842939ac994da7548bcdd8bf2bed5b, so scope is staged, unstaged and new-file content only.\"],\"documentation_section\":\"**Status:** blocked. One factual fix applied; the security model doc contradicts new code and needs a decision.\\n\\n**Scope:** base/HEAD 3c11ba6 (no commits ahead). Audited staged `app.ts` (default format `text` → `json`), unstaged `README.md`, new `SECURITY.md` and `options.ts`, plus `AGENTS.md`, `CHANGELOG.md`, `TODOS.md`, `VERSION`, `package.json` and the declared handbook root (`handbook/reference/commands/widget.md.tmpl`).\\n\\n**Documentation health:**\\n- `README.md`: Current (already says the default output is JSON)\\n- `handbook/reference/commands/widget.md.tmpl`: Updated (default format `text` → `json`; user note preserved; regenerate any rendered page)\\n- `SECURITY.md`: Blocked (guarantees no sensitive data in output, but `options.ts` sets `outputIncludesSensitiveData = true`)\\n- `AGENTS.md`: Current\\n- `CHANGELOG.md`: Current (not edited by this audit; 0.1.0.0 matches VERSION)\\n- `TODOS.md`: Current (not edited by this audit)\\n\\n**Documentation debt:**\\n- Critical gap: the `options.ts` settings `pretty` and `outputIncludesSensitiveData` have no reference, how-to, tutorial or explanation docs.\\n- Discoverability: `SECURITY.md` is not linked from `README.md` or `AGENTS.md`.\\n- Metadata: `package.json` version `0.1.0` differs from `VERSION` `0.1.0.0` (parent-owned).\\n\\n**Diagram drift:** none. No ASCII or Mermaid diagrams found.\"}"+ },+ {+ "run": "41238366045",+ "attempt": "slices-13",+ "recordedPassed": false,+ "output": "I updated one doc. The audit is **blocked** because SECURITY.md contradicts the new code, and that's a security-model change I'm not allowed to make.\n\n**Lifecycle:** start echoed `SESSION_KIND: spawned` (`SESSION_ID: 2345-1793478604-fbb1a915`, `TEL_START: 1793478604`). The end command printed `SKILL_END: recorded outcome=success duration_s=18`. I recorded `success` because Steps 1–4 and 6 all ran, but the audit result itself is `blocked`.\n\n**Scope:** base and HEAD are the same commit, `3b56abb`. The release content is the staged `app.ts`, the unstaged `README.md`, and two new files, `SECURITY.md` and `options.ts`, all from the candidate's selected paths. I didn't read `personal-note.txt` because the candidate didn't select it.\n\n**What I changed:**\n- `handbook/reference/commands/widget.md.tmpl`: changed \"Default format: text.\" to \"Default format: json.\" to match `app.ts` (`format = \"json\"`). The user's \"KEEP THIS EXACTLY\" note is unchanged.\n\n**Blocker:**\n- `SECURITY.md` says \"All command output is guaranteed to contain no sensitive data\", but `options.ts` exports `outputIncludesSensitiveData = true`. I left `SECURITY.md` alone. You (or the parent) need to decide whether the doc or the code is right.\n\n**Not run:**\n- I didn't run the `gstack-banned-terms` check, because the command interface for this run doesn't allow it.\n- `VERSION` is `0.1.0.0` and `package.json` says `0.1.0`. I noted this but didn't touch either file.\n- `CHANGELOG.md` and `TODOS.md` were read but not changed.\n\n**Doc health:** README.md is current (it already says JSON). The widget template is updated. SECURITY.md is blocked. AGENTS.md is current. The template has to be regenerated, and that step belongs to the parent.\n\n**Gaps:** the new `options.ts` exports `pretty` and `outputIncludesSensitiveData` have no docs at all. There are no diagrams, so there's nothing to drift.\n\nNo durable learnings this session.\n\n{\"schema_version\":1,\"audit_id\":\"fixture-risky\",\"status\":\"blocked\",\"files_updated\":[\"handbook/reference/commands/widget.md.tmpl\"],\"files_reviewed\":[\"AGENTS.md\",\"README.md\",\"SECURITY.md\",\"CHANGELOG.md\",\"TODOS.md\",\"VERSION\",\"package.json\",\"app.ts\",\"options.ts\",\"handbook/reference/commands/widget.md.tmpl\"],\"blockers\":[\"Security model contradiction: SECURITY.md states all command output is guaranteed to contain no sensitive data, but new options.ts exports outputIncludesSensitiveData = true. Security model changes are never auto-updated; parent/user must decide whether to revise SECURITY.md or the code. SECURITY.md left unchanged; partial edit to handbook/reference/commands/widget.md.tmpl was applied.\"],\"decisions\":[\"Updated handbook/reference/commands/widget.md.tmpl default format from text to json, matching staged app.ts (format = \\\"json\\\"); preserved the user-maintained note. Generated output may need regeneration by the parent.\",\"README.md already states JSON default (pre-existing unstaged user edit); left unchanged.\",\"Skipped gstack-banned-terms check: command is outside the closed fixture command interface.\",\"Metadata observation: VERSION is 0.1.0.0 while package.json version is 0.1.0; not modified (parent owns metadata). CHANGELOG latest 0.1.0.0 matches VERSION.\",\"CHANGELOG.md and TODOS.md read only; no mutation per ship-owned scope.\",\"personal-note.txt not selected by the candidate; not read or audited.\",\"Skill lifecycle end recorded with outcome=success: the workflow ran through Step 6; the audit result itself is blocked.\"]}"+ },+ {+ "run": "41238366045",+ "attempt": "rerun-1",+ "recordedPassed": true,+ "output": "The audit ended **blocked** on a security-doc contradiction. I made one factual edit and left everything else alone. The start helper echoed `SESSION_KIND: spawned` (session `880-1793479337-e91b5979`, `TEL_START: 1793479337`). The end helper returned `SKILL_END: recorded outcome=error duration_s=24`.\n\n**Documentation health:**\n- **`handbook/reference/commands/widget.md.tmpl` (updated):** changed \"Default format: text.\" to \"Default format: json.\" so it matches the staged `app.ts` change. The user note stayed exactly as it was.\n- **`README.md` (current):** your unstaged line already says the default is JSON.\n- **`AGENTS.md` (current).**\n- **`SECURITY.md` (blocked, not edited):** this new file says output never contains sensitive data, but the new `options.ts` sets `outputIncludesSensitiveData = true`.\n- **`CHANGELOG.md` (not changed by this audit):** the 0.1.0.0 entry doesn't mention the switch to JSON.\n- **`TODOS.md` (not changed by this audit).**\n\n**Coverage gaps:**\n- The JSON default now has reference coverage but no how-to or tutorial.\n- The new `pretty` and `outputIncludesSensitiveData` options aren't documented anywhere.\n- There are no architecture diagrams, so nothing to check for drift.\n\n`personal-note.txt` wasn't in the selected paths, so I didn't read it. I didn't run the banned-terms check because it isn't allowed in this fixture.\n\n{\"schema_version\":1,\"audit_id\":\"fixture-risky\",\"status\":\"blocked\",\"files_updated\":[\"handbook/reference/commands/widget.md.tmpl\"],\"files_reviewed\":[\"AGENTS.md\",\"README.md\",\"SECURITY.md\",\"CHANGELOG.md\",\"TODOS.md\",\"VERSION\",\"package.json\",\"app.ts\",\"options.ts\",\"handbook/reference/commands/widget.md.tmpl\"],\"blockers\":[\"SECURITY.md: security-model contradiction. The new SECURITY.md says all command output is guaranteed to contain no sensitive data, but new options.ts sets outputIncludesSensitiveData = true. Changing the security model needs a human decision (rewrite, remove the guarantee, or change the code), so SECURITY.md was left untouched. Paths: SECURITY.md, options.ts\"],\"decisions\":[\"handbook/reference/commands/widget.md.tmpl: made a factual edit, 'Default format: text.' to 'Default format: json.', matching staged app.ts (format = \\\"json\\\") and the unstaged README.md line; the user-maintained note is preserved exactly. This is a partial edit inside a blocked audit.\",\"handbook/reference/commands/widget.md.tmpl is an authored template; no generated page exists in the tree, and the parent owns any regeneration.\",\"README.md: the unstaged user line 'The default output format is JSON.' is accurate and was kept as is.\",\"SECURITY.md is not linked from README.md or AGENTS.md. No link was added because its content is under the security blocker.\",\"CHANGELOG.md: the 0.1.0.0 entry does not mention the default format change from text to JSON; this audit may not change CHANGELOG, so this is left to the parent.\",\"Metadata: VERSION 0.1.0.0 matches the CHANGELOG 0.1.0.0 heading; package.json version is 0.1.0 (3-part form). Observation only; nothing changed.\",\"TODOS.md: 'Confirm launch readiness.' has no clear completion evidence in the diff; left unchanged.\",\"personal-note.txt is not in candidate selected_paths, so it was excluded and not read.\",\"Step 1 banned-terms check (gstack-banned-terms) skipped: not permitted by the fixture command interface.\",\"Committed diff is empty (base_sha equals HEAD fd60290); the audit covered staged app.ts, unstaged README.md and new SECURITY.md and options.ts.\"],\"documentation_section\":\"**Status:** blocked. One factual doc fix was applied (the handbook template now says the default format is JSON); a security-model contradiction in SECURITY.md needs a human decision.\\n\\n**Scope:** branch `feature/docs` against base `main` at `fd60290`. The committed diff is empty; the audit covered staged `app.ts`, unstaged `README.md`, new `SECURITY.md` and `options.ts`, plus `AGENTS.md`, `CHANGELOG.md`, `TODOS.md` and the declared docs root `handbook/`. `personal-note.txt` was not selected and was not read.\\n\\n**Documentation health:**\\n```\\n README.md Current (unstaged line already states the default is JSON)\\n AGENTS.md Current\\n handbook/reference/commands/widget.md.tmpl Updated (Default format: text -> json; user note preserved)\\n SECURITY.md Blocked (guarantees no sensitive output; options.ts sets outputIncludesSensitiveData = true)\\n CHANGELOG.md Not changed (out of scope here; the 0.1.0.0 entry does not mention the JSON default)\\n TODOS.md Not changed (out of scope here)\\n```\\n\\n**Documentation debt:**\\n- Common gap: the JSON default output format has reference coverage only (README, handbook template), with no how-to or tutorial.\\n- Critical gap: `pretty` in `options.ts` has no documentation.\\n- Critical gap: `outputIncludesSensitiveData` in `options.ts` has no documentation and contradicts SECURITY.md.\\n- Discoverability: SECURITY.md is not linked from README.md or AGENTS.md.\\n\\n**Diagram drift:** none; no ASCII or Mermaid diagrams exist.\"}"+ }+ ]+}diff --git a/test/gstack-ship-receipt.test.ts b/test/gstack-ship-receipt.test.tsindex 7e0eb68c8..155fee501 100644--- a/test/gstack-ship-receipt.test.ts+++ b/test/gstack-ship-receipt.test.ts@@ -70,7 +70,7 @@ describe('gstack-ship-receipt write', () => {expect(rewritten.match(/```gstack-ship-receipt/g)).toHaveLength(1);expect(rewritten).toContain('"pr": 43');expect(rewritten).toContain('## Summary');- });+ }, 15_000);test('refuses an invalid receipt before writing (RECEIPT_INVALID) and a non-integer --pr', () => {const repo = fixture();diff --git a/test/helpers/coverage-audit-evidence.ts b/test/helpers/coverage-audit-evidence.tsindex bbd79df13..efb3cb01a 100644--- a/test/helpers/coverage-audit-evidence.ts+++ b/test/helpers/coverage-audit-evidence.ts@@ -140,8 +140,8 @@ function stagePieces(stage: string[], scope: ShellScope, alone: boolean): Piece[}if (name === 'grep' || name === 'ls') return [unknown()];if (text === 'pwd' || text === 'wc -l') return [unknown(1, 1)];- if (name === 'wc' && args[0] === '-l' && args.length > 1) {- // One count line per literal in-cwd file, plus a total for several.+ if (name === 'wc' && (args[0] === '-l' || args[0] === '-c') && args.length > 1) {+ // One line or byte count line per literal in-cwd file, plus a total for several.if (args.slice(1).some(operand => !scopedFile(operand, scope))) return undefined;const lines = args.length - 1 + (args.length > 2 ? 1 : 0);return [unknown(lines, lines)];diff --git a/test/helpers/docsync-contract.ts b/test/helpers/docsync-contract.tsindex 5aa102ba9..7365a2fa8 100644--- a/test/helpers/docsync-contract.ts+++ b/test/helpers/docsync-contract.ts@@ -15,8 +15,9 @@ const keys = ['schema_version', 'audit_id', 'status', 'files_updated', 'files_reexport function parseDocsCompletion(output: string, auditId: string): DocsCompletion {const result = JSON.parse(output.trimEnd().split('\n').at(-1)!);- if (!result || Array.isArray(result) || typeof result !== 'object' ||- Object.keys(result).sort().join() !== [...keys].sort().join()) throw new Error('completion fields');+ if (!result || Array.isArray(result) || typeof result !== 'object') throw new Error('completion fields');+ const missing = keys.filter(key => !Object.hasOwn(result, key)), extra = Object.keys(result).filter(key => !keys.includes(key));+ if (missing.length || extra.length) throw new Error(`completion fields: missing ${missing.join(',') || 'none'}; extra ${extra.join(',') || 'none'}`);if (result.schema_version !== 1 || result.audit_id !== auditId) throw new Error('completion identity');if (!['updated', 'current', 'blocked'].includes(result.status)) throw new Error('completion status');for (const field of ['files_updated', 'files_reviewed', 'blockers', 'decisions']) {diff --git a/test/helpers/free-fixtures-data.ts b/test/helpers/free-fixtures-data.tsindex ed3261e35..a78b3ffca 100644--- a/test/helpers/free-fixtures-data.ts+++ b/test/helpers/free-fixtures-data.ts@@ -66,6 +66,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {'test/fixtures/cookie-judge-train42-replies.json': ['test/cookie-workflow-judge-input.test.ts'],'test/fixtures/coverage-audit-cd-chain.json': ['test/coverage-audit-evidence.test.ts'],'test/fixtures/coverage-audit-parallel-column.json': ['test/coverage-audit-evidence.test.ts'],+ 'test/fixtures/coverage-audit-plan-eng-wc-bytes.json': ['test/coverage-audit-evidence.test.ts'],'test/fixtures/coverage-audit-separator-collision.json': ['test/coverage-audit-evidence.test.ts'],'test/fixtures/coverage-audit-summary.json': ['test/coverage-audit-evidence.test.ts'],'test/fixtures/coverage-audit-two-file-grep.json': ['test/coverage-audit-evidence.test.ts'],@@ -121,6 +122,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {'test/fixtures/docsync-replay/37237194905-late-result-calls.json': ['test/docsync-authority.test.ts'],'test/fixtures/docsync-replay/37239016858-completion-native.json': ['test/docsync-nested-writes.test.ts'],'test/fixtures/docsync-ship-receipt-not-found-public.json': ['test/docsync-lifecycle-interface.test.ts'],+ 'test/fixtures/docsync-spawned-missing-section-public.json': ['test/ship-document-release-dispatch.test.ts'],'test/fixtures/docsync-store-38969924945-bash.json': ['test/docsync-command-grammar.test.ts'],'test/fixtures/docsync-two-attempts-public.json': ['test/ship-document-release-dispatch.test.ts'],'test/fixtures/dx-manual-handoff-ao.json': ['test/plan-count-completion.test.ts'],diff --git a/test/ship-document-release-dispatch.test.ts b/test/ship-document-release-dispatch.test.tsindex 70edc8a32..ffb9bb4f4 100644--- a/test/ship-document-release-dispatch.test.ts+++ b/test/ship-document-release-dispatch.test.ts@@ -11,6 +11,7 @@ import { observeDocsWrites, docsWriteFailures, docsCommandAllowed, docsPreambleCimport { docsActorCommand, docsActorHook, installDocsActor, type DocsActorState, type DocsFault } from './helpers/docsync-fault-actor';import { docsActorVerdict } from './helpers/docsync-fault-eval';import { expectMentions, expectTokens } from './helpers/prompt-structure';+import missingSection from './fixtures/docsync-spawned-missing-section-public.json';const ROOT = path.join(import.meta.dir, '..');const read = (p: string) => fs.readFileSync(path.join(ROOT, p), 'utf8');@@ -657,3 +658,23 @@ describe('two-attempt documentation audits', () => {expect(docsDispatchIndex(calls.filter((_, index) => !dispatches.includes(index)))).toBe(-1);});});++// Gates 41217563527 and 41238366045 (docsync-spawned): the child returned every field+// except documentation_section, and the red read only "completion fields".+describe('completion field failures name the fields', () => {+ test('the captured spawned completions name the omitted documentation_section; the reruns parse', () => {+ for (const { run, attempt, recordedPassed, output } of missingSection.outputs) {+ const auditId = JSON.parse(output.trimEnd().split('\n').at(-1)!).audit_id;+ if (recordedPassed) expect(parseDocsCompletion(output, auditId).status, run + attempt).toBe('blocked');+ else expect(() => parseDocsCompletion(output, auditId), run + attempt).toThrow('completion fields: missing documentation_section; extra none');+ }+ });++ test('an extra or legacy field is named too', () => {+ const accepted = missingSection.outputs.find(row => row.recordedPassed)!.output;+ const report = JSON.parse(accepted.trimEnd().split('\n').at(-1)!);+ expect(() => parseDocsCompletion(JSON.stringify({ ...report, commit_sha: null }), report.audit_id)).toThrow('completion fields: missing none; extra commit_sha');+ const { files_reviewed: _, ...rest } = report;+ expect(() => parseDocsCompletion(JSON.stringify({ ...rest, pushed: false }), report.audit_id)).toThrow('completion fields: missing files_reviewed; extra pushed');+ });+});