From acf92de6e27dd670613c06b59544df6914e515fd Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Fri, 15 May 2026 14:42:14 -0400 Subject: [PATCH] test(3566): remove raw-text greps from codex hooks regression --- ...codex-hooks-feature-canonical-key.test.cjs | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/tests/bug-3566-codex-hooks-feature-canonical-key.test.cjs b/tests/bug-3566-codex-hooks-feature-canonical-key.test.cjs index dc5bd8c5f..301c50994 100644 --- a/tests/bug-3566-codex-hooks-feature-canonical-key.test.cjs +++ b/tests/bug-3566-codex-hooks-feature-canonical-key.test.cjs @@ -86,7 +86,7 @@ describe('#3566 — Codex feature flag is canonical "hooks" (not legacy "codex_h test('fresh install writes [features].hooks = true and never emits codex_hooks', () => { withCodexHome(codexHome, () => install(true, 'codex')); - const { text, parsed } = readConfig(codexHome); + const { parsed } = readConfig(codexHome); assert.strictEqual( featuresHooks(parsed), @@ -98,15 +98,6 @@ describe('#3566 — Codex feature flag is canonical "hooks" (not legacy "codex_h undefined, 'fresh install must NOT write legacy [features].codex_hooks', ); - - // Belt-and-suspenders: the raw text should also not embed the legacy key. - // (Acceptable because the rule's intent is "no codex_hooks key anywhere"; - // parseTomlToObject only proves the resolved shape, not absence of the - // string in a stale comment.) - assert.ok( - !/^\s*codex_hooks\s*=/m.test(text) && !/^\s*features\.codex_hooks\s*=/m.test(text), - `raw config.toml must not contain a codex_hooks assignment, got:\n${text}`, - ); }); test('install over a pre-existing legacy [features].codex_hooks line preserves it (user-owned, #2760 defensive)', () => { @@ -153,20 +144,13 @@ describe('#3566 — Codex feature flag is canonical "hooks" (not legacy "codex_h fs.writeFileSync(path.join(codexHome, 'config.toml'), userOwned); withCodexHome(codexHome, () => install(true, 'codex')); - const { text, parsed } = readConfig(codexHome); + const { parsed } = readConfig(codexHome); assert.strictEqual( featuresHooks(parsed), true, 'user-owned hooks=true must be preserved', ); - // No duplicate line emission — exactly one hooks-assignment in the file. - const hooksAssignments = text.match(/^\s*hooks\s*=/gm) || []; - assert.strictEqual( - hooksAssignments.length, - 1, - `expected exactly one hooks = assignment, got ${hooksAssignments.length}`, - ); }); test('uninstall removes GSD-owned canonical hooks line but preserves user-owned hooks', () => {