test(tanstackstart): Deterministically match the server-side error event#22137
Open
mydea wants to merge 1 commit into
Open
test(tanstackstart): Deterministically match the server-side error event#22137mydea wants to merge 1 commit into
mydea wants to merge 1 commit into
Conversation
The server-function and API-route error tests waited for the error event by message only. But the thrown error also propagates back to the client (over the server-function RPC / fetch) and is captured there as an `onunhandledrejection` with the same message, so `waitForError` raced the two and sometimes resolved with the client-side duplicate — failing the mechanism assertion (`auto.browser.global_handlers.onunhandledrejection` instead of the expected server mechanism). Match the server mechanism in the predicate so the correct server-side event is always selected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
The tanstackstart server-function error test flaked: it asserted the error's mechanism is
auto.middleware.tanstackstart.server_function, but occasionally receivedauto.browser.global_handlers.onunhandledrejectioninstead.Root cause: the thrown error propagates back to the client over the server-function RPC and is captured a second time on the client as an
onunhandledrejectionwith the same message. ThewaitForErrorpredicate matched on message only, so it raced the two events and sometimes resolved with the client-side duplicate.The predicate now also matches the server mechanism, so the correct server-side event is always selected. The same latent race exists in the API-route test (identical message-only predicate + specific-mechanism assertion), so that predicate is hardened the same way.
Fixes #21912
🤖 Generated with Claude Code