Skip to content

Add cross-chunk boundary regression tests for chunked reader#178

Merged
jsoizo merged 1 commit into
version_2_0_0from
reader-chunked-followups
May 22, 2026
Merged

Add cross-chunk boundary regression tests for chunked reader#178
jsoizo merged 1 commit into
version_2_0_0from
reader-chunked-followups

Conversation

@jsoizo
Copy link
Copy Markdown
Owner

@jsoizo jsoizo commented May 22, 2026

Summary

Follow-up to #177. Adds chunk-boundary regression tests for cases that the original PR's tests did not exercise:

  • doubled quote "" split across a chunk boundary (cross-buffer next-char lookahead, skipCount=1)
  • explicit-escape \\<target> split across a chunk boundary (same lookahead path with a non-self escape char)
  • lone CR at a chunk end followed by a non-LF char in the next chunk (CR terminator must not consume the following field char as part of CRLF)
  • supplementary code point (U+1F600) at the parseRowsFromChunks layer, and at the kotlinx-io Source layer with the high surrogate placed at buffer.size - 2 so the low surrogate lands on the reserved last slot — a regression in limit = buffer.size - 1 would overflow

Also rewrites the existing chunked-path test comments added in #177 to lead with why the test exists rather than restating the parser branch.

Verification

  • ./gradlew check

No production source changes — tests only.

Add follow-up coverage for the chunked reader fast path introduced in
PR #177:

- doubled quote `""` straddling a chunk boundary, so the cross-buffer
  next-char lookahead has to find the second `"` at nextBuffer[0] for
  skipCount=1 to do the right thing
- explicit-escape `\\<target>` straddling a chunk boundary, same
  cross-buffer next-char path with a non-self escape char
- lone CR at a chunk end followed by a non-LF char in the next chunk,
  so the CR terminator must not consume the next field char as part
  of CRLF
- supplementary code point (U+1F600) at the parseRowsFromChunks layer
  where it just passes through as ordinary chars, and at the
  kotlinx-io Source layer with the 😀 high surrogate at index
  `buffer.size - 2` so the low surrogate must land on the reserved
  last slot — a regression in `limit = buffer.size - 1` would overflow

Also rewrite the existing chunked-path test comments to lead with
why-the-test-exists instead of restating the parser branch.
@jsoizo jsoizo merged commit 9c83cf8 into version_2_0_0 May 22, 2026
3 checks passed
@jsoizo jsoizo deleted the reader-chunked-followups branch May 22, 2026 13:59
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.87%. Comparing base (40d41d6) to head (15aba08).
⚠️ Report is 3 commits behind head on version_2_0_0.

Additional details and impacted files
@@              Coverage Diff               @@
##           version_2_0_0     #178   +/-   ##
==============================================
  Coverage          94.87%   94.87%           
==============================================
  Files                 22       22           
  Lines                507      507           
  Branches             116      116           
==============================================
  Hits                 481      481           
  Misses                13       13           
  Partials              13       13           

☔ View full report in Codecov by Sentry.
📢 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.

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