fix: raise PRSplitError for chunking failures - #71
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughChunking error paths now raise ChangesChunking error handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Chunking failures now use the project’s standard error type, so oversized hunks and unknown strategies produce the intended concise error instead of an uncaught traceback. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
A hunk larger than the chunk token budget (and an unknown chunk strategy) raised a bare ValueError from the chunker, which bypasses the CLI's PRSplitError boundary and reaches the user as a traceback.
ba17cb2 to
f51deb7
Compare
Problem
chunk_hunks_greedy/chunk_hunks_dynamic_programmingraise a bareValueErrorwhen a single hunk's token estimate exceeds the per-chunk budget (ErrorMsg.HUNK_TOO_LARGE), andchunk_hunksdoes the same for an unknown strategy. Neither is aPRSplitError, so on a huge diff with one giant hunk thesplitcommand dies with a traceback instead of the one-line message every other planner failure gets (and #63's planner error boundary can't catch it either).Fix
All four raises in
pr_split/planner/chunker.pynow usePRSplitError(the messages are unchanged and already come fromErrorMsg). Tests updated and a new test asserts both strategies raisePRSplitErrorwith the file/hunk/budget in the message.445 tests pass, ruff clean.
Summary by CodeRabbit