test(daemon): give the spawned helper room to start - #210
Open
ssowonny wants to merge 1 commit into
Open
Conversation
TestStopRecoversLegacyDaemon waited 5s for a helper to take the flock — the shortest deadline in the package for its slowest operation. Every other wait here is 10s and polls in-process state; this one re-invokes os.Args[0], so a real child has to boot Go's test framework before it reaches the helper at all. It duly flaked on a loaded macOS runner, on main and on a PR, at the same line, both green on re-run with no code change. 30s. The loop returns the moment the lock appears, so a healthy run pays nothing — the number is only a ceiling on how long a genuine failure takes to report. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
TL;DR
mainand on Desktop parity: the Mac app stops falling behind the web app #209 today, fixed at the cause.TestStopRecoversLegacyDaemongave a spawned child process 5s to take a file lock — the shortest deadline in the package, on its slowest operation.Why 5s was the wrong number
Every other wait in
internal/daemonuses 10s and polls in-process state (secdmnWaitFor,wsWaitFor). This one is the only place that spawns a real child:exec.Command(os.Args[0], "-test.run=TestHelperLegacyDaemon", ...). That child has to boot Go's entire test framework before it reaches the helper and callssyscall.Flock.So it had the tightest budget for the longest operation. On a loaded GitHub macOS runner it doesn't make it:
Seen today on
main(dd9a5c0) and on #209, same line, macOS only, both green on re-run with no code change. The test dates to #88 (July); nothing in the recent stack touchesinternal/daemon.Why the headroom is free
The loop breaks as soon as
Running(vdir)reports the lock — the deadline is only a ceiling on how long a genuine failure takes to report, not a delay any passing run waits out.go test ./internal/daemonis 36s here, unchanged.Deliberately not done: converting this to the package's
waitForhelpers. They poll in-process state and this waits on a process; folding them together would hide exactly the difference that caused the flake.🤖 Generated with Claude Code