Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe Go and Python token chunkers now remove one leading newline from the ChangesChild chunk parent metadata
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This localized change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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. Comment |
wangq8
left a comment
There was a problem hiding this comment.
Thanks for the fix. The direction is correct and the Go/Python change is symmetric (strings.TrimPrefix(s, "\n") ≡ s.removeprefix("\n")), which keeps the two implementations in lock-step. A few things to confirm before merge:
1. Child text still keeps the leading \n (split source is untrimmed).
In splitByChildren you trim mom but still split the untrimmed text:
mom := strings.TrimPrefix(ck.Text, "\n")
parts := splitDroppingDelim(ck.Text, pattern) // still ck.Text, not momWhen the children delimiter is not "\n" itself (e.g. a sentence delimiter), the first child's Text still starts with "\n" while its Mom no longer does — so the parent reference and the child content now disagree about whether the leading newline exists. If the goal is to drop the extra leading newline everywhere, split from the trimmed value instead: parts := splitDroppingDelim(mom, pattern). (Python _split_chunk_docs_by_children has the same shape — splits the untrimmed chunk.get("text") — so parity is preserved either way; just please confirm the child text is intended to retain the "\n".)
2. The Go text-path change looks like a no-op.
Both callers of applyChildrenDelimText (chunkPerSegment and mergeByTokenSize) already strings.TrimSpace the parent before calling it, so t never has a leading "\n" and strings.TrimPrefix(t, "\n") never fires. The Python text path, by contrast, runs naive_merge (which prepends "\n" per paragraph) and does not trim before the children split, so the Python removeprefix("\n") is genuinely load-bearing. Net effect: this PR changes Python text-path output but leaves Go text-path output byte-identical. That asymmetry is fine (it actually closes an existing Go/Python gap), but the Go applyChildrenDelimText hunk reads as dead code — consider dropping it or adding a one-line comment explaining it's a defensive no-op.
3. TrimPrefix/removeprefix strip exactly one newline.
If a chunk can begin with multiple leading newlines ("\n\n..."), only the first is removed. In the merge path exactly one "\n" is prepended so this is safe, but it's worth a quick confirm that the JSON path (parser-provided item text) can't emit two.
4. Please add a regression test.
There's already token_children_delim_test.go asserting mom; a case where the parent text starts with "\n" (e.g. delimiters: ["\n"] + a children delimiter on the JSON path) would pin this behavior and prevent future regressions. The PR currently changes no tests.
Minor: the PR body is empty — a one-line description of the reproduction (which delimiter config leaks the newline into mom) would help reviewers and future maintainers.
(Note: I couldn't run the Go chunker tests locally — the package fails to build here due to a missing office_oxide.h cgo dependency, unrelated to this change.)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18490 +/- ##
=======================================
Coverage 90.65% 90.65%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 650 650
Misses 39 39
Partials 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Add TextBox.IsOCR and mark OCR-path boxes in processPageBoxes so layout.Dedup* only collapse OCR duplicates; char-path digital PDFs are never silently de-duplicated (review: dedup ran on all boxes with no source tag). - Add TestMergeCaptions_FigureCaptionNoTargetKept and TestMergeTablesAcrossPages_PostMergeCleanup to lock the figure-caption no-target-keep branch and the cross-page merge post-cleanup combined call. - Replace the all-or-nothing len(rowStrips)==len(rows) guard with matchRowStrip so header tables take the per-row strip override; add TestFillCellTextFromBoxes_RowStripHeaderTable. - Move TestVMWhitespaceGapBridge out of the cgo&&manual tier into a CI-runnable unit test (vm_whitespace_bridge_test.go). - Annotate known_diffs rule table-cell-fill-pre-vs-post-merge-order (14_text_table_interleaved, go_bug/open) as accepted_at_merge. Review: PR infiniflow#18490/infiniflow#18516 points 2-5.
…up safety - NaiveVerticalMerge: gate vertical merge on pageEnglish directly (mh=0) instead of the mh<=0 guard, which never fired for real English pages (their char-derived median height is always positive). Mirrors Python is_english -> chars=[] -> no merge; fixes eval_* line overflow in prod. Add TestVerticalMergeEnglishNoMergePositiveMedian (red->green). - Extract parityLockedGridPDFs(); drop 13_crosspage_table and 14_text_table_interleaved from the locked grid-parity set (both are known-unfixed content gaps — locking them contradicted accepted_at_merge). Add TestParityLockedGridExcludesUnfixed (CI-runnable). - DedupSubstringOverlaps: bind the geometric containment test to the substring-text box (not just the shorter-height box) via boxInside, so a physically taller box whose short text is a substring of a neighbour is never silently dropped. Add TestDedupSubstringOverlaps_TallerFragmentKept. - pipeline_parity_test.go: drop now-unused sort/lyt imports (left over from moving TestVMWhitespaceGapBridge out) so the manual harness compiles. Review: PR infiniflow#18490/infiniflow#18516.
- vm_whitespace_bridge_test.go: drop the ~110-line hand-written vWithWS/vNoWS replica (production-vs-copy comparison can pass when both share a bias) and assert the literal production result: the whitespace gap bridge collapses the 4-box column to 1 section. Verified against mergeColumnBoxes (WS gap 14.00 < 14.04 threshold, OverlapX=1.0, then B/C cascade). Note: the review suggested 3; the actual production output is 1. - pipeline_parity_test.go: count and print INTENTIONAL verdicts in the summary; loadPythonTables now distinguishes a missing vs corrupt Python tables golden with explicit t.Errorf so bad input no longer masquerades as a Go content failure. - char_adapter.go: require per-page dims in charspy dumps (fail fast on missing/invalid) and remove the char-bbox RenderPageImage fallback that could degrade to a 1x1 placeholder (pageHeight ~1.33, boxes off-page). - dedup_test.go: fix stale 'byte-identical' comment (grouping is trim-equal); add TestDedupSubstringOverlaps_PartialYOverlapKept pinning the boxInside Y-containment boundary. - known_diffs.json: english-page-ocr-source-divergence note now reflects that the harness already clears replayed chars (engine.ClearChars). Review: PR infiniflow#18490/infiniflow#18516 round 2 (items 1/2/5/6/7/8/10).
No description provided.