Repository navigation
fix: stop cp_sat from putting every file in its own PR - #245
Conversation
symbol_dependencies ran _new_fields over every added line for each name defined in the diff. Compute it once and intersect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Under the default orthogonal priority, keeping two different files in one group cost 400 per file pair while opening a group cost 250, so the optimum was always one file per group: 21 PRs, several of 3-6 lines, for this repo's 1,698-line PR #10. Only unrelated files (no shared directory, symbols or test pairing) now pay that penalty; related ones get their affinity reward, so they share a PR when it fits. The model is also far smaller and starts from a good plan: - one variable per scored unit pair with linear bounds, instead of one per pair per group slot (n^2 variables instead of n^3); - group slots bounded by the graph plan's size plus a margin, instead of one per unit; - the graph plan seeds the search as a hint; - groups are numbered in diff order, not by arbitrary solver slot. On PR #10, cp_sat now plans 8 groups, down from 21, and proves the plan optimal in about 5 seconds; before, it stopped at its 15-second limit. On the 4,187-line merge #243 it plans 13 groups without tiny ones (the graph planner makes 24, 11 of them tiny), scoring 300 on pr-split's plan objective against the graph plan's 387. That diff still reaches the time limit without proving optimality, and runs of up to 60 seconds give the same plan. After the standalone pass, every sub-PR of both splits passes its own test suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe CP-SAT partitioner now uses graph partitioning results as solver hints, changes how it builds pairwise objective terms, and sorts output groups by diff position. A test checks grouping two small files in the same package. Symbol field selection now uses a set intersection. ChangesCP-SAT Partitioning
Symbol Field Selection
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The changed grouping path has no identified issue requiring a fix before merge. Merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The grouping change affects saved plans and the pull requests they produce, but no new execution authority or security boundary bypass was identified. Some failure and recovery behavior remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 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 |
This PR covers the two follow-ups left open after #244.
cp_sat gave every file its own PR
Under the default
orthogonalpriority, keeping two different files in one group cost 400 per file pair, and opening another group cost only 250. So the optimum was always one file per group. On this repo's 1,698-line PR #10,cp_satproduced 21 PRs, several of 3–6 lines, and it also ran into its 15-second limit.Fix:
--max-loc. The existing test that keeps unrelated files apart still passes.Results: the "objective" column is pr-split's own plan score, where lower is better.
The #243 diff still reaches the 15-second limit without proving optimality. Runs of up to 60 seconds give the same plan.
End to end: I split both diffs with
cp_sat, ranexecuteagainst a local remote, and ran the full test suite on each branch. All 6 and all 13 sub-PRs pass their own test suite. Merging each set of branches back reproduces the original branch exactly.Symbol matching was needlessly slow
symbol_dependenciesrescanned every added line of the diff once for each name the diff defines (CodeRabbit's nitpick on #244). It now scans once and intersects the result.Checks
ruff check,ruff format --check,ty check pr_split(18 diagnostics, down from 20 on main) andpytest(1,043 passed) all pass locally. There is one new regression test: underorthogonal, related files that fit within--max-locshare a PR. It fails without this change.🤖 Generated with Claude Code
https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Generated by Claude Code
Summary by CodeRabbit