Fixes flaky remove_listener subscriber test - #35
Merged
Conversation
The test called add_listener/2 right after start_early!, racing the initialize burst's messages into the subscriber's mailbox - sends from different processes have no cross-sender ordering guarantee, so the listener occasionally caught burst messages that later tripped refute_receive (7 of 100 runs failed under CPU load; 0 of 100 after). The listener is now registered at start_link time, so it deterministically sees the whole burst. The test asserts seq 0..5 arrive, removes the listener with the synchronous call, drives the event, and ends on refute_received - the subscriber's final stats reply is ordered after any fan-out send, so no timeout is needed. Refs: sui-hmm
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.
Why
test/statifier_ui/trace/subscriber_test.exs- "remove_listener/2 stopsdelivery to that pid" - failed intermittently: on 2026-08-22 it broke one
full-gate run on a branch that never touched the file, passed on immediate
rerun, and stayed green across three consecutive later gates. A timing race,
not branch-related (sui-hmm).
What
Test-only change. The test called
add_listener/2(a call from the testprocess) immediately after
start_early!, racing the initialize burst's{:statifier, ...}messages (sends from the session process) into thesubscriber's mailbox - cross-sender delivery order is not guaranteed, so the
listener occasionally caught burst messages that later tripped
refute_receive.The test now registers the listener at
start_linktime viastart_early!(..., listeners: [self()]), so it deterministically sees thewhole burst; it asserts seq 0..5 arrive (delivery was live), removes the
listener with the synchronous call before driving the event, and ends on
refute_received- the subscriber's final stats reply is ordered after anyfan-out send, so no sleep or timeout is needed.
Notes
untouched, so the just-merged inspector assembly's attach/catch-up usage is
unaffected. Full suite green on the rebased tree (3b43827), including the
new catch-up tests.
load, before vs after - before: 7/100 failures, all this test; after:
0/100. (One further before-run iteration failed differently because the
checkout was pulled mid-run - a torn-state artifact, not a flake.)
Gettext and Sobelow are declared not applicable in this repo.
Closes sui-hmm.