Skip to content

Conversation

@unleashed
Copy link
Member

The log endpoint streams NDJSON (newline-delimited JSON) generated by tracing-subscriber. However, the log stream tests assume each HTTP body chunk contains a complete JSON object, which isn't necessarily the case.

HTTP streaming doesn't guarantee chunk boundaries align with JSON boundaries because TCP can split data anywhere. This causes occasional test failures when chunks split mid-JSON-object in my local machine.

Fix by buffering incoming chunks and extracting complete lines (by newline delimiter) before parsing as JSON.

We could arguably set the content type header for this endpoint to application/x-ndjson to be fully compliant with the NDJSON specs, but that that may be risking a breaking change for little value.

The log endpoint streams NDJSON (newline-delimited JSON) generated by
`tracing-subscriber`. However, the log stream tests assume each HTTP
body chunk contains a complete JSON object, which isn't necessarily the
case.

HTTP streaming doesn't guarantee chunk boundaries align with JSON
boundaries because TCP can split data anywhere. This causes occasional
test failures when chunks split mid-JSON-object in my local machine.

Fix by buffering incoming chunks and extracting complete lines (by
newline delimiter) before parsing as JSON.

We could arguably set the content type header for this endpoint to
`application/x-ndjson` to be fully compliant with the NDJSON specs, but
that that may be risking a breaking change for little value.

Signed-off-by: Alejandro Martinez Ruiz <[email protected]>
@unleashed unleashed requested a review from a team as a code owner December 31, 2025 13:36
@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.53%. Comparing base (96124bc) to head (1307508).
⚠️ Report is 1462 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4358      +/-   ##
==========================================
+ Coverage   67.68%   71.53%   +3.84%     
==========================================
  Files         332      394      +62     
  Lines       15158    18546    +3388     
==========================================
+ Hits        10259    13266    +3007     
- Misses       4899     5280     +381     

see 299 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 704cf7a...1307508. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cratelyn cratelyn self-requested a review January 8, 2026 17:38
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