fix(web-ui): keep the settings scene routing test off the real transport - #2397
Merged
bobleer merged 1 commit intoAug 20, 2026
Conversation
SettingsScene mounts useExternalAppAwareness, which calls the external sources API. Outside Tauri that resolves to the WebSocket adapter, so the routing test opened a socket to ws://localhost:8080/ws, and the failed connection left a reconnect timer retrying and logging well past the end of the file. When one of those logs lands in a worker whose rpc is already closing, the run fails with EnvironmentTeardownError: [vitest-worker]: Closing rpc while "onUserConsoleLog" was pending attributed to this file even though every test in it passed. It only shows up on a runner slow enough to let the lookup reach the transport before the file finishes, which is why it reads as a flake. Mock the hook, the way the file already mocks every panel it renders. Verified by stubbing the WebSocket global in a copy of the file and draining macrotasks: one socket to ws://localhost:8080/ws before, none after. Ports b3eb18b to this branch, which carries the same scene and the same test.
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.
Summary
Frontend Buildcan fail with every web UI test passing:SettingsScenemountsuseExternalAppAwareness, which calls the external sources API on mount. Outside TauricreateTransportAdapter()resolves to the WebSocket adapter, so the routing test opens a real socket tows://localhost:8080/ws; the connection fails, andscheduleReconnectkeeps retrying and logging on a timer that outlives the file. A console write from that timer reaching a worker whose rpc is already closing is what fails the job — the test file itself is green.It only surfaces on a runner slow enough for the lookup to reach the transport before the file ends, which is why it reads as an intermittent flake rather than a broken test.
This mocks the hook, the way the file already mocks every panel it renders. Tab routing is what it covers; the awareness lookup is chrome it never asserts on.
Type and Areas
Type: regression fix (test)
Areas: web UI
Motivation / Impact
Removes a CI failure mode that can hit any PR and is invisible in the test summary. No product code changes.
Verification
Reproduced on this branch first, then fixed. Reproduced deterministically by copying the file, stubbing the
WebSocketglobal to record constructions, and draining macrotasks after the first test the way a slower runner would:pnpm --dir src/web-ui run test:run src/app/scenes/settings/SettingsScene.test.tsx # 7 passedReviewer Notes
Port of #2393 (merged to
mainas b3eb18b). This branch carries the same scene and the same test file, and the probe reproduces the socket here too, so the leak is present independently of that merge.The adapter's retry loop is doing what it should — the bug is that a unit test reached it at all. If it is worth going further, a shared vitest setup that stubs the transport for every test would close the whole class; this change stays with the one file that opens the socket.
Checklist