Skip to content

fix(parser): split JSONL records only on newline characters - #20029

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
imexlovery:codex/jsonl-unicode-line-separators
Sep 24, 2026
Merged

JinHai-CN merged 1 commit into
infiniflow:mainfrom
imexlovery:codex/jsonl-unicode-line-separators

Conversation

@imexlovery

Copy link
Copy Markdown
Contributor

Summary

Split JSONL records on LF in both format detection and parsing. Python splitlines also splits valid Unicode characters inside JSON strings, which can make a valid file produce no chunks. CRLF remains supported.

Validation

  • Added six cases for U+0085, U+2028, and U+2029 with LF and CRLF. All fail before the fix.
  • All 11 JSON parser tests pass locally.
  • Ruff formatting and git diff --check pass. Existing lint findings remain unchanged; no new findings.
  • Used the existing isolated parser harness with its UTF-8 decoding fallback; no live ingestion or retrieval run.

JSON Lines specifies LF record separators: https://jsonlines.org/
No public issue has been filed. Investigation, code, and tests used AI assistance.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: bd927ea0-3408-4520-a5c7-c54c66037a1d

📥 Commits

Reviewing files that changed from the base of the PR and between d1aa4e6 and 11bac96.

📒 Files selected for processing (2)
  • deepdoc/parser/json_parser.py
  • test/unit_test/deepdoc/parser/test_json_parser.py

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The parser now splits JSONL content only on literal newline characters. This preserves Unicode line and paragraph separators inside JSON string values. New parametrized tests cover detection and parsing with \n and \r\n line endings.

Changes

JSONL Separator Handling

Layer / File(s) Summary
Literal newline splitting and regression coverage
deepdoc/parser/json_parser.py, test/unit_test/deepdoc/parser/test_json_parser.py
_parse_jsonl and is_jsonl_format now use split("\n"). Tests verify that \u0085, \u2028, and \u2029 remain inside string values across both parsing paths and newline variants.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 11bac

JSONL records continue to parse with LF and CRLF while Unicode separators inside strings are preserved. No concrete merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the required Summary section and clearly explains the problem, the fix, test coverage, and validation results.
Title check ✅ Passed The title clearly identifies the parser change and specifies that JSONL records split only on newline characters.
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.
  • Fix all pre-merge checks with AI

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

A rabbit hops through JSON lines
Newlines mark the proper signs
Unicode rests inside each string
Tests check every separator’s swing
The parser keeps each value bright

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

@xugangqiang xugangqiang added the ci Continue Integration label Sep 23, 2026
@xugangqiang

Copy link
Copy Markdown
Collaborator

LGTM

@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.07%. Comparing base (c18f0dd) to head (11bac96).
⚠️ Report is 60 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #20029   +/-   ##
=======================================
  Coverage   38.07%   38.07%           
=======================================
  Files          54       54           
  Lines       15500    15500           
  Branches      125      125           
=======================================
  Hits         5902     5902           
  Misses       9570     9570           
  Partials       28       28           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit 2418baa into infiniflow:main Sep 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants