You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(tests): rewrite_cmd permission tests read ~/.claude/settings.json — 3/6 fail on a normal dev machine #2640
src/hooks/rewrite_cmd.rs's unattestable_passthrough test module calls evaluate(cmd, …) → check_command(cmd) → permissions::load_permission_rules(), which reads the host's real Claude permission rules at test time. The outcome of a command therefore depends on whoever runs the suite:
evaluate("git status $(rm -rf /tmp/x)") expects Passthrough, but a machine with a deny rule for rm -rf returns Deny first (deny pre-empts).
evaluate("git status") / "git status 2>&1" expect Ask, but a machine with an allow rule for git status returns Allow.
So 3 of 6 tests fail locally on any machine with ordinary deny/allow rules, while passing on default-config CI ("green on CI, red on my box").
evaluate mixes the permission verdict (I/O — reads host settings) with the pure rewrite decision and offers no seam to inject the verdict — unlike the permission layer's own check_command_with_rules.
Proposal: extract evaluate_with_verdict(cmd, verdict, …) so tests inject a PermissionVerdict; production keeps calling check_command. Test-only, no behavior change.
Same class as #2106 (telemetry test isolation); the fix mirrors #2603's injection helpers. Fixed by #2636.
Fixed by #3147, shipped in v0.46.0: the rewrite tests now inject the permission verdict instead of reading ~/.claude/settings.json. Running the hooks tests with allow rules for git * and deny rules for rm -rf in the Claude settings now passes. If you still see failures on the latest version, please comment or reopen.
Activity
pszymkowiak commentedon Jun 26, 2026
🔍 Automated Triage
bugmediumSummary
Test isolation bug in rewrite_cmd.rs causes 3/6 tests to fail on machines with custom Claude permission rules; PR #2636 already open with a fix.
📁 Relevant files
src/hooks/rewrite_cmd.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
KuSh commentedon Sep 26, 2026
Fixed by #3147, shipped in v0.46.0: the rewrite tests now inject the permission verdict instead of reading ~/.claude/settings.json. Running the hooks tests with allow rules for
git *and deny rules forrm -rfin the Claude settings now passes. If you still see failures on the latest version, please comment or reopen.