Skip to content

Bring Reader into conformance with other resumable decoders#6

Merged
namingbe merged 7 commits into
masterfrom
claude/friendly-thompson-f0ving
Jun 9, 2026
Merged

Bring Reader into conformance with other resumable decoders#6
namingbe merged 7 commits into
masterfrom
claude/friendly-thompson-f0ving

Conversation

@namingbe

@namingbe namingbe commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

claude and others added 7 commits June 9, 2026 17:34
On input not ending in the row-terminating empty line, Reader used to
emit the incomplete trailing row at EOF — the non-resumable behavior,
diverging from the Java/Rust/Scala readers which buffer it. Align with
them: preserve line and row buffers across StopIteration so iteration
resumes cleanly when more data arrives (tailing), including a cell
split across the EOF boundary.

Non-resumable load/loads keep emitting the incomplete tail.
Same semantics as the previous commit, but keeping the original check
order and loop shape so the change reads as a delta: acc promoted to a
persistent row buffer, a line buffer for the partial line at EOF, and
the EOF tail emission removed.
The previous prepend (line_buffer + line) re-copied the accumulated
prefix on every resume, so a large cell arriving in small reads while
tailing cost O(n^2). Keep the pieces in a list and join once when the
terminating newline arrives. Lines that arrive complete skip the list
entirely (two cheap checks, no append/clear).
Revert the third row added to the basic sample and its expected data;
drop the stale commented-out assertion instead of restoring it — the
EOF contract has its own tests. Reduce reader comments to the one
non-obvious invariant.
Reusing the object would silently wipe any outside view of the parts,
e.g. if peeking is ever introduced.
@namingbe
namingbe merged commit 6cc83a1 into master Jun 9, 2026
10 checks passed
@namingbe
namingbe deleted the claude/friendly-thompson-f0ving branch June 9, 2026 20:32
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.

2 participants