From bd0cdbbf195796ca72085f6e9c624e944f6d095a Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sun, 16 Aug 2026 12:33:41 -0700 Subject: [PATCH] fix(test): pin GSTACK_HOME in the slug walk-up cache tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cache dir became GSTACK_HOME-aware; these tests seed and assert cache files under a temp HOME but spread the ambient env, so a sibling test leaking process.env.GSTACK_HOME in a shared-process shard pointed the bin at a different cache than the one under assertion (AC-2/AC-6 failed in shard context, passed solo). The env now pins GSTACK_HOME to the temp home — verified identical results with and without a simulated ambient leak. Co-Authored-By: Claude Fable 5 --- test/gstack-slug-cwd-walk-up.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/gstack-slug-cwd-walk-up.test.ts b/test/gstack-slug-cwd-walk-up.test.ts index 96db5e303..b129b8e79 100644 --- a/test/gstack-slug-cwd-walk-up.test.ts +++ b/test/gstack-slug-cwd-walk-up.test.ts @@ -39,9 +39,14 @@ function runSlug( tmpHome: string, extraEnv: Record = {}, ): SpawnSyncReturns { + // GSTACK_HOME must be pinned to the temp home too: the cache dir is + // GSTACK_HOME-aware (matching lib/bin-context.ts's native port), and a + // sibling test file leaking process.env.GSTACK_HOME in a shared-process + // shard would otherwise point the bin at a different cache than the one + // these tests seed and assert on. // Scrub PATH so we always use system bash + system git; pass HOME so the // script's cache writes land in tmpHome, never AJ's real ~/.gstack. - const env = { ...process.env, HOME: tmpHome, ...extraEnv }; + const env = { ...process.env, HOME: tmpHome, GSTACK_HOME: path.join(tmpHome, '.gstack'), ...extraEnv }; return spawnSync('bash', [SCRIPT], { cwd, env,