Dev server: survive rapid-save rebuild races and explain missing plugin state#14
Merged
Conversation
…tate errors - Generated build artifacts (meta.json; vite.config.js already guarded) are written only when content changes, atomically (temp + os.replace), and build passes are serialized — a burst of rapid saves no longer triggers spurious vite config-restarts that could race a rebuild and kill the dev server (HTTP 000 until manual restart). - The vite subprocess is supervised: an unexpected exit relaunches with exponential backoff (bounded attempts, budget resets on a healthy relaunch), shutdown exits never relaunch, and exhaustion surfaces a structured ViteSupervisionError instead of a silent dead server. A relaunch that leaves vite running but never listening terminates the hung child on every failed attempt and on exhaustion — one fresh process per attempt, no orphans. - request.state.<name> AttributeError in loaders/actions is re-raised as a structured error with plugin-config guidance (pyxle-db named for 'db'), original traceback chained; production responses stay generic; other AttributeErrors flow through untouched. Suite: 2202 passed, coverage 96.50%. Ruff clean.
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.
Two development-server robustness fixes:
vite.config.jscould trigger a config-restart that raced the next rebuild and left the process dead (nothing listening until a manual restart). Generated artifacts are now written only when content actually changes — atomically — and build passes are serialized. On top of that, the Vite subprocess is now supervised: an unexpected exit relaunches it with bounded exponential backoff (shutdown exits never relaunch), a relaunch that comes up but never starts listening is terminated rather than leaked, and if the budget is exhausted the failure surfaces as a clear structured error instead of a silent dead server.request.state.<name>errors now explain themselves. Usingrequest.state.dbin a loader or action without the providing plugin configured used to 500 with a bareAttributeError: 'State' object has no attribute 'db'. It's now a structured error explaining that state attributes are provided by plugins or middleware — naming pyxle-db fordb— with the original traceback chained. Production responses stay generic; every otherAttributeErrorflows through untouched.Tests: 2202 passed, coverage 96.50%, including write-if-changed mtime stability, atomic-replace, 3-way build serialization, supervisor relaunch/shutdown/exhaustion/hung-child behaviors, and prod-response hygiene for both page and action paths.