Repository navigation
Stopped the deploy-build simulation from racing parallel test files - #373
Merged
Merged
Conversation
✅ Deploy Preview for alg-helpcenter ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
ref #213 Full `pnpm test:coverage` runs failed intermittently in cli-content-projection.acceptance.test.ts ("replaces stale continuations with one stable record on repeated shrinking runs") while the same file always passed standalone. The failing CLI subprocess exits with ERR_MODULE_NOT_FOUND for packages/algolia-html-extractor/dist/index.mjs, imported from the fragmenter. A filesystem watcher over full runs showed the cause. The Netlify function-tracing test "packages the extractor on a deploy without prebuilt workspace output" deletes the extractor's gitignored dist/ to prove that a fresh Netlify clone rebuilds it during `netlify build`. That leaves every full run with a window of about 1.5 seconds in which the extractor has no build output. Vitest runs test files in parallel, so any test that spawns a new Node process inside the window cannot resolve the extractor. The shrinking-runs test spawns three CLI processes back to back and has the longest exposure, and coverage instrumentation stretches both the window and the spawns, which is why coverage runs flaked most. Timeouts, replay-server ports, and the coverage subprocess attach were ruled out: the recorded failures never hit a timeout, and the replay server takes its port from the OS. Vitest projects now split the suite into two sequential groups. Every other test file keeps running in parallel in group 0, and the destructive tracing file runs alone in group 1 via sequence.groupOrder. The netlify package gets the same split for `pnpm --filter @tryghost/algolia-netlify test`, which had the same latent race. No test, assertion, or timeout changed. Six consecutive full `pnpm test:coverage` runs and three focused netlify package runs passed after the change; before it, the suite failed roughly every second or third run.
The plan check flagged @tryghost/algolia-netlify as touched because the flake fix adds packages/algolia-netlify/vitest.config.mjs. Vitest configs only shape how tests run and never ship (the package publishes dist/ alone), so they belong with the test files and markdown the check already ignores. A version plan here would instead force a pointless npm release and Netlify release promotion for a dev-only file.
aileen
force-pushed
the
aileen/serialize-deploy-build-simulation
branch
from
November 5, 2026 12:36
4dda46d to
4ee6615
Compare
aileen
enabled auto-merge (squash)
November 5, 2026 12:36
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.
ref #213
Problem
While delivering the page-identity work for #213, full local
pnpm test:coverageruns failed roughly every second or third time incli-content-projection.acceptance.test.ts> "replaces stale continuations with one stable record on repeated shrinking runs", on unmodifiedmain, while the file always passed standalone. That undermined trust in the local verification gate the #213 slices rely on.The captured failure is not a timeout. The CLI subprocess exits with:
Cause
A millisecond-resolution filesystem watcher over full suite runs shows
packages/algolia-html-extractor/distdisappearing for about 1.5 seconds in every run. The deletion comes from the Netlify function-tracing test "packages the extractor on a deploy without prebuilt workspace output", which removes the extractor's gitignoreddist/to prove that a fresh Netlify clone rebuilds it duringnetlify build.Vitest runs test files in parallel, so any test that spawns a new Node process inside that window cannot resolve the extractor through the fragmenter. The shrinking-runs test spawns three CLI processes back to back and has the longest exposure, and coverage instrumentation stretches both the window and the spawns, which is why coverage runs flaked most. Standalone runs never fail because the tracing file is not running at the same time.
Ruled out: the 20s/15s/5s timeouts were never hit, the replay server takes its port from the OS so there is no port contention, and the
tscbuilds that pack tests trigger are write-free when outputs are up to date (the existing build-output-stability test already guards that).Fix
Vitest projects with
sequence.groupOrdersplit the suite into two sequential groups: everything else keeps running in parallel in group 0, and the destructive tracing file runs alone in group 1.packages/algolia-netlifygets the same split for the focusedpnpm --filter @tryghost/algolia-netlify testrun, which had the same latent race.No test, assertion, or timeout changed, keeping the repo's rule that tests are never weakened or skipped. The suite stays deterministic and offline; the cost is that the tracing file no longer overlaps other files, adding its own runtime (about 10s) to the total.
Verification
main.pnpm test:coverageruns passed (sanity run plus five verification runs), with the watcher confirming the dist deletion now happens only after the parallel group has finished.pnpm --filter @tryghost/algolia-netlify testruns passed.pnpm lintpasses; coverage thresholds andtest/verify-coverage.mjsunchanged and green.