From 799230873fe2a13ba8f26a923de2fa9ac6df71be Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Fri, 3 Jul 2026 03:14:33 -0400 Subject: [PATCH] test(#1976): scope GSD_TEST_MODE in folded bug-2990 block (adversarial review) Codex review: the folded bug-2990 block set process.env.GSD_TEST_MODE='1' at collection time, which persisted into sibling folded suites in agent-frontmatter.test.cjs (process-isolated when standalone). Scope it to before/after so it no longer leaks. Assertions unchanged. Co-Authored-By: Claude Opus 4.8 --- tests/agent-frontmatter.test.cjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/agent-frontmatter.test.cjs b/tests/agent-frontmatter.test.cjs index 94781f8e0..a5a0e283b 100644 --- a/tests/agent-frontmatter.test.cjs +++ b/tests/agent-frontmatter.test.cjs @@ -1204,7 +1204,14 @@ describe('bug #214: phase researcher must survive OpenCode write-tool truncation // fields from a known-shape product file, then assertions go against // those typed fields, not against the raw markdown text. -process.env.GSD_TEST_MODE = '1'; +// Consolidation #1969: scope GSD_TEST_MODE to this folded block so it does not +// leak into sibling folded suites in the shared file (was process-isolated when +// standalone). This unit suite only parses agent markdown, but keep the flag set +// for its own duration to preserve the origin behaviour, and restore it after. +const { before: __gtmBefore, after: __gtmAfter } = require('node:test'); +const __savedGsdTestMode = process.env.GSD_TEST_MODE; +__gtmBefore(() => { process.env.GSD_TEST_MODE = '1'; }); +__gtmAfter(() => { if (__savedGsdTestMode === undefined) delete process.env.GSD_TEST_MODE; else process.env.GSD_TEST_MODE = __savedGsdTestMode; }); /** * Bug #2990: gsd-code-fixer worktree setup fails when current branch