fix(node): forward streamAllMessages errors to JavaScript callbacks - #4000
Open
Jr-kenny wants to merge 1 commit into
Open
fix(node): forward streamAllMessages errors to JavaScript callbacks#4000Jr-kenny wants to merge 1 commit into
Jr-kenny wants to merge 1 commit into
Conversation
Jr-kenny
marked this pull request as ready for review
August 14, 2026 21:54
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4000 +/- ##
=======================================
Coverage 86.00% 86.00%
=======================================
Files 417 417
Lines 68165 68165
=======================================
Hits 58622 58622
Misses 9543 9543 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Conversations::stream_all_messageswas logging aSubscribeErrorand returning before it reached the Node callback. That quietly threw away item errors from the Node SDK, even though the stream itself was still alive.The binding now forwards both successful messages and errors through the existing
ThreadsafeFunction. An item error reaches JavaScript as(error, undefined), and later items can still reachonValue.Why
The other Node stream adapters already pass their errors through.
createStreamtreats an item error asonErrorand keeps the stream running, sostream_all_messageswas the odd path that never let the error reach JavaScript.I added the Node contract test and a Rust adapter regression test. I also put the old early return back temporarily and ran the Rust test against it. It failed with zero callbacks. After removing the return, the same test passed with one callback.
This keeps the change at the binding boundary. It doesn't change retry, cursor advancement, transport delivery, or MLS behavior.
Testing
cargo fmt --checkcargo check --locked -p bindings_node --libcargo clippy --locked --package bindings_node --lib --all-features -- -D warningsyarn workspace @xmtp/node-sdk test test/streams.test.ts(18/18)yarn workspace @xmtp/node-sdk typecheckyarn eslint node-sdk/test/streams.test.tsgit diff --checkFixes #3844
Note
Forward
streamAllMessagesitem-level errors to JavaScript callbacks in Node bindingsstream_all_messages_with_callback_dispatchwere silently dropped in the Node bindings; they are now forwarded to the JS callback asnapi::Error.forward_messagehelper in streams.rs that mapsStoredGroupMessageresults toMessageand wraps errors viaErrorWrapper, invoking the callback for both success and failure.onErrorwithout blocking subsequent successful messages.Macroscope summarized b1da857.