fix: Duplicate session destruction can cause unhandled promise rejection#10319
Conversation
|
I will reformat the title to use the proper commit message syntax. |
|
🚀 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. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
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 (2)
📝 WalkthroughWalkthroughThe changes ensure duplicate sessions are reliably destroyed during user creation by making Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.41.1)spec/ParseUser.spec.js[] 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alpha #10319 +/- ##
==========================================
- Coverage 92.53% 92.52% -0.01%
==========================================
Files 192 192
Lines 16502 16504 +2
Branches 227 227
==========================================
+ Hits 15270 15271 +1
- Misses 1212 1213 +1
Partials 20 20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# [9.7.0-alpha.6](9.7.0-alpha.5...9.7.0-alpha.6) (2026-03-26) ### Bug Fixes * Duplicate session destruction can cause unhandled promise rejection ([#10319](#10319)) ([92791c1](92791c1))
|
🎉 This change has been released in version 9.7.0-alpha.6 |
Issue
destroyDuplicatedSessionsinRestWrite.jscallsdatabase.destroy()without returning the promise (fire-and-forget). This causes unhandled promise rejections when the database operation fails, which in modern Node.js terminates the process by default. It also causes flaky tests whenreconfigureServer()tears down the database while the background destroy is still pending.Approach
database.destroy()promise fromdestroyDuplicatedSessionsso it is properly awaited in theRestWriteexecute chainOBJECT_NOT_FOUNDerrors since having no duplicate sessions to delete is a normal conditionParseUser.spec.jsthat was compensating for the fire-and-forget patternTasks
Summary by CodeRabbit