test: sandbox HOME in test_claude_md.py so uninstall tests cannot delete the real user skill#2057
Open
erlandl4g wants to merge 3 commits into
Open
test: sandbox HOME in test_claude_md.py so uninstall tests cannot delete the real user skill#2057erlandl4g wants to merge 3 commits into
erlandl4g wants to merge 3 commits into
Conversation
…ete the real user skill claude_uninstall() removes the USER-scope skill tree (~/.claude/skills/ graphify) since Graphify-Labs#1121, but this file's uninstall tests predate that and called it with no Path.home isolation. Running the suite on a dev machine deleted the developer's real installed skill; where that path is a symlink into a git checkout (Skills claude_config/skills/graphify), it silently deleted tracked files (2026-07-19 22:01 UTC nightly-audit incident). Autouse fixture redirects both pathlib.Path.home and HOME into tmp_path so every current and future test in this file is home-isolated, including subprocess-based helpers. Also clears CLAUDE_CONFIG_DIR, the second env escape hatch install.py's claude-platform resolver checks before Path.home() (caught in independent audit).
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.
claude_uninstall() removes the USER-scope skill tree (~/.claude/skills/ graphify) since #1121, but this file's uninstall tests predate that and called it with no Path.home isolation. Running the suite on a dev machine deleted the developer's real installed skill; where that path is a symlink into a git checkout (Skills claude_config/skills/graphify), it silently deleted tracked files (2026-07-19 22:01 UTC nightly-audit incident).
Autouse fixture redirects both pathlib.Path.home and HOME into tmp_path so every current and future test in this file is home-isolated, including subprocess-based helpers. Also clears CLAUDE_CONFIG_DIR, the second env escape hatch install.py's claude-platform resolver checks before Path.home() (caught in independent audit).