feat: implement issue #602 — [Phase 2] Grounding check: verify references/target_surface paths resolve - #740
Conversation
…nces/target_surface paths resolve
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 38 minutes and 13 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ 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: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ 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 |
There was a problem hiding this comment.
Code Review
This pull request introduces grounding validation to the initiative planner, ensuring that path-like entries in references and target_surface resolve to actual files in the repository. It also adds corresponding test cases to verify this behavior. The review feedback suggests two robust improvements: stripping leading slashes from paths to prevent pathlib.Path from treating them as absolute paths, and ignoring candidates with spaces to avoid falsely identifying prose containing slashes as file paths.
| candidate = s.split("#", 1)[0].strip() | ||
| if not candidate: | ||
| return False |
There was a problem hiding this comment.
To prevent false positives where prose containing a slash (e.g., see section/paragraph 2) is mistakenly identified as a file path and fails validation, we can check if the candidate contains spaces. Real repository file paths almost never contain spaces, so skipping candidates with spaces makes the heuristic much more robust.
| candidate = s.split("#", 1)[0].strip() | |
| if not candidate: | |
| return False | |
| candidate = s.split("#", 1)[0].strip() | |
| if not candidate or len(candidate.split()) > 1: | |
| return False |
There was a problem hiding this comment.
Done in scripts/initiative-planner/validate-plan.py (looks_like_path, line 76): added or len(candidate.split()) > 1 to the early-return guard so any candidate containing whitespace (e.g. see section/paragraph 2) is immediately rejected as prose rather than flagged as a missing file path. Added a new bats test prose with embedded slash is not treated as a path covering multi-word candidates with embedded slashes.
There was a problem hiding this comment.
Verified: the whitespace guard (line 76 of scripts/initiative-planner/validate-plan.py) and the bats test "prose with embedded slash is not treated as a path" (test_initiative_planner.bats:77) are both in place. Full test suite (22/22 tests) passes locally including test #6 covering this exact case.
Dev-Lead — review-changes (applied)Changes committed and pushed. |
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #740 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically. |
|



Closes #602
Implemented by dev-lead agent. Please review.