Skip to content

[PC-42433] Handle Seat Expansion for Staged Users - #8251

Merged
sven-bitwarden merged 2 commits into
mainfrom
ac/pm-42433/handle-staged-seats-accept-org-link
Aug 26, 2026
Merged

[PC-42433] Handle Seat Expansion for Staged Users#8251
sven-bitwarden merged 2 commits into
mainfrom
ac/pm-42433/handle-staged-seats-accept-org-link

Conversation

@sven-bitwarden

@sven-bitwarden sven-bitwarden commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

PM-42433

📔 Objective

Staged users are pre-existing organization users that do not occupy a seat for billing purposes - it is therefore necessary to do seat-count validation before promoting them in all scenarios.

@sven-bitwarden
sven-bitwarden requested a review from a team as a code owner August 25, 2026 04:48
@sven-bitwarden
sven-bitwarden requested a review from eliykat August 25, 2026 04:48
@sven-bitwarden sven-bitwarden added t:bugfix Change Type - Bugfix ai-review-vnext Request a Claude code review using the vNext workflow labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the seat-reservation fix in AcceptOrganizationInviteLinkCommand plus its unit tests. The premise holds: Organization_ReadOccupiedSeatCountByOrganizationId counts only statuses 0/1/2 and the EF equivalent filters to Invited/Accepted/Confirmed, so a Staged row occupies no seat and promoting it to Accepted genuinely consumes capacity — the new reservation is correct. The Invited branch is rightly left alone (those rows already count), and since the validator rejects Revoked/Accepted/Confirmed up front, Invited and Staged are the only statuses reaching AcceptExistingOrgUserAsync; GetByOrganizationEmailAsync applies no status filter and staged rows always have UserId = null, so the email-lookup path is the one that surfaces them. The ReserveSeatAsync extraction is behavior-preserving for CreateNewMembershipAsync and runs before any persistence or emergency-access deletion, and the tests cover seats-available, autoscale, no-seats, and billing-failure paths plus a guard test proving the Invited path does not over-reserve.

Code Review Details

No findings.

PR Metadata Assessment

  • ❓ : Title says PC-42433 while the tracking link is PM-42433 — likely a typo that will break Jira linking.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.21%. Comparing base (aebb9c4) to head (d65c4a5).

❗ There is a different number of reports uploaded between BASE (aebb9c4) and HEAD (d65c4a5). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (aebb9c4) HEAD (d65c4a5)
2 1
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8251      +/-   ##
==========================================
- Coverage   68.88%   63.21%   -5.68%     
==========================================
  Files        2410     2410              
  Lines      104442   104452      +10     
  Branches     9457     9459       +2     
==========================================
- Hits        71946    66028    -5918     
- Misses      30115    36165    +6050     
+ Partials     2381     2259     -122     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eliykat eliykat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a minimal fix for this logic. It might benefit from @r-tome 's eyes as well as he wrote this originally.

@r-tome r-tome left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Nice work

@sven-bitwarden
sven-bitwarden merged commit b482412 into main Aug 26, 2026
48 checks passed
@sven-bitwarden
sven-bitwarden deleted the ac/pm-42433/handle-staged-seats-accept-org-link branch August 26, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow t:bugfix Change Type - Bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants