Skip to content

fix: consider rich table cell refs in tree operations#586

Open
vagenas wants to merge 2 commits into
mainfrom
fix-tree-ops-with-cell-refs
Open

fix: consider rich table cell refs in tree operations#586
vagenas wants to merge 2 commits into
mainfrom
fix-tree-ops-with-cell-refs

Conversation

@vagenas
Copy link
Copy Markdown
Member

@vagenas vagenas commented Apr 10, 2026

Fix: Consider rich table cell refs during tree operations

This commit fixes an issue where tree operations weren't handling references from RichTableCell objects, causing broken document hierarchies.

Changes:

  1. Updated _shift_up: When removing a node, updates any table cell references to point to the node's child instead (errors if the node has multiple or no children).
  2. Updated _shift_down: Updates table cell references to point to the new wrapper node before moving the subtree.
  3. Updated _move_subtree: Prevents moving nodes that are referenced by table cells.
  4. Improved fix_misplaced_list_items auto-healing: Uses updated _shift_down and _move_subtree instead of deleting and recreating items, which preserves references correctly.

Tests:

  • Added 3 test cases for rich table cell reference handling
  • Updated expected output for misplaced list items test

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 10, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 10, 2026

DCO Check Passed

Thanks @vagenas, all your commits are properly signed off. 🎉

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling_core/types/doc/document.py 89.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…ests

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
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.

2 participants