Problem
TestDoctorFeedHealthAllHealthy (cmd/hookwise/cli_test.go:~1576) is not isolated from real machine state. On a dev machine whose real ~/.claude/settings.json has hook sprawl, the test fails:
PASS analytics: /Users/vishnu/.hookwise/analytics.db <- real home, not HOOKWISE_STATE_DIR
SCAN hooks: 26 hooks across 5 events <- real ~/.claude/settings.json
WARN hook-sprawl: SessionStart has 4 always-on hooks <- triggers "should not contain warning(s)" assertion
The doctor command reads:
- the real
~/.hookwise/analytics.db instead of the path under HOOKWISE_STATE_DIR, and
- the real
~/.claude/settings.json for the hook-sprawl/overlap scan.
CI passes only because the runner's $HOME happens to be clean. This is fragile and hides real isolation gaps.
Fix direction
- Route the doctor's analytics path + hooks-settings path through env-overridable locations (
HOOKWISE_STATE_DIR, and a settings-dir override) so the test can point them at a temp dir.
- Then the test should construct a known-clean settings file and assert deterministically.
Found while verifying the cost-tracking writer port (PR #103). Related to the #99 "doctor honesty" theme.
Severity: low (test-only flake on dev machines), but it masks a real isolation gap in the doctor command's source-of-truth resolution.
Problem
TestDoctorFeedHealthAllHealthy(cmd/hookwise/cli_test.go:~1576) is not isolated from real machine state. On a dev machine whose real~/.claude/settings.jsonhas hook sprawl, the test fails:The
doctorcommand reads:~/.hookwise/analytics.dbinstead of the path underHOOKWISE_STATE_DIR, and~/.claude/settings.jsonfor the hook-sprawl/overlap scan.CI passes only because the runner's
$HOMEhappens to be clean. This is fragile and hides real isolation gaps.Fix direction
HOOKWISE_STATE_DIR, and a settings-dir override) so the test can point them at a temp dir.Found while verifying the cost-tracking writer port (PR #103). Related to the #99 "doctor honesty" theme.
Severity: low (test-only flake on dev machines), but it masks a real isolation gap in the doctor command's source-of-truth resolution.