Conversation
This branch has not been deployed
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.
GitHub Issue #376
Description 📖
This pull request makes
autoBuildreliable when tests run in parallel processes.Test workers can continue building assets on demand without requiring a separate precompilation step or runner-specific configuration.
Background 📜
Vite Ruby previously used a
Mutexto serialize automatic builds. A mutex only coordinates threads within one Ruby process, while parallel test workers each have their own mutex.When multiple workers requested stale assets together, they could launch concurrent Vite builds against the same output directory. A worker could then parse a manifest while another build was rewriting it, resulting in intermittent
JSON::ParserErrorandViteRuby::MissingEntrypointErrorfailures.This did not affect single-process test runs, and the existing mutex protected threaded requests within one process.
The Fix 🔨
Coordinate build checks and manifest reads through a project-scoped advisory file lock.
An exclusive lock covers the freshness check, Vite invocation, and metadata write. Waiting workers re-check freshness after acquiring the lock and reuse the first worker's build.
A shared lock prevents manifest reads from overlapping an automatic build. When
autoBuildis disabled, manifest loading retains its previous behavior and does not initialize the builder or build lock.