fix(test): pin GSTACK_HOME in the slug walk-up cache tests

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 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-16 12:33:41 -07:00
co-authored by Claude Fable 5
parent 5af4a03b13
commit bd0cdbbf19
+6 -1
View File
@@ -39,9 +39,14 @@ function runSlug(
tmpHome: string,
extraEnv: Record<string, string> = {},
): SpawnSyncReturns<string> {
// 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,