fix: verify and announce dev-server reuse in make electron-dev#558
Open
Davidnet wants to merge 1 commit into
Open
fix: verify and announce dev-server reuse in make electron-dev#558Davidnet wants to merge 1 commit into
Davidnet wants to merge 1 commit into
Conversation
electron-dev reused any server answering on :3000, treating a bare HTTP
200 as proof the right server was running. A stale webpack dev server
from a deleted git worktree kept serving its last in-memory bundle, so
the target silently adopted it and Electron loaded from a zombie whose
node_modules were gone — surfacing confusing html-webpack-plugin loader
errors with no hint of where they came from.
Move the orchestration out of the Makefile into src/scripts/electron-dev.js,
which supervises both the dev server and Electron in one process:
- identify the process on :3000 via lsof and compare its cwd to this
worktree's src/frontend
cwd matches -> reuse, announcing pid + cwd
cwd differs -> refuse with the offending pid/cwd and guidance
cwd unverifiable -> reuse with a warning
FORCE_RESTART=1 -> kill the holder, wait for the port, start fresh
- only tear down a dev server it spawned (a reused one is left running),
killing the process group so webpack dies with it
Keeping the logic in Node makes the four-way policy readable and unit-
testable (classifyHolder) instead of a backslash-continued shell block.
Reuse stays the default; killing is opt-in.
hanneshapke
approved these changes
Jun 27, 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.
Summary
make electron-devreused any server answering on:3000, treating a bare HTTP 200 as proof the right server was running. A stale webpack dev server from a deleted git worktree kept serving its last in-memory bundle, so the target silently adopted it and Electron loaded from a zombie whosenode_moduleswere gone — surfacing confusinghtml-webpack-pluginloader errors with no hint of where they came from.This moves the orchestration out of the Makefile into
src/scripts/electron-dev.js, which supervises both the dev server and Electron in one process::3000vialsofand compares its cwd to this worktree'ssrc/frontend:FORCE_RESTART=1→ kill the holder, wait for the port, start freshKeeping the logic in Node makes the four-way policy readable and unit-testable (
classifyHolder) instead of a backslash-continued shell block. Reuse stays the default; killing is opt-in.The
Makefileelectron-devtarget collapses to@node src/scripts/electron-dev.js.Follow-up: these scripts aren't in the lint path yet (#557).