Skip to content

Render rows after a table row-split fragment on the same page#170

Merged
hackerwins merged 1 commit into
mainfrom
fix/docs-table-split-followup-rows
May 1, 2026
Merged

Render rows after a table row-split fragment on the same page#170
hackerwins merged 1 commit into
mainfrom
fix/docs-table-split-followup-rows

Conversation

@hackerwins

@hackerwins hackerwins commented May 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes a Docs rendering bug where rows of a table that follow a row-split fragment on the same page were silently dropped — layout positioned them correctly (search/selection worked) but renderTableContent was never called for them, leaving the rows visually blank.
  • Extracts a shared shouldStartTableRender predicate so the background pre-pass (collectTableRenderRanges) and the body content pass stay in lockstep. The predicate now also returns true when the previous PageLine was a split fragment of the same block.
  • Adds a regression test in packages/docs/test/view/table-row-split.test.ts that builds a 1×3 table whose row 0 splits across two pages and asserts the continuation page emits both the clipped split-fragment range and a follow-up range covering rows 1–2.

Why

computeTableRangeForPageLine intentionally suppresses the forward sweep for split fragments (so the clipped split pass only covers its own row). When a split fragment lands as the first PageLine on a page, that single render only covers row N — but the dedup logic in both render passes treated subsequent PageLines as "already covered by the first render" because they shared the same blockIndex. Result: rows N+1, N+2, … were skipped entirely on that page despite having valid layout positions. This affected real documents — e.g. a 20-row outer table where the section "3. 지원동기 및 포부" (rows 16–17) and "4. 프로젝트 핵심 목표" (rows 18–19) were invisible on page 3 of a shared doc, while Ctrl+F could still find their text.

This case was missed in #145 (d91c60b3, table row splitting). Section 2.5 of docs/design/docs/docs-table-row-splitting.md is updated to document the dedup-with-split rule so future maintainers don't reintroduce it.

Test plan

  • pnpm --filter @wafflebase/docs test — 623 tests pass including the new regression test
  • pnpm verify:fast — full lane passes
  • Live verification on the repro doc at http://localhost:5173/shared/2ec0d5ec-8c46-4b75-a046-b903768b1aab — page 3 sections "3. 지원동기 및 포부" and "4. 프로젝트 핵심 목표" now render with cell content and borders
  • Reviewer: confirm the symmetry between collectTableRenderRanges and the body loop predicate (both call shouldStartTableRender)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed table rows failing to render when following a split fragment on the same page.
  • Tests

    • Added regression test to verify correct rendering of table rows after splits.
  • Documentation

    • Updated design specifications and task documentation for table rendering behavior.

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@hackerwins has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 38 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 537bf1d5-f775-475d-92a7-ef4a45e602ed

📥 Commits

Reviewing files that changed from the base of the PR and between f0f62a1 and 2917724.

📒 Files selected for processing (6)
  • docs/design/docs/docs-table-row-splitting.md
  • docs/tasks/README.md
  • docs/tasks/archive/2026/05/20260501-table-split-followup-rows-todo.md
  • docs/tasks/archive/README.md
  • packages/docs/src/view/doc-canvas.ts
  • packages/docs/test/view/table-row-split.test.ts
📝 Walkthrough

Walkthrough

This PR fixes a bug where non-split table rows on a page following a split fragment fail to render. It introduces a centralized predicate shouldStartTableRender() to determine when a table render pass should start, and applies it consistently across both background and content render passes to synchronize visual output.

Changes

Cohort / File(s) Summary
Design and Task Documentation
docs/design/docs/docs-table-row-splitting.md, docs/tasks/README.md, docs/tasks/active/20260501-table-split-followup-rows-todo.md, docs/tasks/archive/README.md
Documents the table row-split render-pass deduplication bug and fix strategy, records related codebase actions performed, updates active task tracking, and removes legacy pre-todo plans from archive.
Table Render Pass Logic
packages/docs/src/view/doc-canvas.ts
Exports new predicate shouldStartTableRender() to centralize render-pass initiation logic, refactors collectTableRenderRanges() and renderTableContent() call sites to use the predicate consistently, and exports previously internal types/functions for alignment between background and content passes.
Regression Test
packages/docs/test/view/table-row-split.test.ts
Adds test case validating that split-fragment-as-first-PageLine followed by non-split rows produces two distinct render ranges with correct row coverage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A fragment split, a row left bare,
We gather rules with central care,
One predicate to rule them all—
Both passes heed the render call,
No more skipped rows on split's debut! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main fix: rendering rows after a table row-split fragment on the same page, which matches the core change across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/docs-table-split-followup-rows

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 48 minutes and 38 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/tasks/active/20260501-table-split-followup-rows-todo.md (1)

1-57: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add the paired lessons file for this non-trivial active task.

This task is substantial, but only the -todo.md file is present. Please add docs/tasks/active/20260501-table-split-followup-rows-lessons.md and link it from the task index once available.
As per coding guidelines "docs/tasks/active/*-{todo,lessons}.md: For non-trivial tasks, use paired files in docs/tasks/active/: YYYYMMDD-<slug>-todo.md and YYYYMMDD-<slug>-lessons.md."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/tasks/active/20260501-table-split-followup-rows-todo.md` around lines 1
- 57, Create a paired lessons file named
docs/tasks/active/20260501-table-split-followup-rows-lessons.md that summarizes
the fix (Option B), the root cause (computeTableRangeForPageLine sweep behavior
and dedup in collectTableRenderRanges), the test added
(packages/docs/test/view/table-row-split.test.ts), and any reviewer decisions
(extracted shouldStartTableRender predicate), plus links to the repro and commit
d91c60b3; then update the task index to link this new lessons file next to the
existing TODO entry so the pair
docs/tasks/active/20260501-table-split-followup-rows-{todo,lessons}.md exist.
🧹 Nitpick comments (1)
packages/docs/src/view/doc-canvas.ts (1)

115-119: ⚡ Quick win

Update the collectTableRenderRanges docstring to match new behavior.

After this fix, one table can legitimately produce multiple ranges on a page (split fragment + follow-up rows). The current “one entry per table” wording is now misleading.

Suggested doc comment tweak
- * Collect render args for every table block that has at least one row
- * on this page. Returns one entry per table (deduped across PageLines)
- * so the background pre-pass touches each table once per page.
+ * Collect render args for table render passes on this page.
+ * Usually this is one range per table block, but split-fragment pages
+ * may yield multiple ranges for the same table (e.g. split fragment +
+ * follow-up non-split rows) to keep background/content passes aligned.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/docs/src/view/doc-canvas.ts` around lines 115 - 119, The docstring
for collectTableRenderRanges is outdated — it claims there is "one entry per
table (deduped across PageLines)" but the function now can emit multiple ranges
for a single table (e.g., split fragment plus follow-up rows). Update the
comment above the export function collectTableRenderRanges to clearly state that
the function collects render args for every table block that has at least one
row and may return multiple ranges per table when rows are split across
fragments, and remove or reword the "one entry per table" / dedup wording so it
matches the new behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@docs/tasks/active/20260501-table-split-followup-rows-todo.md`:
- Around line 1-57: Create a paired lessons file named
docs/tasks/active/20260501-table-split-followup-rows-lessons.md that summarizes
the fix (Option B), the root cause (computeTableRangeForPageLine sweep behavior
and dedup in collectTableRenderRanges), the test added
(packages/docs/test/view/table-row-split.test.ts), and any reviewer decisions
(extracted shouldStartTableRender predicate), plus links to the repro and commit
d91c60b3; then update the task index to link this new lessons file next to the
existing TODO entry so the pair
docs/tasks/active/20260501-table-split-followup-rows-{todo,lessons}.md exist.

---

Nitpick comments:
In `@packages/docs/src/view/doc-canvas.ts`:
- Around line 115-119: The docstring for collectTableRenderRanges is outdated —
it claims there is "one entry per table (deduped across PageLines)" but the
function now can emit multiple ranges for a single table (e.g., split fragment
plus follow-up rows). Update the comment above the export function
collectTableRenderRanges to clearly state that the function collects render args
for every table block that has at least one row and may return multiple ranges
per table when rows are split across fragments, and remove or reword the "one
entry per table" / dedup wording so it matches the new behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52283360-349a-4d67-bb14-a80ed1595f82

📥 Commits

Reviewing files that changed from the base of the PR and between 3a386c4 and f0f62a1.

📒 Files selected for processing (6)
  • docs/design/docs/docs-table-row-splitting.md
  • docs/tasks/README.md
  • docs/tasks/active/20260501-table-split-followup-rows-todo.md
  • docs/tasks/archive/README.md
  • packages/docs/src/view/doc-canvas.ts
  • packages/docs/test/view/table-row-split.test.ts
💤 Files with no reviewable changes (1)
  • docs/tasks/archive/README.md

@hackerwins
hackerwins force-pushed the fix/docs-table-split-followup-rows branch from f0f62a1 to 7500290 Compare May 1, 2026 05:26
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 133.7s

Lane Status Duration
sheets:build ✅ pass 14.4s
docs:build ✅ pass 11.4s
verify:fast ✅ pass 65.6s
frontend:build ✅ pass 18.1s
verify:frontend:chunks ✅ pass 0.4s
backend:build ✅ pass 4.9s
cli:build ✅ pass 1.9s
verify:entropy ✅ pass 17.1s

Verification: verify:integration

Result: ✅ PASS

@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/docs/src/view/doc-canvas.ts 75.00% 1 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

When a table row is split across pages and the split fragment lands as
the first PageLine on the next page, follow-up non-split rows of the
same block on that same page were never painted. Layout positioned
them correctly (search highlights and selection coordinates worked),
but `renderTableContent` was never invoked for them, so cell text and
borders were silently dropped — the rows looked like blank space.

Root cause: the dedup in `collectTableRenderRanges` and the body loop
in `DocCanvas.render` skipped subsequent PageLines that shared the
same `blockIndex` as the previous one, assuming the first PageLine's
render swept forward over them. That assumption breaks for split
fragments because `computeTableRangeForPageLine` intentionally
suppresses the sweep for them (so the clipped split pass only covers
its own row).

Fix: extract a shared `shouldStartTableRender` predicate and have both
passes call it. The predicate now also returns true when the previous
PL was a split fragment of the same block, so follow-up non-split rows
get their own render pass and sweep the remaining rows in one call.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@hackerwins
hackerwins force-pushed the fix/docs-table-split-followup-rows branch from 7500290 to 2917724 Compare May 1, 2026 05:33
@hackerwins
hackerwins merged commit 83c46b0 into main May 1, 2026
1 check passed
@hackerwins
hackerwins deleted the fix/docs-table-split-followup-rows branch May 1, 2026 05:34
@hackerwins hackerwins mentioned this pull request May 1, 2026
3 tasks
kokodak pushed a commit to kokodak/wafflebase that referenced this pull request Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant