tests/loop-hooks-verify-post-e2e.test.cjs's runCli stripped ambient GSD_* env vars but never sandboxed HOME, so the spawned gsd-tools CLI subprocess fell through to os.homedir() (capability-loader.cts's overlayRoots and capability-state.cts's resolveCapabilityRuntimeState both thread process.env['GSD_HOME'], which falls back to os.homedir() when unset). Any capability genuinely installed at ~/.gsd/capabilities on the machine running the suite (e.g. beads, markdown-linting) leaked into the verify:post registry and inflated the file's exact-count assertions (3 -> 5 active hooks, 0 -> 2 on the all-off case, etc). Switch runCli to helpers.cjs's installSpawnEnv(), the helper ~370 other test files already use for this: it sandboxes HOME/USERPROFILE to a per-file mkdtemp'd fixture and clears the full config-location env list (GSD_HOME, GSD_RUNTIME, CLAUDE_CONFIG_DIR, etc.), so the CLI subprocess sees only the core registry regardless of what's installed on the host. The pure resolveLoopHooks() tests in the same file were already unaffected — they call the resolver directly with realRegistry, bypassing CLI env resolution entirely. Fixes #4204 Co-authored-by: Test <test@test.com> Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
24 KiB
24 KiB