Deflake test_memo: gate on hydration and capture page diagnostics#6641
Deflake test_memo: gate on hydration and capture page diagnostics#6641masenf wants to merge 1 commit into
Conversation
test_memo interacted with the page immediately after goto, racing the websocket connect/hydrate startup; the typed input event could be lost, leaving #memo-last-value empty through every rerun of an affected CI job. Gate all memo tests on the standard #token hydration marker used by the rest of the playwright suite before interacting. Also add a tests_playwright conftest that records console messages, page errors, and websocket frames per test and attaches them to failed test reports, so any future flake of this kind is diagnosable directly from CI job logs instead of reproducing blind. https://claude.ai/code/session_01Xvaqxi4LJeWu2fo4Fk7qMD
Greptile SummaryThis PR fixes a race condition in
Confidence Score: 4/5Safe to merge; the hydration fix is correct and the diagnostic conftest is a net improvement, with one minor gap in the WebSocket frame logging. The WebSocket frame callbacks pass the raw WebSocketFrame object into an f-string rather than its .payload attribute, so frame contents will appear as opaque object addresses in CI logs. This doesn't affect test correctness — the hydration fix is solid — but the diagnostic output that motivated the conftest will be less useful than intended whenever a WebSocket-related flake occurs. tests/integration/tests_playwright/conftest.py — the ws frame logging callbacks on lines 44-45. Important Files Changed
Reviews (1): Last reviewed commit: "Deflake test_memo: gate on hydration and..." | Re-trigger Greptile |
| ws.on("framesent", lambda frame: stamp(f"ws sent: {frame}")) | ||
| ws.on("framereceived", lambda frame: stamp(f"ws recv: {frame}")) |
There was a problem hiding this comment.
The
frame argument passed to framesent/framereceived callbacks is a Playwright WebSocketFrame object. It does not override __repr__ or __str__, so interpolating it directly with an f-string logs an opaque object address (e.g. <WebSocketFrame object at 0x7f…>) rather than the actual payload. Use frame.payload to capture the frame contents that make these diagnostics useful.
| ws.on("framesent", lambda frame: stamp(f"ws sent: {frame}")) | |
| ws.on("framereceived", lambda frame: stamp(f"ws recv: {frame}")) | |
| ws.on("framesent", lambda frame: stamp(f"ws sent: {frame.payload}")) | |
| ws.on("framereceived", lambda frame: stamp(f"ws recv: {frame.payload}}")) |
Merging this PR will not alter performance
Comparing Footnotes
|
|
this actually doesn't seem like it would fix the problem |
test_memo interacted with the page immediately after goto, racing the
websocket connect/hydrate startup; the typed input event could be lost,
leaving #memo-last-value empty through every rerun of an affected CI
job. Gate all memo tests on the standard #token hydration marker used
by the rest of the playwright suite before interacting.
Also add a tests_playwright conftest that records console messages,
page errors, and websocket frames per test and attaches them to failed
test reports, so any future flake of this kind is diagnosable directly
from CI job logs instead of reproducing blind.
https://claude.ai/code/session_01Xvaqxi4LJeWu2fo4Fk7qMD