/** * GLOBAL TEST ISOLATION GUARD — preloaded before every test file. * * Wired in package.json as an `--import` hook that runs BEFORE the test module * (and therefore before its first import of config / schema / scheduler / any * module that resolves a path from the data dir): * * node --import tsx --import ./src/test-bootstrap.ts --test "src/**\/*.test.ts" * * Node's test runner re-spawns each test FILE in its own child process, passing * the parent's `--import` flags through to every child. So this runs once per * child, before any product code — isolation is STRUCTURAL, not per-file opt-in. * (Before this, only 7 of 21 test files set up a temp HOME by hand; a new test * that forgot the dance hit the live data dir.) * * WHY (2026-07-28 live-host incident): running the suite on the machine hosting * the live server let test children resolve `os.homedir()` to the REAL * `~/.remote-copilot-mcp` and open the production memory.db (WAL), rewrite * settings.json, and race server.log rotation — freezing the live MCP for ~20 * min until the supervisor restarted it. The earlier mitigation only redirected * LOGS (SENSORIUM_LOG_DIR); every other real path stayed exposed. * * This guard closes the whole hole three ways: * 1. SENSORIUM_BASE_DIR → a fresh per-run temp dir (the durable follow-up): * relocates memory.db, settings.json, schedules, heartbeats, pids, * active-sessions.json, files — see src/lib/paths.ts. * 2. HOME + USERPROFILE → the same temp dir (belt-and-suspenders): any path * that still reaches os.homedir() directly (session-store sibling file, * external-tool dirs, a call site not yet routed through paths.ts) also * lands in the throwaway dir. os.homedir() reads USERPROFILE on Windows and * HOME on POSIX, so both are set. * 3. A HARD REFUSAL: if the data dir still resolves to the real one, THROW * before a single test runs. The suite can never run against live state. * * Ports are already safe (the two HTTP tests bind port 0); nothing here needs to * touch them. */ export {}; //# sourceMappingURL=test-bootstrap.d.ts.map