test.sh: refuse the cli suite against a real HOME - #1804
Open
lgerard42 wants to merge 1 commit into
Open
Conversation
The cli suite installs and uninstalls agent configurations for real. HOME
isolation is per-test — tests/test_cli.c calls cbm_setenv("HOME", ...) 58 times,
scripts/test.sh sets it none — so the suite acts on whatever HOME it inherits,
and its results outside isolation are unreliable: running it against a real HOME
produced different failure counts on consecutive runs, all in the agent-config
install/uninstall tests (OpenClaw, VS Code, Gemini, Augment, CodeBuddy/Pochi),
where the same tree under an isolated HOME reported a stable baseline.
test.sh now exits 2 when the cli suite is selected and $HOME contains .claude or
.claude.json, printing the isolated command to use. Default mode is covered too,
since it runs every suite. CBM_ALLOW_REAL_HOME=1 overrides for anyone who wants
the old behaviour.
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
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.
Why
The
clisuite installs and uninstalls agent configurations for real — it callscbm_cmd_installandcbm_cmd_uninstall, not mocks, across 53 call sites.HOMEisolation is per-test rather than global:tests/test_cli.ccallscbm_setenv("HOME", tmpdir, 1)58 separate times, andscripts/test.shsetsHOMEzero times. So the suite acts on whateverHOMEit inherits, and the safety of a run depends on every individual test remembering — including the ones that fail partway.The observable consequence is that results outside isolation are not trustworthy. Running the suite against a real
$HOMEon my machine gave different failure counts on consecutive runs, and the tests that moved were exactly the agent-config ones — OpenClaw, VS Code, Gemini, Augment, CodeBuddy/Pochi. The same tree underHOME=$(mktemp -d)was stable at the baseline every time.I am not claiming a specific test damages a real config — I tried to reproduce that and could not, twice, against increasingly faithful copies of the home directory in question. The argument here is narrower and I think uncontroversial: a suite that installs and uninstalls agent configurations should not be pointed at a developer's own one by default, and its results there are unreliable regardless.
What this does
scripts/test.shexits 2 when theclisuite is selected and$HOMEcontains.claudeor.claude.json, printing the isolated command to use. Default mode (no--suites) is covered too, since it runs every suite.CBM_ALLOW_REAL_HOME=1overrides for anyone who wants the current behaviour.CI is unaffected in the normal case: a runner whose
$HOMEhas no.claudenever trips it, and the override is available if yours does.Verified in this tree: refuses
--suites clion a real HOME with exit 2, permits--suites discoverthere, and permits--suites cliunder an isolated HOME.Happy to gate it differently — a warning instead of a refusal, or a different env var name — if you would rather.