test(cli): isolate fixtures from inherited scan-path env vars - #647
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
cmd_with_home / cmd_with_home_hermetic set HOME and XDG dirs but left TOKSCALE_EXTRA_DIRS, TOKSCALE_HEADLESS_DIR and CODEX_HOME inherited from the developer's shell. A dev who exports e.g. TOKSCALE_EXTRA_DIRS=~/.codex/sessions (for codefuse mirror tracking) makes the codex scanner read real session data inside the fixtures, so fixture-count assertions like test_models_group_by_workspace_model_surfaces_workspace_fields_for_codex fail (entries 50 vs 1) locally while passing on CI's clean env. Clear those three scan-path overrides in both helpers so tests are hermetic regardless of the dev's shell. Tests that need CODEX_HOME set it explicitly afterwards, so the removal is overridden where intended. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
junhoyeo
force-pushed
the
contrib/test-isolation-extra-dirs
branch
from
May 31, 2026 19:46
c8b29a1 to
9a92278
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
cmd_with_homesetsHOMEand the XDG dirs but leavesTOKSCALE_EXTRA_DIRS,TOKSCALE_HEADLESS_DIRandCODEX_HOMEinherited from the developer's shell.A contributor who uses tokscale to track their own usage — e.g.
export TOKSCALE_EXTRA_DIRS=...:~/.codex/sessions— makes the codex scanner read real session data from inside the test fixtures. Fixture-count assertions then fail locally while passing on CI's clean env. Concretely:Confirmed by toggling the var: with
TOKSCALE_EXTRA_DIRSunset the test passes; with it set it fails — independent of any source change.Fix
Clear the three inherited scan-path overrides (
TOKSCALE_EXTRA_DIRS,TOKSCALE_HEADLESS_DIR,CODEX_HOME) incmd_with_homeso tests are hermetic regardless of the dev's shell. Tests that needCODEX_HOMEset it explicitly afterwards, so the removal is overridden where intended.Verification
TOKSCALE_EXTRA_DIRSstill exported in the shell.cargo test -p tokscale-clisuite green (no regression in theCODEX_HOME-setting tests).🤖 Generated with Claude Code
Summary by cubic
Make CLI tests hermetic by clearing inherited scan-path and tool-home env vars in
cmd_with_homeandoffline_cmd_with_home. Prevents real Codex session data and other artifacts from leaking into fixtures and fixes local count assertions.cargo test -p tokscale-cliremains green.Written for commit 9a92278. Summary will update on new commits.