feat: Add React Scan WebSocket harness with environment initialization fix#2931
Draft
cursor[bot] wants to merge 4 commits into
Draft
feat: Add React Scan WebSocket harness with environment initialization fix#2931cursor[bot] wants to merge 4 commits into
cursor[bot] wants to merge 4 commits into
Conversation
…nt initialization - Create react-scan-ws-harness.html and reactScanWsHarness.tsx for testing React Scan performance monitoring - Initialize mock primary environment to prevent 'Unable to resolve primary environment' error - Seed WebSocket reconnect-waiting state for toast testing - Add console logging to debug connection state The harness sets up a test environment to observe whether React Scan can detect rerenders in the WebSocket reconnect toast countdown. The toast infrastructure requires additional WebSocket connection mocking to fully function. Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.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.
Summary
Created a React Scan test harness to observe rerender behavior in the WebSocket reconnect toast, and fixed a critical bug preventing the harness from functioning.
Changes
react-scan-ws-harness.htmlandreactScanWsHarness.tsxfilesinitializeMockEnvironment()to fix "Unable to resolve the primary environment" errorTesting & Observations
Test Goal: Observe whether React Scan detects and highlights rerenders in the WebSocket reconnect toast countdown.
Current Status: The toast does not visibly appear or update.
Findings:
uiState: "reconnecting"withhasConnected: trueRoot Cause: The harness seeds WebSocket reconnect state but lacks full environment connection infrastructure. Specifically:
WebSocketConnectionCoordinatorrequiresgetPrimaryEnvironmentConnection().reconnect()to be callableRecommendations
To complete this harness:
createEnvironmentConnection()with a stub WebSocket clientreconnect()method that prevents errors when "Retry now" is clickedtoastManager.add()to demonstrate React Scan rerender detection without relying on WebSocketConnectionCoordinatorAnswer to Test Question
Does the WebSocket reconnect toast visibly update/rerender?
No. The toast does not appear at all, so React Scan cannot demonstrate rerender detection on it. The WebSocket coordinator state is correctly set to "reconnecting", but the toast rendering pipeline fails because the harness lacks full environment connection mocking.
Note
Add React Scan WebSocket harness for testing reconnect-waiting UI state
initializeMockEnvironmentwrites a deterministic mockExecutionEnvironmentDescriptor(id:harness-mock-env) so the app has a valid environment on load.seedReconnectWaitingStatedrives the in-memory WS connection state through multiple failed attempts (close code 1006) to produce a reconnect-waiting scenario, logging the derived status and UI state.HarnessViewrendersToastProviderwrappingWebSocketConnectionCoordinatorand exposes a button to re-trigger the reconnect seed without a full page reload.Macroscope summarized 85d1517. (Automatic summaries will resume when PR exits draft mode or review begins).