Repository navigation
mcpx tests: assert the spawn happened in TestEnsureDaemonCancelledWhileWaiting - #362
Merged
Merged
Conversation
…leWaiting The dezren39/nix copy of this test (TestEnsureDaemonCancelWhilePolling) has always asserted, after the prompt context.Canceled return, that the daemon spawn actually happened — waiting up to 5s for the fake daemon's marker, since cmd.Start returns before the child runs and the child is Setsid + Released. This copy discarded the marker, so it would pass even if EnsureDaemon returned context.Canceled without spawning at all. Ported as part of the mcpx dedup (code becomes the single source; the nix copy is deleted and pinned to this repo). Ablation: with cmd.Start stubbed out, the test now fails with 'expected the daemon spawn to have happened before cancellation'; unmodified code passes, as does the full internal/cli suite. Closes #361
This was referenced Oct 19, 2026
This was referenced Oct 26, 2026
Closed
Open
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.
Problem → solution
The mcpx dedup audit (this repo's
pkgs/mcpxvs the vendored copy in dezren39/nix) found all production code behaviorally identical; the one real divergence was test-only: the nix copy's cancel-while-polling test asserts the daemon spawn actually happened, this copy's didn't. This ports that assertion (see #361 for the full evidence), so this repo — about to become the only mcpx source — loses no coverage when the nix copy is deleted.TestEnsureDaemonCancelledWhileWaitingnow keeps the marker fromensureTestClientand, after the existing error/promptness assertions, waits up to 5s for it, failing with "expected the daemon spawn to have happened before cancellation". The bounded wait mirrors the patternTestEnsureDaemonNeverReadyStillTimesOutalready uses (cmd.Start returns before the child runs; the child is Setsid + Released, so the marker can land after the return).Verification
go test ./internal/cli/ -run TestEnsureDaemon -count=1 -v: all 5 pass.cmd.Start/Releasetemporarily stubbed out ofEnsureDaemon, the test fails with exactly that message (5.21s); stub reverted.go test ./internal/cli/ -count=1: ok (25.2s).Closes #361. Downstream: dezren39/darwin-nix#468 pins this repo (at the merge rev of this PR) as its mcpx source and deletes its vendored copy.
Need help on this PR? Tag
@codesmith-botwith what you need.