Repository navigation
fix(platform): gate member bulk-select and guard self-removal (#2043) - #2247
Conversation
Desk Review — PR #2247 (fixes #2043)Verdict: READY TO MERGE. Two-round review (5 breadth subagents across correctness/robustness/elegance/tests/boundaries, then independent confirmation of every blocking candidate). The change cleanly satisfies both halves of the issue. CIAll 47 required checks pass (Type check, Lint, Unit, UI, Build platform/convex, Playwright platform 1–16, Smoke test, etc.); the remaining jobs (Trivy, fork-PR/container variants) are TestsRan What was verified
Non-blocking observations (not required for merge)
READY TO MERGE. |
Summary
Fixes the ungated member bulk-select and the missing backend self-removal guard reported in #2043.
Previously, in the Org settings Members table, the bulk-select checkbox was rendered for every row — including the current user's own row and the owner row — even though the single-row action menu hides Delete for self and owner. And
removeMemberhad noauthUser.userId === member.userIdcheck, so an admin could delete their own membership, causing a self-lockout plus an irreversiblecascadeOnMemberRemovedwipe of their ownuserMemories/userPreferences/org-scoped TTS.Changes
member-table.tsx): replaced the bareenableRowSelectionboolean with a per-row predicate that mirrors the single-row Delete gating — the current-user row and the owner row are no longer selectable for bulk-delete. Uses the sameenableRowSelection={(row) => ...}shape already used byagents-table.tsxand typed onDataTable.members/mutations.ts): added a self-removal guard inremoveMember— throwsYou cannot remove your own membershipwhenmember.userId === authUser.userId, as defense in depth regardless of how the request is issued.members/mutations.test.ts): added a regression test asserting an admin cannot remove their own membership and that no deletion is attempted.Verification
bunx vitest --run --project server convex/members/mutations.test.ts→ 22 passedbunx tsc --noEmit→ 0 errorsbunx oxlint --type-awareon changed files → 0 warnings, 0 errorsCloses #2043