fix: capture the pipe before the supervisor deletes its own record - #447
Merged
Merged
Conversation
Reopens and actually fixes #429. #446 did not, and the nightly said so. #446 had spawnSupervisor read the recorded endpoint to decide whether to forward --pipe. But runSupervise clears that record on a clean exit: defer func() { supervise.ClearEndpoint(opts.StateDir) }() and `restart --supervisor` exits the old supervisor CLEANLY before spawning the replacement. So the sequence was: 1. old supervisor exits -> endpoint record deleted 2. spawnSupervisor -> ReadEndpoint -> nothing 3. replacement re-selects from scratch The fix read the record after the thing that writes it had removed it. It worked for a hard kill, where the record survives -- which is why the test passed. That test wrote an endpoint and called supervisorCommand directly, modelling the crash path rather than the restart sequence: the right assertion about the wrong scenario. runRestart now captures the pipe BEFORE recycling and carries it through runStartPreserving to spawnSupervisor. The recorded read stays as the fallback, because for a supervisor that died hard it is the only thing that remembers. runStartPreserving rather than a `--pipe` flag on `start`: this is not something a user asks for, it is one command carrying a value across a teardown that would otherwise erase it, and a CLI flag would document a decision the caller never makes. Verification ------------ TestRestartSequencePreservesTheCustomPipe walks the real ordering -- record written, captured, CLEARED, then the replacement built -- and fails against the exact code #446 shipped: args [supervise --state-dir ...] carry pipe "", want "\\.\pipe\skrog-e2e-suite" TestCrashRestartUsesTheRecordedPipe covers the other direction, so the fallback cannot rot. Not claiming this closes #429 until the acceptance suite says so. That claim is what was wrong last time.
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.
#446 did not fix #429, and the nightly said so. Same failure, byte for byte.
#446 had
spawnSupervisorread the recorded endpoint to decide whether to forward--pipe. ButrunSuperviseclears that record on a clean exit:and
restart --supervisorexits the old supervisor cleanly before spawning the replacement:spawnSupervisor→ReadEndpoint→ nothingI read the record after the thing that writes it had removed it. It worked for a hard kill, where the record survives — which is why the test passed. That test wrote an endpoint and called
supervisorCommanddirectly: it modelled the crash path, not the restart sequence. The right assertion about the wrong scenario.The fix
runRestartcaptures the pipe before recycling and carries it throughrunStartPreservingtospawnSupervisor. The recorded read stays as the fallback, because for a supervisor that died hard it is the only thing that remembers which pipe was served.runStartPreservingrather than a--pipeflag onstart: this is not something a user asks for, it is one command carrying a value across a teardown that would otherwise erase it. A CLI flag would document a decision the caller never makes.Verification
TestRestartSequencePreservesTheCustomPipewalks the real ordering — record written, captured, cleared, then the replacement built — and fails against exactly the code #446 shipped:TestCrashRestartUsesTheRecordedPipecovers the other direction so the fallback cannot rot.I am not claiming this closes #429 until the acceptance suite says so. Making that claim without running it is what was wrong last time.