fix: clean up login tokens in users.deactivateidle#40570
Conversation
🦋 Changeset detectedLatest commit: fbd0540 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/app/api/server/v1/users.ts">
<violation number="1" location="apps/meteor/app/api/server/v1/users.ts:423">
P2: The new read-then-update flow is non-atomic and can send `watch.users` updates for users that were not actually deactivated.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Re-trigger cubic
| lastLoggedIn.setDate(lastLoggedIn.getDate() - daysIdle); | ||
|
|
||
| // since we're deactiving users that are not logged in, there is no need to send data through WS | ||
| const ids = await Users.findActiveNotLoggedInAfterWithRole(lastLoggedIn, role, { projection: { _id: 1 } }) |
There was a problem hiding this comment.
P2: The new read-then-update flow is non-atomic and can send watch.users updates for users that were not actually deactivated.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/app/api/server/v1/users.ts, line 423:
<comment>The new read-then-update flow is non-atomic and can send `watch.users` updates for users that were not actually deactivated.</comment>
<file context>
@@ -420,9 +420,20 @@ API.v1.addRoute(
lastLoggedIn.setDate(lastLoggedIn.getDate() - daysIdle);
- // since we're deactiving users that are not logged in, there is no need to send data through WS
+ const ids = await Users.findActiveNotLoggedInAfterWithRole(lastLoggedIn, role, { projection: { _id: 1 } })
+ .map(({ _id }: { _id: string }) => _id)
+ .toArray();
</file context>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-7.10.12 #40570 +/- ##
==================================================
Coverage ? 66.26%
==================================================
Files ? 3311
Lines ? 111285
Branches ? 21068
==================================================
Hits ? 73741
Misses ? 34815
Partials ? 2729
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Backport of #40496