Repository navigation
test(host-cli): dependency snapshot for ~/.claude/ path contract (closes #864) - #1183
bassilkhilo-ag2 wants to merge 1 commit into
Conversation
sonichi#864) Add tests/host-cli-dependency-snapshot.test.py — Mini's host-CLI discipline 3/3 (see sonichi#857, sonichi#858, sonichi#860). Two layers: A. Helper correctness (always runs in CI): - claude_home_path() defaults to ~/.claude/ - $CLAUDE_HOME env override respected - subpath joining produces expected paths B. Installed-path smoke check (skips if ~/.claude/ absent): - Key dirs exist on installed hosts (skills/, channel dirs) - Write contract: CLAUDE_HOME override lets callers redirect writes to a temp dir for tests + alt-host installs Catches Anthropic-side convention drift (e.g. Claude Code moving projects/ <hash>/memory/ to a new path) before users hit it. Safe to run in CI — existence checks gate on ~/.claude/ being present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
VasiliyRad
left a comment
There was a problem hiding this comment.
Clean. Single file, no unrelated changes. Tests guard a real contract: A1-A3 verify claude_home_path() default/override/subpath behaviour; B2 (write-contract) is the most valuable — proves $CLAUDE_HOME redirect works end-to-end for tests and alt-host installs. B1 gracefully skips in CI. One minor note: the importlib.reload() calls are unnecessary since CLAUDE_HOME is read at call time inside the function, not at module load — but harmless. Good addition for #864.
VasiliyRad
left a comment
There was a problem hiding this comment.
Solid two-layer snapshot. Layer A is pure helper correctness — claude_home_path() defaults + CLAUDE_HOME env override + importlib.reload(up) for env-clear hygiene. Layer B is the installed-path smoke that gracefully skips when ~/.claude/ is absent (CI-friendly). Catches Anthropic-side convention drift on the user-machine path early without forcing a CI dep on the real install. 1-file test, no bundled changes.
LGTM 👍
Problem
Issue #864 tracks Mini's host-CLI discipline 3/3: a snapshot test that catches Anthropic-side
~/.claude/convention drift early (e.g. if Claude Code reorganizesprojects/<hash>/memory/before users do).Prior disciplines landed: #860 added
claudeHomePath()helper (Python + TS). This PR adds the test that exercises it.Solution
tests/host-cli-dependency-snapshot.test.py— two test layers:A. Helper correctness (always runs in CI):
claude_home_path()defaults to~/.claude/$CLAUDE_HOMEenv override is respected~/.claude/channels/discord/access.jsonstyle pathsB. Installed-path smoke check (skips if
~/.claude/absent):skills/dir exists on installed hostsCLAUDE_HOMEwrite-contract: redirecting to a temp dir lets callers write and read back correctly (tests + alt-host installs)Layer B gracefully skips in CI (no real install). Channel dirs log an INFO note if absent (bridge may not be configured) without failing.
Test output
Passes in CI (no
~/.claude/→ B1 skips, all others pass).🤖 Generated with Claude Code