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

@vagenas vagenas commented Apr 10, 2026

Copy link
Copy Markdown
Member

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

mergify Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit

🔴 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

Show 1 satisfied protection

🟢 Enforce conventional commit

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

github-actions Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

DCO Check Passed

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

@codecov

codecov Bot commented Apr 10, 2026

Copy link
Copy Markdown

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>

@ceberam ceberam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@vagenas there is a conflict with test_docling_doc.py

In the meantime...Besides nodes referenced by rich table cells, what about items referenced by a GraphCell or those referenced by a FloatingItem through captions, references, or footnotes ?

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.

3 participants