fix(plugin): grep guard matches absolute paths — was missing ~97% of real traffic#23
Conversation
…real traffic SRC_PATH's lookbehind (^|\s|quote) never matched absolute paths, but the CC harness explicitly steers Bash toward them. Field replay (daagu, 2026-06-11, 3 real coding sessions): 42/42 head-greps absolute -> 1 hint / 0 block as-is vs 30 hint / 16 block with this fix. v0.47.0's answer-in-the-deny was unreachable on consumer projects until now. Fix: normalizeCommandPaths strips <cwd>/ (hook cwd IS the project root) before shouldHint/shouldBlock/extractSearchPath; split/join not regex (cwd may contain metacharacters). Paths outside the project stay absolute and keep not firing. Cooldown still keyed on the raw command. Evidence: 10 new tests RED->GREEN incl. real-transcript replays in both spellings + abs-path e2e asserting relative CLI argv (131/131). Full 42-command daagu corpus replay: hint 1->30, block 0->16. Live daagu smoke: abs-path config_version grep -> deny embedding real hits with containing fn, answered:true; residue cleaned. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 32 minutes and 44 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Root cause
SRC_PATH's lookbehind(?:^|\s|["'])never matched absolute paths — and the Claude Code harness explicitly steers Bash toward absolute paths (cd in compound commands triggers permission prompts). Field replay of daagu's 3 real coding sessions (2026-06-11): 42/42 head-greps used absolute paths → 1 hint / 0 block as-is. The v0.27 prefix expansion (backend/, frontend/, …) only ever considered the relative spelling.Fix
normalizeCommandPaths(cmd, cwd): strip every<cwd>/occurrence beforeshouldHint/shouldBlock/extractSearchPath(the hook's cwd IS the project root, so the strip is exact). Paths outside the project remain absolute and keep not firing. Cooldown stays keyed on the raw command. The inline answer's CLI scope arg is passed relative.Evidence
args=["grep","<pat>","src/storage/"]reaches the CLI relative.answered:true; residue cleaned.Known limitation (pre-existing, out of scope)
CLI
grepshells to ripgrep; rg 14.1.0's gitignore handling diverges from git ondir/+!negationwhitelists (observed in daagu: git-whitelistedscheduler/tasks/pruned when walking from above). Worst case is the honest no-hits fallthrough — the raw grep is allowed through and finds the truth. Documented in CHANGELOG; candidate follow-up.🤖 Generated with Claude Code