From 415a866a4eaac11434788ca1f6c70809dbc0104f Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sun, 16 Aug 2026 12:38:03 -0700 Subject: [PATCH] fix(test): the cache-hygiene test strips ambient GSTACK_PROJECT_SLUG Its env-less contract must be env-less: any ambient override leaking into a shared-process shard flips the run into override mode, which correctly skips the cache write the test asserts. Co-Authored-By: Claude Fable 5 --- test/gstack-slug-sanitize.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/gstack-slug-sanitize.test.ts b/test/gstack-slug-sanitize.test.ts index 9933ca01e..ab0eb0b7f 100644 --- a/test/gstack-slug-sanitize.test.ts +++ b/test/gstack-slug-sanitize.test.ts @@ -88,9 +88,13 @@ describe('slug cache hygiene', () => { test('an env-less run caches under GSTACK_HOME, not $HOME', () => { const home = fs.mkdtempSync(path.join(os.tmpdir(), 'slug-home-')); try { + // Strip any ambient override: a sibling test leaking + // GSTACK_PROJECT_SLUG in a shared-process shard would flip this run + // into override mode, which (correctly) skips the cache write. + const { GSTACK_PROJECT_SLUG: _drop, ...ambient } = process.env; const r = spawnSync(['bash', SLUG_BIN], { cwd: os.tmpdir(), - env: { ...process.env, GSTACK_HOME: home }, + env: { ...ambient, GSTACK_HOME: home }, }); expect(r.exitCode).toBe(0); const entries = fs.readdirSync(path.join(home, 'slug-cache'));