fix(web): surface transport failures to pending stream consumers - #563
Open
Caldalis wants to merge 1 commit into
Open
fix(web): surface transport failures to pending stream consumers#563Caldalis wants to merge 1 commit into
Caldalis wants to merge 1 commit into
Conversation
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.
Not a re-run of #152 — this PR does not change the error-clearing in
next(). Per the #128 resolution that behaviour is intentional, and it stays: a failure is delivered exactly once and the iterator never becomes a zombie that re-throws forever. What changes is that the failure reaches the consumer at all.#505 —
AsyncEventQueue.fail()resolved already-parked waiters with{ done: true }, so a consumer awaitingnext()when the transport dies sees a clean end of turn instead of the error.#506 — an error
responseframe carrying a stream's id was dropped, because the handler only looked inpending. The stream never settles and the consumer hangs.Fix
waitersnow hold{ resolve, reject }, andfail()rejects parked waiters instead of resolving them{ done: true }. This is whatAsyncEventQueueinsrc/gateway/client/GatewayWsClient.tsalready does — the browser copy had drifted.handleMessage, aresponsethat missespendingfalls back tostreamsand callsstream.fail()whenokis false. Checked againstGatewayWsConnection.ts:89-118that a successfulsubmit_turnonly ever sends afinalevent and never anok: trueresponse, so the branch is gated on!frame.ok.Why one PR
Same chain. With only the #506 half applied, the routed error still hits the unfixed
fail()and gets swallowed, so the reported symptom is unchanged:mainKnown limitation
next()checksthis.errorbefore drainingthis.values, so buffered events are discarded when a stream fails —close()keeps them,fail()doesn't. Pre-existing and shared with the Node client; this PR only makes that path reachable where it previously hung. Worth a separate fix.GatewayWsClienthas the same!pendinggap. Left out to keep this off the path the Web UI actually uses.Tests
tests/web/gateway-browser-client-stream-failures.spec.ts, 6 cases: both bugs, plus guards for normal completion, single delivery on the parked and unparked paths, and a malformed error envelope. Both bug cases fail onmain.Root suite 510 pass / 0 fail — the 7 cancelled are the pre-existing
tests/network/fetch.spec.tsones (#441). Web Regression green: 156 files / 1299 tests.