Fix flaky RuntimeScriptInjectionTests.PathBase (static-state test isolation) - #2
Merged
Merged
Conversation
PathBase_PrefixesInjectedRuntimeScriptSrc asserts on the host pathBase, which the injected runtime script reads from the process-wide LiveOptions.PathBase static at render time. Run concurrently with another host (e.g. PathBaseEndpointTests), a competing UseRask/AddRask clobbers that static mid-render and flips the assertion -- the test failed, passed, then failed again across three identical CI runs. Move it into the existing non-parallel ScopedAssets collection (same one PathBaseEndpointTests already uses) so no other host configures the static concurrently. Matches the established precedent for PathBase tests.
The PathBase commit added a 4th browser-host collection fixture (SubPathWasmAppFixture) alongside Server, Wasm.Host, and StandaloneWasm. xunit ran all four collections concurrently, and on the 2-core CI runner that over-subscribed CPU and starved the slowest fixture -- StandaloneWasm (WasmAppHost cold boot). Its CodeSample pages then missed the deferred scoped-JS highlight window, so the Highlight/ScopedJs/Memory/Validation tests timed out with "no code blocks found" (total==0). The failing set shifted run-to-run (11/10/11) and only ever hit StandaloneWasm -- the signature of resource contention, not a logic bug. The full suite passes 451/451 locally where multi-core boxes have the headroom. Add xunit.runner.json (maxParallelThreads=2, conservative algorithm), copied to output via the csproj, so the runner caps concurrency and the CI runner behaves like a local box.
This was referenced Aug 5, 2026
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.
What
RuntimeScriptInjectionTests.PathBase_PrefixesInjectedRuntimeScriptSrcis order-dependent and flaky in CI (failed, passed, failed across three identical re-runs ofmain). It asserts the injected runtime<script>src carries the host's pathBase, but that value is read from the process-wideLiveOptions.PathBasestatic at render time. When another host (e.g.PathBaseEndpointTests) configuresUseRask/AddRaskconcurrently, it clobbers the static mid-render and flips the assertion.Fix
Move the test into the existing non-parallel
ScopedAssetscollection (DisableParallelization=true) — the same onePathBaseEndpointTestsalready uses — so no competing host mutates the static while it runs. Matches the established precedent for PathBase tests;LiveOptions.PathBasestays a static by design (read on every render, no DI in the hot path).Note on the E2E failures
The same CI runs also show ~10-11
StandaloneWasmExampleTestsfailures (all CodeSample / scoped-JS pages). Those are not addressed here: the full E2E suite passes 451/451 locally under identical full-parallel config, the failing set shifts run-to-run, and it's confined to the slowest browser fixture (WasmAppHost) + the timing-sensitive scoped-JS feature — i.e. CI resource-contention timing, not a logic bug. Tracking separately.