From a54802dc6e3f84a0135a10dec033b99850dc7543 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Mon, 17 Aug 2026 11:06:02 -0700 Subject: [PATCH] test: align cross-cutting pins with the wave's contracts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three suites pinned pre-wave behavior: browse's gstack-config test asserted the old unknown-key ''/exit-0 shape (#2611 made it exit 1); the Windows-paths suite pinned O_APPEND enqueue atomicity (the spool design satisfies the same invariant via tmp + os.replace, one file per record — pinned in its new form); and nine carve-guard skeleton ceilings absorbed the #2402 unconditional-learnings prose (~450B per skill), bumped with measured values per the guard's own protocol. Co-Authored-By: Claude Fable 5 --- browse/test/gstack-config.test.ts | 10 ++++++---- test/brain-sync-windows-paths.test.ts | 12 ++++++++---- test/helpers/carve-guards.ts | 18 +++++++++--------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/browse/test/gstack-config.test.ts b/browse/test/gstack-config.test.ts index bb8da531a..097e25f75 100644 --- a/browse/test/gstack-config.test.ts +++ b/browse/test/gstack-config.test.ts @@ -56,9 +56,11 @@ describe('gstack-config', () => { expect(stdout).toBe('false'); }); - test('get unknown key on missing file returns empty, exit 0', () => { + test('get unknown key on missing file returns empty, exit 1 (#2611)', () => { + // #2611: an unknown key exits 1 so `|| echo fallback` callers can fire — + // "" with exit 0 was indistinguishable from a real empty value. const { exitCode, stdout } = run(['get', 'some_unknown_key']); - expect(exitCode).toBe(0); + expect(exitCode).toBe(1); expect(stdout).toBe(''); }); @@ -69,10 +71,10 @@ describe('gstack-config', () => { expect(stdout).toBe('true'); }); - test('get missing key returns empty', () => { + test('get missing key returns empty, exit 1 (#2611)', () => { writeFileSync(join(stateDir, 'config.yaml'), 'auto_upgrade: true\n'); const { exitCode, stdout } = run(['get', 'nonexistent']); - expect(exitCode).toBe(0); + expect(exitCode).toBe(1); expect(stdout).toBe(''); }); diff --git a/test/brain-sync-windows-paths.test.ts b/test/brain-sync-windows-paths.test.ts index 021532d07..73c13f14d 100644 --- a/test/brain-sync-windows-paths.test.ts +++ b/test/brain-sync-windows-paths.test.ts @@ -48,11 +48,15 @@ describe('gstack-brain-sync — Windows path/exec invariants', () => { expect(SRC.indexOf(CR_STRIP)).toBeLessThan(SRC.indexOf('add -f -- "$p"')); }); - test('inline enqueue appends one atomic record at a time (codex P2 #1)', () => { - expect(SRC).toContain('os.O_APPEND'); - expect(SRC).toContain('os.write(fd'); - // No buffered batch write to the queue (the interleave-corruption shape). + test('inline enqueue writes one atomic record at a time (codex P2 #1, spool form)', () => { + // The invariant is per-record write atomicity (no interleave corruption). + // Pre-spool this was O_APPEND on the shared queue file; the spool design + // satisfies it more strongly: one FILE per record, tmp write + atomic + // os.replace — nothing shared to interleave. + expect(SRC).toContain('os.replace(tmp'); + // No shared-file append anywhere (the interleave-corruption shape). expect(SRC).not.toContain('open(queue_path, "a"'); + expect(SRC).not.toContain('os.O_APPEND'); }); test('skip-list is normalized on BOTH discover and drain sides (codex P2 #2)', () => { diff --git a/test/helpers/carve-guards.ts b/test/helpers/carve-guards.ts index 5aef53296..f665248c2 100644 --- a/test/helpers/carve-guards.ts +++ b/test/helpers/carve-guards.ts @@ -126,7 +126,7 @@ export const CARVE_GUARDS: Record = { }, behavioral: 'external', externalTest: 'test/skill-e2e-ship-section-loading.test.ts', - maxSkeletonBytes: 90_800, // v1.67 wave + v1.66.1's evidence-ledger prose (merged): measured 90,333 + maxSkeletonBytes: 91_600, // v1.68 fix wave: unconditional learnings capture (#2402, ~450B/skill); measured 91,061 minUnionBytes: 120_000, mustContain: ['VERSION', 'CHANGELOG', 'review', 'merge', 'PR'], // v1.58.5.0: pre-push-guard install (#2077) stacks on the shared first-run-guidance preamble. @@ -157,7 +157,7 @@ export const CARVE_GUARDS: Record = { // v1.65 merge: provisional larger-of-both-waves budget; re-measured below. // Fork port wave 2 (#703): the repo-doc-preference block in the design // check grew every plan-review skeleton ~0.7KB. Measured values noted. - maxSkeletonBytes: 93_000, // v1.67 fix wave: #2499 jq entry-resolution in the brain-sync preamble (~340B/skill) + wave doc additions; measured 92,531 + maxSkeletonBytes: 93_900, // v1.68 fix wave: #2402 learnings capture + spool queue-depth lines; measured 93,345 minUnionBytes: 80_000, mustContain: ['SCOPE EXPANSION', 'SELECTIVE EXPANSION', 'HOLD SCOPE', 'SCOPE REDUCTION'], // Default-on Codex outside-voice (codexPreflight block + CODEX_MODE branch @@ -183,7 +183,7 @@ export const CARVE_GUARDS: Record = { // check grew every plan-review skeleton ~0.7KB. Measured values noted. // #2499 project-scope MCP jq in the brain-sync block grew every tier-2+ // skeleton ~1.5KB (entry resolution emitted once per SKILL.md). - maxSkeletonBytes: 70_500, // measured 70,318 + maxSkeletonBytes: 71_800, // v1.68 fix wave (#2402); measured 71,228 minUnionBytes: 70_000, mustContain: ['Architecture', 'Code Quality', 'Test', 'Performance'], // Cross-cutting preamble growth (v1.57.2.0 AUQ-failure prose fallback + the @@ -216,7 +216,7 @@ export const CARVE_GUARDS: Record = { // tier-2+ skeleton (measured 89,184). Main's v1.64.0.0 adds ~340 B more // (telemetry --error-message/--failed-step preamble prose, PR #769). // Budget covers the sum of both waves. - maxSkeletonBytes: 91_000, + maxSkeletonBytes: 91_700, // v1.68 fix wave (#2402); measured 91,176 minUnionBytes: 70_000, mustContain: ['design', 'visual'], maxSizeRatio: 1.12, // D1 1.104 + main's ~0.008 @@ -240,7 +240,7 @@ export const CARVE_GUARDS: Record = { // check grew every plan-review skeleton ~0.7KB. Measured values noted. // #2499 project-scope MCP jq in the brain-sync block grew every tier-2+ // skeleton ~1.5KB (entry resolution emitted once per SKILL.md). - maxSkeletonBytes: 82_500, // measured 82,031 + maxSkeletonBytes: 83_500, // v1.68 fix wave (#2402); measured 82,941 minUnionBytes: 70_000, mustContain: ['developer experience', 'Getting Started'], // Default-on Codex outside-voice (codexPreflight block + CODEX_MODE branch @@ -270,7 +270,7 @@ export const CARVE_GUARDS: Record = { // the #538 opt-out + D1 evidence directive — ratio 1.104 measured. // #2499 project-scope MCP jq in the brain-sync block grew every tier-2+ // skeleton ~1.5KB (entry resolution emitted once per SKILL.md). - maxSkeletonBytes: 101_500, // measured 101,314 + maxSkeletonBytes: 102_800, // v1.68 fix wave (#2402); measured 102,220 minUnionBytes: 70_000, mustContain: ['design doc', 'problem statement'], maxSizeRatio: 1.12, @@ -291,7 +291,7 @@ export const CARVE_GUARDS: Record = { // +Conductor AUQ-default-prose rule + one-way/continuation safety in the // always-loaded AskUserQuestion Format section. // v1.2.0 activation lift: first-run-guidance section in the shared preamble. - maxSkeletonBytes: 57_000, // v1.67 fix wave: #2499 preamble growth; measured 56,571 + maxSkeletonBytes: 57_900, // v1.68 fix wave (#2402); measured 57,385 minUnionBytes: 55_000, mustContain: ['CHANGELOG', 'Diataxis', 'coverage'], // Two intentional additions stack on this small skill: the AUQ-failure prose @@ -322,7 +322,7 @@ export const CARVE_GUARDS: Record = { // v1.65 merge: provisional larger-of-both-waves budget; re-measured below. // v1.64.1.0: shared-preamble prose from the two parallel v1.64 waves lands // the skeleton at 69,022 B; +~1 KB headroom. - maxSkeletonBytes: 70_500, // v1.67 fix wave: #2499 preamble growth; measured 70,003 + maxSkeletonBytes: 71_400, // v1.68 fix wave (#2402); measured 70,815 minUnionBytes: 72_000, mustContain: ['Typography', 'Color', 'Aesthetic Direction'], // Cross-cutting preamble growth (v1.57.2.0 AUQ-failure prose fallback ~2KB + @@ -362,7 +362,7 @@ export const CARVE_GUARDS: Record = { // +Conductor AUQ-default-prose rule + one-way/continuation safety in the // always-loaded AskUserQuestion Format section. // v1.2.0 activation lift: first-run-guidance section in the shared preamble. - maxSkeletonBytes: 76_400, // v1.67 fix wave: #2499 preamble growth; measured 75,891 + maxSkeletonBytes: 77_300, // v1.68 fix wave (#2402); measured 76,705 minUnionBytes: 72_000, mustContain: ['OWASP', 'STRIDE', 'daily', 'comprehensive', 'verif'], // cso keeps its mode-dispatch + FP-filtering phases always-loaded, so the