{{ message }}
Repository navigation
Fix negative team nbMembers on account closure - #22109
Open
slick-daddy wants to merge 2 commits into
Open
slick-daddy wants to merge 2 commits into
slick-daddy wants to merge 2 commits into
Conversation
slick-daddy
force-pushed
the
fix-team-nbmembers-7624
branch
3 times, most recently
from
October 16, 2026 11:22
eb8334d to
abae4c9
Compare
ornicar
force-pushed
the
fix-team-nbmembers-7624
branch
from
October 17, 2026 08:16
abae4c9 to
5b417b2
Compare
quitAllOnAccountClosure decremented nbMembers for every cached team, unconditionally and outside the per-team work queue. Stale cache entries or a quit/kick racing the closure decremented counters without removing memberships, driving nbMembers negative. It now quits actual DB memberships through the guarded per-team path (decrement only on real removal), repeating until none is left, and team deletion paths clean up member docs and caches.
ornicar
force-pushed
the
fix-team-nbmembers-7624
branch
from
October 19, 2026 10:31
5b417b2 to
4f3faac
Compare
ornicar
reviewed
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

quitAllOnAccountClosuredecrementednbMembersfor every team in the cached team list, unconditionally and outside the per-team work queue. Any stale cache entry (or a quit/kick racing the closure) decremented a counter without removing a membership, drivingnbMembersto -1. It now reads the user's actual memberships from the DB and quits each team through the guarded per-team path, so a counter only drops when a membership doc was really removed. This also covers disabled teams, which the old cache-sourced list missed.While there, same class of staleness fix: team deletion now invalidates ex-members' team caches and cleans up their requests, deleteNewlyCreatedBy removes orphaned member/request docs instead of leaving them behind, and class-team sync counts removals that actually happened instead of assuming them all succeeded.