test(pubsub): add regression coverage for subscribe race edges#609
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8aea70e95a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Thanks for this, the direction is good and the added race coverage is valuable I have two test-hardening requests before merge:
With those tightened, I’m +1 to merge. |
|
Updated! Also I checked off to allow maintainers edit access so feel free to modify my commit as you wish if it's faster! |
marcus-pousette
left a comment
There was a problem hiding this comment.
Reviewed: regression coverage is valuable and aligns with current pubsub behavior. Approving.
Summary
This PR adds focused pubsub regression coverage based on historical issues discussed in #596.
masteralready has coverage for:But it did not have explicit regression tests for a few race/design edges that #596 attempted to protect.
What this adds
New file:
packages/transport/pubsub/test/subscribe-races.spec.tsNew regression tests:
subscribe()andconnect()happen concurrently.subscribe()followed byunsubscribe()within the debounce window does not leave stale remote subscriber state.Why these tests are useful
These are race-sensitive behaviors that are easy to regress during refactors around:
They complement existing
fanout-topics.spec.tschecks by asserting network-visible behavior (peer discovery / non-discovery), not only local state transitions.Notes from PR #596 analysis
requestSubscribers while remote _subscribe() is blockedscenario from PubSub pendingSubscriptions + SharedLog replication handshake hardening #596 still fails on current master when enabled.Verification
Run:
node ./node_modules/aegir/src/index.js run test --roots ./packages/transport/pubsub -- -t nodeResult locally: passing (
53 passing).Looped regression test 50 times and it passes every time.