test(moq-gst): decide the cancelled pump race instead of sleeping on it - #3898
Conversation
`a_subscription_resolving_after_cancellation_creates_no_pad` cleared the catalog and answered the subscription immediately after, assuming the session had reconciled the removal by then. It had not on a slower machine: the pump won its select, went live, and took the pad the test forbids. CI failed it twice in a row while it passed 12/12 here. The interleaving is not the test's to choose, so it stops trying. The session test now waits for the cancelled pump to drop its subscription, an edge it can observe through `Request::poll_unused`, and asserts with no sleep at all. What that wait gives up, a subscription resolving *after* the teardown, is what `PumpState` decides, so the compare and swap that refuses the losing side gets a unit test of its own. Breaking `go_live` fails that test; the old one only caught it by luck. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review. WalkthroughThe test module now covers exclusive Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The tests now synchronize on subscription release instead of sleeping, improving reliability without changing production behavior. The PR is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
No issues found. |
|
Summary of changes:
CI is green (Check, Test, meta-review), moq-bot approved, CodeRabbit found nothing actionable. Enabling auto-merge (squash). This also unblocks #3867. (Written by MiMo) |

Problem
moq-gst source::imp::session_tests::a_subscription_resolving_after_cancellation_creates_no_padfails in CI. It blocked #3867, which is the first PR in a while whose selection covers the whole workspace, so nothing else was running moq-gst's tests to notice.The test cleared the catalog and answered the held subscription immediately after, assuming the session had reconciled the removal in between. Nothing made that true:
follow_catalogreconciles on its own runtime, and when the answer lands first the pump wins itsselect!, goes live and takes the pad the test forbids. That is the documented behavior for a rendition that goes live before its removal is seen (#3864), so the test was calling a correct outcome a failure. A 500 ms sleep after the answer only decided how often.It failed 2/2 on GitHub runners and passed 12/12 locally: isolated, pinned to one core, under 16 busy loops, and as the full moq-gst suite on two cores.
Approach
The interleaving is not the test's to choose, so it stops trying.
Request::poll_unused, then answers and asserts with no sleep at all. It runs in 0.020 s instead of 0.523 s, and is renamed to what it now proves:a_rendition_delisted_while_subscribing_takes_no_pad.PumpStatedecides. Its compare-and-swap pair gets a unit test,a_pump_either_goes_live_or_is_cancelled, covering both directions and the double-claim of each.No production code changes: the guard was already correct.
Impact
Alternatives
Verification
just checkandjust testpass; 132 moq-gst tests, including both tests here.go_live's compare-exchange with an unconditional store fails it. The old test still passed under the same mutation, which is what "only caught it by luck" means.Follow-ups
(written by Opus 5)
🤖 Generated with Claude Code