Skip to content

fix(bulk): accept ndjson lines longer than 5MB - #216

Merged
kiivihal merged 2 commits into
mainfrom
fix/bulk-long-lines
Oct 30, 2026
Merged

kiivihal merged 2 commits into
mainfrom
fix/bulk-long-lines

Conversation

@kiivihal

@kiivihal kiivihal commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

The bulk parser read ndjson with a bufio.Scanner capped at 5MB per line. One record over that size failed the whole request with bufio.Scanner: token too long. This switches to bufio.Reader.ReadBytes('\n'), which has no line limit. Behaviour is otherwise unchanged: invalid JSON lines are still counted and skipped.

Ported from the 2024 gerrit-era branch fix/bulk-index-token-scanner (27adfee, now at archive/local/fix/bulk-index-token-scanner). Its xsd: datatype change in ikuzo/rdf/literal.go was left out on purpose: it validated xsd:decimal without expanding the IRI, so it would emit <xsd:decimal> in N-Triples.

Test: TestParseLongLine sends a 6MB line. It fails on main with "token too long" and passes here.

Also fixes JSONErrors, which was incremented twice per invalid line. The test asserts it is now counted once.

🤖 Generated with Claude Code

bufio.Scanner capped lines at 5MB, so a single large record failed the
whole bulk request with "token too long". Read lines with
bufio.Reader instead. Ported from the archived
fix/bulk-index-token-scanner branch (27adfee), without its
xsd: datatype change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.58824% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.08%. Comparing base (3fcc554) to head (24f7050).

Files with missing lines Patch % Lines
ikuzo/service/x/bulk/parser.go 70.58% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
+ Coverage   36.01%   36.08%   +0.07%     
==========================================
  Files         412      412              
  Lines       38115    38113       -2     
==========================================
+ Hits        13726    13754      +28     
+ Misses      24387    24357      -30     
  Partials        2        2              
Flag Coverage Δ
unittests 36.08% <70.58%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kiivihal
kiivihal merged commit 1d0f500 into main Oct 30, 2026
6 checks passed
@kiivihal
kiivihal deleted the fix/bulk-long-lines branch October 30, 2026 16:06
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.

1 participant