From 86eecdcb64fa43f8a67e870230a5f52a79865f16 Mon Sep 17 00:00:00 2001 From: sebi Date: Mon, 17 Aug 2026 00:15:58 -0500 Subject: [PATCH] fix(scripts): three more whole-repo scans were racing a 5s budget, and main went red MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `d44fa95` raised the budget on the repo-scanning tests that had been observed failing under an 8-way local split. CI shards SIX ways — the gate's own fix: line says `x test unit --workers 6 --worker 3` — which is a different split, different files per shard, different contention. So a test nobody had seen fail crossed the line on main: `manifest.test.ts`'s byte-identical check, whose body runs a second full `buildManifest(repoRoot())` on top of the one `beforeAll` already pays for. Raised with it, on the same reasoning rather than on observation, because a budget fixed one test at a time just relocates the failure to another shard on another run: the `registeredErrorCodes()` test, which dynamically imports every package exactly as `verify.test.ts`'s error-reference test does, and the `at` check, which is a couple hundred real file reads scattered across every package. Left alone deliberately: every test asserting over the already-built fixture, the single-file reads, and `boundaries.test.ts`'s `collectSharedFiles` / `collectAdminFiles` — measured at 155ms, 125ms and 145ms, two orders of magnitude under the default. The budget moves only where the scan is real. No test weakened, skipped or narrowed; every scan still runs in full. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01RBwWKBJkiogA4mDaJiJf3D --- scripts/manifest.test.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/manifest.test.ts b/scripts/manifest.test.ts index 4077a97ff..16e169077 100644 --- a/scripts/manifest.test.ts +++ b/scripts/manifest.test.ts @@ -46,11 +46,13 @@ const withEditedVersion = (manifest: FrameworkManifest): FrameworkManifest => ({ }); describe('unit · the framework manifest is generated, not written', () => { + // A SECOND full `buildManifest(repoRoot())` on top of the one `beforeAll` already ran — the + // comparison is the point, so the body pays the scan twice. Same shape as the hook above. test('two builds of one tree are byte-identical: no clock, no counter, no glob order', async () => { const again = await buildManifest(repoRoot()); expect(frameworkManifestJson(again)).toBe(frameworkManifestJson(fresh)); expect(again.buildId).toBe(fresh.buildId); - }); + }, 30_000); test('the generator actually finds the real packages and codes — not an empty list', () => { expect(fresh.packages.length).toBeGreaterThan(20); @@ -154,12 +156,16 @@ describe('unit · every code, not the ones in one filename per package', () => { * The independent check: the process-wide registry is built by importing every package and is * derived from nothing this generator reads. A registered code the manifest cannot name is * exactly the drift the old scan shipped — 17 of them, `X_ROLE_INVALID` and friends. + * + * `registeredErrorCodes()` dynamically imports every @ultimat3/* package — the same real, + * unavoidable import-graph cost as `scripts/verify.test.ts`'s `errorCodeDocs` test, so it gets + * the same budget for the same reason. */ test('every code x errors explain answers for is in the manifest', async () => { const listed = new Set(fresh.errorCodes.map((entry) => entry.code)); const missing = [...(await registeredErrorCodes())].filter((code) => !listed.has(code)).sort(); expect(missing).toEqual([]); - }); + }, 30_000); test('a code only a test file invents is not a code', () => { const codes = fresh.errorCodes.map((entry) => entry.code); @@ -169,7 +175,9 @@ describe('unit · every code, not the ones in one filename per package', () => { }); // `at` is load-bearing or it is decoration: every one has to point at a file that really is - // where that code is written. + // where that code is written. One `Bun.file().exists()` + `.text()` round trip per shipped + // code — a couple hundred real file reads scattered across every package in the repo, not one + // in-memory assertion — so it carries the same budget as the scans above. test('every `at` names a real file that really declares its code', async () => { const unreadable: string[] = []; for (const entry of fresh.errorCodes) { @@ -179,7 +187,7 @@ describe('unit · every code, not the ones in one filename per package', () => { } } expect(unreadable).toEqual([]); - }); + }, 30_000); }); describe('unit · the bytes on disk', () => {