tests: never touch the user's real config, cache, or keychain
main·
Commit

A test fixture (bob@core.example.com) leaked into a developer's real ~/.config/entire/contexts.json. Unit tests isolated config access only by per-test convention (t.Setenv), and the integration/e2e harnesses spawned the real entire binary with the developer's real environment — no ENTIRE_CONFIG_DIR, no XDG_CACHE_HOME, real HOME, real OS keychain.
Defense in depth:
- internal/testdirs (new): under
go test, resolution of the config dir, cache dir, and token store falls back to a throwaway per-process temp directory when the explicit env override is unset, so an unisolated test can never read or write real user state. - Wired into contexts.DefaultConfigDir, discovery.DefaultCacheDir, versioncheck, and the tokenstore default backend (which previously defaulted to the real OS keyring even under test).
- versioncheck now honors ENTIRE_CONFIG_DIR before falling back to ~/.config/entire, so one env var isolates every config-dir surface.
- Integration and e2e TestMains export ENTIRE_CONFIG_DIR, XDG_CACHE_HOME, and file-backed token-store env vars process-wide; spawned binaries (where testing.Testing() is false) inherit them through every os.Environ()-based env builder.
- CLAUDE.md documents the isolation rules for future harnesses.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com Entire-Checkpoint: 83fe3fd21287
Checkpoints
Checkpoint 1