fix(e2e): harness robustness (watch-ignore, WASM streaming, server cleanup)#84
Open
nothingnesses wants to merge 2 commits into
Open
fix(e2e): harness robustness (watch-ignore, WASM streaming, server cleanup)#84nothingnesses wants to merge 2 commits into
nothingnesses wants to merge 2 commits into
Conversation
just e2e serves the frontend with trunk serve, whose file watcher covers frontend/. Playwright writes traces, screenshots, and videos into frontend/test-results/ throughout a run, so the watcher fired a storm of rebuilds mid-test (500+ events in one CI run). On a CPU-contended runner this starved the browser's debug-WASM compile/instantiate, leaving the first authenticated page blank past the 10s assertion timeout and intermittently failing the suite. Add the Playwright output dirs to the Trunk [watch] ignore list, and pre-create them in the e2e recipe because Trunk canonicalizes ignore paths at startup and errors on missing ones. Verified locally: the watcher no longer reacts to test artifacts (0 events, down from 533) and the suite passes 4/4.
Two e2e-harness robustness follow-ups flagged while diagnosing the flake: - Disable SRI for the dev server (trunk serve --no-sri). Trunk's default subresource-integrity attribute on the wasm makes the browser fall back from WebAssembly.instantiateStreaming to the slower non-streaming instantiate, which on the large debug bundle slows cold boots. Scoped to e2e; production builds are unchanged. - Stop orphaning the app servers. The backend now execs the prebuilt binary instead of cargo run (avoiding an extra wrapper process), and cleanup frees the backend and frontend ports directly via a new memory_map_free_port helper. The servers run behind a direnv exec/bash wrapper whose pid is what was tracked, so the real server could survive on its port and block the next local run. CI is unaffected (no direnv wrapper, fresh runners). Verified locally: e2e passes 4/4, the served build has no wasm SRI, and both ports are free after the run.
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.
Three related e2e-harness robustness fixes. The first resolves the post-merge CI flake in #82; the other two address pre-existing weaknesses found while diagnosing it.
1. Stop Trunk watching Playwright output (the CI flake)
The E2E job serves the frontend with
trunk serve, whose watcher coversfrontend/. Playwright writes traces/screenshots/videos intofrontend/test-results/throughout a run, so the watcher fired a storm of rebuilds mid-test (533 watcher events / ~537 build starts in the failing run). On a CPU-contended runner those rebuilds starved Chromium's WASM compile, leaving the first authenticated page blank past the 10s assertion timeout (the failure screenshot is a blank page; the heading renders with no backend dependency). Backend-integration, storage-integration, and the other 3 e2e tests passed, it is frontend boot starvation, not the merged backend changes.Fix: add the Playwright output dirs to Trunk's
[watch] ignore, and pre-create them in thee2erecipe (Trunk canonicalizes ignore paths at startup).2. Stream the WASM bundle (faster, sturdier cold boots)
trunk servedoes sendapplication/wasm, but Trunk's default SRI integrity on the wasm makes the browser fall back fromWebAssembly.instantiateStreamingto the slower non-streaminginstantiateof the ~19 MB debug bundle. Passtrunk serve --no-sriin the e2e recipe so the browser can stream-compile. Scoped to e2e; production builds keep SRI.3. Do not orphan the app servers on cleanup
The backend was launched via
cargo runbehind adirenv exec/bash wrapper, so the tracked pid was the wrapper and the real server survived on its port after cleanup, blocking the next local run. The backend now execs the prebuilt binary directly, and cleanup frees the backend/frontend ports via a newmemory_map_free_porthelper (targeted to those ports; no-op withoutss). CI is unaffected (no direnv wrapper, fresh runners per job).Verification (local)
just e2epasses 4/4; watchertest-resultsevents533 -> 0; the served build has no wasm SRI; both ports are free after the run.Generated with Claude Code (https://claude.com/claude-code)