Fix peer connection previous-connect analytics scope - #1763
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
WalkthroughPeer connection analytics now tracks publisher and subscriber connection history separately. The role-specific state is passed to event reporting, which no longer stores its own connection-history map. Tests cover initial connections, failures, connected states, and publisher reconnects. ChangesPeer connection history tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PeerConnectionAnalytics
participant StateHolder
participant ClientEventReporter
PeerConnectionAnalytics->>StateHolder: update role when connection reaches CONNECTED
PeerConnectionAnalytics->>StateHolder: read role-specific ever-connected state
PeerConnectionAnalytics->>ClientEventReporter: report state with wasPrevConnected
ClientEventReporter->>ClientEventReporter: handle connecting state
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
SDK Size Comparison 📏
|
aleksandar-apostolov
left a comment
There was a problem hiding this comment.
LGTM on the fix — clean re-scope of wasPreviouslyConnected into the per-call state holder. Please add a test asserting a new call starts wasPrevConnected = false after a prior call connected — that's the actual AND-1368 regression and it's currently uncovered.
Added 2 tests to cover this case
|
|




Goal
Closes #AND-1368
Ensure
wasPreviouslyConnectedis reported only for the relevant peer connection role within the current call analytics lifecycle, instead of leaking cached state from previous calls.Implementation
Moved peer connection “ever connected” tracking out of the client-level reporter state and into
PeerConnectionAnalyticsStateHolder, so the value is scoped to peer connection analytics for the current call.PeerConnectionAnalyticsnow updates publisher/subscriber connected state when aCONNECTEDevent is observed and passes the role-specificwasPrevConnectedvalue intoClientEventReporter.🎨 UI Changes
None
Testing
wasPrevConnected = falsewasPrevConnected = truewasPrevConnectedinput instead of relying on cached client-level stateSummary by CodeRabbit
Analytics
Tests