fix: paginate oversized keep-next chains#155
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdates keepNext pagination so oversized chains move to a fresh page when the current page contains fragments. Adds an integration test and a patch changeset entry. ChangesKeepNext chain pagination
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 updates the layout engine to handle oversized 'keep-with-next' chains by moving them to a fresh page before natural pagination. The reviewer identified that the current implementation using 'paginator.forcePageBreak()' is not column-aware and suggested using the existing 'paginator.ensureFits(chainHeight)' abstraction instead, which handles column flow correctly and allows for code simplification.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/__tests__/layout-pipeline.integration.test.ts (1)
551-567: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider asserting the chain paginates across multiple pages.
The test name promises "paginating it naturally" but only verifies the chain moved to page 1. Since 6 blocks × 200 = 1200 likely exceeds a single page, adding an assertion that the chain spans pages 1+ would verify the natural-pagination half of the behavior.
♻️ Optional: add multi-page assertion
expect(chainStartPage).toBe(1); expect(layout.pages[0]?.fragments.map(({ blockId }) => blockId)).toEqual([0]); + + // The oversized chain should paginate naturally across multiple pages. + const chainPageCount = layout.pages.filter((page) => + page.fragments.some(({ blockId }) => blockId >= 1 && blockId <= 6), + ).length; + expect(chainPageCount).toBeGreaterThan(1);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/__tests__/layout-pipeline.integration.test.ts` around lines 551 - 567, Add an assertion to the test “moves an oversized keepNext chain before paginating it naturally” verifying that the chain’s fragments appear across multiple pages, specifically on page 1 and at least one later page. Keep the existing assertions for the chain’s starting page and the filler-only first page.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/core/src/__tests__/layout-pipeline.integration.test.ts`:
- Around line 551-567: Add an assertion to the test “moves an oversized keepNext
chain before paginating it naturally” verifying that the chain’s fragments
appear across multiple pages, specifically on page 1 and at least one later
page. Keep the existing assertions for the chain’s starting page and the
filler-only first page.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f3eddf1c-9e5f-4ce3-8a10-f197cc53da42
📒 Files selected for processing (3)
.changeset/oversized-keep-next-chain.mdpackages/core/src/__tests__/layout-pipeline.integration.test.tspackages/core/src/layout-engine/index.ts
|
Updated the regression to assert the oversized chain spans more than one page, addressing the CodeRabbit nitpick. CC on behalf of @jan-kubica |
Summary
Anonymized parity evidence
Verification
bun auditreported no vulnerabilitiesCC on behalf of @jan-kubica
Summary by CodeRabbit
Bug Fixes
Tests