Repository navigation
test: fix the heartbeat data race and the subscriber-baseline wait in the finalization wiring tests - #428
Merged
Conversation
…before starting the feed
startAPIEventFeeder and subscribeAndBroadcast subscribe from their own
goroutines; the tests read GetSubscriberCount()+1 after starting them, so a
fast subscription was already counted and the wait targeted one subscriber
that never came ("gated ws message feed never reached 2 subscribers (got 1)"
after 5 s, seen on the windows shard C). The baseline is now read first.
Reproduced by delaying the baseline read by 300 ms: the old order fails with
exactly that message, the new order passes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…under registry.Lock getModel mutates the row's model map; every production caller holds the registry lock, the test did not. The flush worker that an earlier test starts through ensureWorker (alive for the rest of the package run) clones the same map under the lock, so the -race job of the fork CI reported a data race (heartbeat.go:563/565 against budget.go:26/27 via writer.go:84). Co-Authored-By: Claude Sonnet 5.5 <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.
Two flaky tests, fixed at their mechanism (#157)
Both showed up as red jobs in unrelated fork CI runs; neither is a product defect.
heartbeatdata race under-race(race-ubuntu):TestRevisitAfterEvictNotSilentlyZerocalledgetModelwithoutregistry.Lock(). Every production caller holds the lock, and the background flush worker (started by an earlier test throughensureWorker, alive for the rest of the package run) clones the same model map under it. The test now takes the lock.finalization_wiring_test, windows shard: three tests readGetSubscriberCount()+1after startingstartAPIEventFeeder/subscribeAndBroadcast, which subscribe from their own goroutines; a fast subscription was already counted and the wait targeted one subscriber that never came ("gated ws message feed never reached 2 subscribers (got 1)" after 5 s). The baseline is now read before starting. Reproduced deterministically by delaying the baseline read by 300 ms: the old order fails with exactly that message, the new order passes.Full fork CI run 43751366961 on
793eb9008is green (22 jobs, includingrace-ubuntuand windows shard C).🤖 Generated with Claude Code