Skip to content

Accept CRLF delimiters in NDJSON sync streams - #39

Closed
birdmanmandbir wants to merge 1 commit into
powersync-ja:mainfrom
GuionAI:fix/accept-crlf-ndjson
Closed

birdmanmandbir wants to merge 1 commit into
powersync-ja:mainfrom
GuionAI:fix/accept-crlf-ndjson

Conversation

@birdmanmandbir

Copy link
Copy Markdown
Contributor

What changed

  • Accept CRLF alongside LF when splitting text sync-stream lines.
  • Preserve carriage returns that are payload data rather than part of a CRLF delimiter.
  • Cover a CRLF delimiter split across source chunks and a regular CRLF delimiter.

Root cause

LineSplitter removed the LF byte but forwarded the CR byte from a CRLF delimiter. NDJSON 1.0 permits CRLF and requires parsers to accept it.

Validation

  • cargo fmt --all --check
  • cargo test -p powersync accepts_crlf_delimiters_without_stripping_other_carriage_returns --all-features
  • cargo test --workspace --all-features
  • cargo clippy -p powersync --all-targets -- -D warnings

No separate issue: this is a small standards-compliance fix with a deterministic regression.

@simolus3 simolus3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a general-purpose ndjson decoder, it only needs to decode lines from the PowerSync service. The service will never include CRLF line endings.

@simolus3 simolus3 closed this Sep 17, 2026
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