From 40bec23eba4e56d1629c407c831cb99119f78340 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sat, 29 Aug 2026 15:21:22 +0000 Subject: [PATCH] fix(test): close the cross-shard porcelain race that failed Windows CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two-part fix for the gen-skill-docs-out-dir isolation-pin failure: - cookie-import-browser built its scratch cookie DBs inside the TRACKED browse/test/fixtures/ dir (created in beforeAll, deleted in afterAll), so they flash as untracked files mid-run — a concurrent shard's porcelain snapshot caught the window on Windows. The DBs now live in a per-run tmpdir; zero source-tree writes. - gen-skill-docs-out-dir is the free suite's only LIVE porcelain-snapshot test, so it joins TREE_MUTATING (the serial quiet window): any concurrent transient tree-write can race it, and its own spawned render rewrites llms.txt/agents-digest in place (idempotent on a fresh tree). The race is pre-existing; this branch's +5 test files reshuffled shard composition and exposed it. Co-Authored-By: Claude Fable 5 --- browse/test/cookie-import-browser.test.ts | 8 ++++++-- scripts/test-free-shards.ts | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/browse/test/cookie-import-browser.test.ts b/browse/test/cookie-import-browser.test.ts index 5e9a5b441..ccf8e88b1 100644 --- a/browse/test/cookie-import-browser.test.ts +++ b/browse/test/cookie-import-browser.test.ts @@ -31,8 +31,12 @@ const LINUX_V11_KEY = crypto.pbkdf2Sync(LINUX_V11_PASSWORD, 'saltysalt', 1, 16, const IV = Buffer.alloc(16, 0x20); const CHROMIUM_EPOCH_OFFSET = 11644473600000000n; -// Fixture DB path -const FIXTURE_DIR = path.join(import.meta.dir, 'fixtures'); +// Fixture DB path — a per-run temp dir, NEVER the tracked browse/test/fixtures/: +// these DBs are built in beforeAll and deleted in afterAll, so writing them +// into the source tree makes them flash as `??` in git status mid-run, which +// races any concurrent shard's tree-isolation porcelain snapshot (observed: +// gen-skill-docs-out-dir's before/after porcelain pin on Windows CI). +const FIXTURE_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'browse-cookie-fixtures-')); const FIXTURE_DB = path.join(FIXTURE_DIR, 'test-cookies.db'); const LINUX_FIXTURE_DB = path.join(FIXTURE_DIR, 'test-cookies-linux.db'); diff --git a/scripts/test-free-shards.ts b/scripts/test-free-shards.ts index 1762bbee3..d0bd8989e 100755 --- a/scripts/test-free-shards.ts +++ b/scripts/test-free-shards.ts @@ -407,6 +407,8 @@ export const TREE_MUTATING: Record = { 'golden tests read .agents/.factory artifacts produced by gen-skill-docs.test.ts, and its beforeAll generates them when missing (#2532) — must not race the parallel readers or run before the mutators window', 'test/catalog-trim.test.ts': 'imports scripts/gen-skill-docs.ts, whose top-level body regenerates the full claude host at import time (71 files; idempotent on a fresh tree, but a stale tree gets rewritten mid-window) — same hazard class as #2532', + 'test/gen-skill-docs-out-dir.test.ts': + 'PORCELAIN READER — its before/after git-status pin needs a quiet tree (a concurrent shard\'s transient fixture write raced it on Windows CI), and its spawned render rewrites llms.txt/agents-digest in place (idempotent on a fresh tree)', // Ratchet readers (measure the tree; need it quiet): 'test/parity-suite.test.ts': 'RATCHET READER — parity caps measure live SKILL.md/section bytes', 'test/skill-size-budget.test.ts': 'RATCHET READER — per-skill and corpus size budgets measure the live tree',