test: LiveQuery disconnect does not clear subscription info#10414
test: LiveQuery disconnect does not clear subscription info#10414mtrezza merged 2 commits intoparse-community:alphafrom
Conversation
Add test proving that client disconnect does not call deleteSubscriptionInfo, disproving the claim in advisory GHSA-3rpv-5775-m86r that subscriptionInfo becomes undefined on disconnect causing protectedFields to fail open.
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdded a Jasmine test that exercises the server's registered Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@spec/ParseLiveQueryServer.spec.js`:
- Around line 660-673: The test currently only asserts that
client.deleteSubscriptionInfo was not called after emitting 'disconnect', which
can pass if the disconnect listener never ran; modify the spec to also assert a
positive side-effect of the disconnect handler so the handler actually executed:
after calling addMockSubscription(parseLiveQueryServer, clientId, requestId,
parseWebSocket) and parseLiveQueryServer._onConnect(parseWebSocket) then emit
'disconnect' and add a positive expectation such as verifying
parseLiveQueryServer._connectedClients no longer contains clientId (or that
parseWebSocket.connected flag changed, or that a mock disconnect handler spy was
called) to prove the disconnect listener ran while keeping the existing assert
that client.deleteSubscriptionInfo was not called; reference symbols:
addMockSubscription, parseLiveQueryServer._onConnect,
parseWebSocket.emit('disconnect'), client.deleteSubscriptionInfo.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 86f2d7a1-cd50-421c-9549-3116715eefc3
📒 Files selected for processing (1)
spec/ParseLiveQueryServer.spec.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10414 +/- ##
==========================================
- Coverage 83.98% 83.98% -0.01%
==========================================
Files 192 192
Lines 16749 16749
Branches 229 229
==========================================
- Hits 14067 14066 -1
- Misses 2656 2657 +1
Partials 26 26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
🎉 This change has been released in version 9.8.0-alpha.11 |
Issue
LiveQuery disconnect does not clear subscription info
Tasks