Skip to content

[PM-37953] Add OrganizationUserStatusType.Staged, Remove Ordinal Checks#7780

Open
sven-bitwarden wants to merge 7 commits into
mainfrom
ac/pm-37953/add-staged-organization-user-status-type
Open

[PM-37953] Add OrganizationUserStatusType.Staged, Remove Ordinal Checks#7780
sven-bitwarden wants to merge 7 commits into
mainfrom
ac/pm-37953/add-staged-organization-user-status-type

Conversation

@sven-bitwarden

@sven-bitwarden sven-bitwarden commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

PM-37953

📔 Objective

Tip

A vast, vast majority of this PR consists of tests and migrations - each adjustment to actual business code is only a line or two.

Following the technical breakdown for settings applicable to provisioned-but-not-invited users, we are introducing a new OrganizationUserStatusType. The largest challenge in doing so, is our internal inconsistencies with how we go about checking this value, causing any new addition to suddenly be included in a random assortment of queries.

This PR makes all checks consistent - when evaluating this property, we should only be concerned about what we want included, not what we want excluded (or other nondeterministic-over-time checks).

@sven-bitwarden sven-bitwarden requested review from a team as code owners June 8, 2026 06:25
@sven-bitwarden sven-bitwarden requested a review from jrmccannon June 8, 2026 06:25
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.51%. Comparing base (30d873f) to head (972f300).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...PolicyEventHandlers/SingleOrgPolicyEventHandler.cs 50.00% 0 Missing and 1 partial ⚠️
...dlers/TwoFactorAuthenticationPolicyEventHandler.cs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7780      +/-   ##
==========================================
+ Coverage   61.05%   65.51%   +4.45%     
==========================================
  Files        2173     2173              
  Lines       96580    96598      +18     
  Branches     8691     8691              
==========================================
+ Hits        58963    63282    +4319     
+ Misses      35516    31126    -4390     
- Partials     2101     2190      +89     

☔ 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.

@sven-bitwarden sven-bitwarden added needs-qa ai-review-vnext Request a Claude code review using the vNext workflow labels Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the introduction of OrganizationUserStatusType.Staged (status 3) and the migration of ordinal status checks (Status >= 0, Status != 0) to explicit set-membership across C# and SQL. The change touches policy enforcement, seat-count queries, claimed-domain queries, and the Dirt member-access report, with a coordinated EF + Dapper migration and matching test additions. SQL/EF parity is consistent: every count query that previously used Status >= 0 now uses Status IN (0, 1, 2) on both sides, and every "non-invited" query now explicitly enumerates Accepted/Confirmed/Revoked. Test coverage is strong (new theory-data cases for Staged across policy requirements, integration tests for OccupiedSeatCount, SmSeatCount, ClaimedDomains, and PolicyDetails queries, and a regression test on ProviderOrganization details).

Code Review Details

No findings. The previously raised bot threads (AccessSecretsManager == true style) are already resolved.

@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

Type = OrganizationUserType.User
};

private static OrganizationUser GetStagedOrganizationUser(Organization organization, User user) => new()

@jrmccannon jrmccannon Jun 16, 2026

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.

maybe make this a public ext method on org user for this project? Since its in two different tests.

Can go alongside OrgTestHelpers.cs

@jrmccannon jrmccannon 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.

One tiny thing. I'm fine if you don't do it.

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 needs-qa

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants