Skip to content

test(cli): point PATH at the fixture so uninstall isolation holds on any machine - #2041

Open
CaptainMittens wants to merge 2 commits into
DeusData:mainfrom
CaptainMittens:test/cli-uninstall-path-isolation
Open

test(cli): point PATH at the fixture so uninstall isolation holds on any machine#2041
CaptainMittens wants to merge 2 commits into
DeusData:mainfrom
CaptainMittens:test/cli-uninstall-path-isolation

Conversation

@CaptainMittens

Copy link
Copy Markdown
Contributor

What this changes

One test moved HOME and CBM_CACHE_DIR into a temporary directory but left PATH alone.
This points PATH at the same fixture and restores it afterwards, using the
save_test_env / restore_test_env pair that the Copilot and VS Code tests in this file
already use. Ten added lines, one test, no production code.

Why the test failed

Agent detection reads PATH before anything else, so a real agent binary on the
developer's machine is found even though HOME points at an empty fixture. uninstall
then tries to edit that agent's config file inside the fixture, fails because the fixture
never created one, and stops before removing the binary and the index — which is the thing
cli_uninstall_quiesces_active_cohort_before_removing_binary_and_index measures.

On my machine the agent is Goose, at /Users/<me>/go/bin/goose:

error: agent_config agent=Goose op=mcp_uninstall path=/tmp/cli-daemon-uninstall-7gY0EY/.config/goose/config.yaml (target: does not exist or cannot be inspected)
error: one or more agent cleanup operations failed; executable and index removal were not started

The test then fails on ASSERT_EQ(rc, 0) with rc == 1.

Evidence

Same tree, same built test-runner, only PATH differs:

Run Result
goose on PATH, before this change 291 passed, 1 failed
goose removed from PATH, before this change 292 passed, 0 failed
goose on PATH, after this change 292 passed, 0 failed

The third row is the one that matters: the suite is green while goose is still installed
and still on PATH, so the fix is the redirect rather than a quieter environment.

This does not fix the underlying defect

The abort it exposed is real, and I reported it on #1954, which already tracks the same
abort reached through a symlinked Cursor config. One agent config that cannot be edited
stops teardown for every other agent and for the executable and indexes. That wants a
product decision I did not want to make for you — treat "nothing to remove" as success at
the two call sites, or keep it an error that no longer gates the executable and index
removal — so this PR only stops the test suite from depending on what the developer has
installed.

Scope I deliberately left alone

Fourteen tests call cli_activation_save_env. Twelve leave PATH open the same way; only
cli_install_config_failure_keeps_published_binary and
cli_update_already_current_does_not_quiesce_sessions redirect it today.

I changed only the one that demonstrably fails. The other eleven pass on this machine, and
redirecting PATH in a passing test changes what it exercises, so I did not want to do that
without a failure to point at. Happy to send that as a follow-up if you would rather have
the whole class covered at once.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ERsNp8UNLaixL4uUz7hRTX

…any machine

cli_uninstall_quiesces_active_cohort_before_removing_binary_and_index moved
HOME and CBM_CACHE_DIR into a temporary directory but left PATH alone. Agent
detection reads PATH first, so a real agent binary on the developer's machine
was found even though HOME pointed at the empty fixture. Uninstall then tried
to edit that agent's config file inside the fixture, failed because the fixture
never created one, and stopped before removing the binary and the index. The
test measures exactly that removal, so it failed.

On this machine the agent is Goose, at /Users/<me>/go/bin/goose. Same tree and
same built runner, only PATH differs:

  goose on PATH        291 passed, 1 failed
  goose off PATH       292 passed, 0 failed

With this change the suite reports 292 passed, 0 failed while goose is still on
PATH, so the fix is the redirect and not a quieter environment.

This only stops the suite from depending on what the developer has installed.
The abort it exposed is a real defect and is reported in DeusData#1954: one agent config
that cannot be edited stops teardown for every other agent and for the
executable and indexes.

Eleven other tests that call cli_activation_save_env leave PATH open the same
way. They pass today, so I left them alone rather than change what they
exercise without evidence.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Joshua Richter <jrichter5781@gmail.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

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. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants