Repository navigation
fix(deepdoc): keep highest-indexed table in MarkNoMergeTables page scoping - #20125
Conversation
…oping MarkNoMergeTables indexes table positions per page and appends the page-agnostic (noPage) positions last. It overwrote lastTableTI on every match, so a lower-indexed page-agnostic table sitting at the tail could win over a higher-indexed page-specific table and wrongly receive the NoMerge mark from a following caption. Keep the maximum table index instead of overwriting, which is order-independent and reproduces the original cross-product semantics exactly (highest-indexed overlapping table wins). Also fix referenceMarkNoMergeTables: it had an early break on the first matching table, so the equivalence test modelled the lowest-indexed table instead of the original's highest-indexed one, giving false confidence. Remove the break so the oracle faithfully guards the original behavior. Adds TestMarkNoMergeTablesNoPagePrecedence locking the precedence.
|
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: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesNo-merge table precedence
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The table-precedence fix is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. A rabbit checks the tables in a row Comment |
Summary
MarkNoMergeTables(introduced in #20089) indexes table positions per page and appends the page-agnostic (noPage) positions last. It overwrotelastTableTIon every match, so a lower-indexed page-agnostic table sitting at the tail could win over a higher-indexed page-specific table and wrongly receive theNoMergemark from a following caption/title. This diverges from the original cross-product semantics, which kept the highest-indexed overlapping table.This only triggers when a table position carries no
PageNumbers(thenoPagebucket), but the fallback branch exists precisely for that case, so the divergence is real.Fix
Keep the maximum table index instead of overwriting
lastTableTI(table_post.go). The result is order-independent and reproduces the original semantics exactly: the highest-indexed overlapping table wins, regardless of whethernoPagepositions are appended last.Test
TestMarkNoMergeTablesNoPagePrecedence: a box on page 5 overlaps a lower-indexed page-agnostic table and a higher-indexed page-5 table; the following caption must mark the higher-indexed table. Fails before the fix, passes after.referenceMarkNoMergeTables(the brute-force oracle used by the equivalence tests): it had an earlybreakon the first matching table, so it modelled the lowest-indexed table instead of the original's highest-indexed one — giving false confidence. Removed the break so the oracle faithfully guards the original behavior.Verification
bash build.sh --test ./internal/deepdoc/parser/pdf/table/passes (incl. the new test and both cross-page equivalence tests). gofmt / go vet clean.🤖 Generated with CodeBuddy Code