Skip to content

[PM-25690] Create UpdateUserResetPasswordEnrollment command#7594

Open
r-tome wants to merge 8 commits intomainfrom
ac/pm-25690/create-updateuserresetpasswordenrollment-command
Open

[PM-25690] Create UpdateUserResetPasswordEnrollment command#7594
r-tome wants to merge 8 commits intomainfrom
ac/pm-25690/create-updateuserresetpasswordenrollment-command

Conversation

@r-tome
Copy link
Copy Markdown
Contributor

@r-tome r-tome commented May 7, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-25690

📔 Objective

Extract the method from OrganizationService into its own command.

r-tome added 6 commits May 7, 2026 11:00
… managing user password reset enrollment in organizations
…or user password reset enrollment management
…nrollmentCommand for password reset enrollment updates
…ndencies from IOrganizationService and OrganizationService implementations
@r-tome r-tome added the ai-review-vnext Request a Claude code review using the vNext workflow label May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Bitwarden Claude Code Review

Overall Assessment: APPROVE

This refactor extracts UpdateUserResetPasswordEnrollmentAsync from OrganizationService into a dedicated UpdateUserResetPasswordEnrollmentCommand following the CQS pattern. The implementation logic is preserved verbatim, both controller call sites are migrated, the method is removed from IOrganizationService, and the now-unused IPolicyQuery dependency is correctly dropped from OrganizationService. Marking resetPasswordKey as nullable on the new interface documents the previously-implicit withdraw-via-null contract.

Code Review Details

No findings. Coverage of validation branches (orgUser missing, calling user mismatch, org missing or UseResetPassword=false, policy disabled, auto-enroll + withdrawal) is thorough in UpdateUserResetPasswordEnrollmentCommandTests, and the new integration tests exercise the enroll and withdraw happy paths end-to-end. The DI registration sits next to sibling organization-user commands using the same AddScoped style as the rest of AddOrganizationUserCommands. The previous reviewer's concern about conditional logic in tests has been addressed via shared helper methods and clearer test names.

@r-tome r-tome marked this pull request as ready for review May 7, 2026 10:36
@r-tome r-tome requested a review from a team as a code owner May 7, 2026 10:36
@r-tome r-tome requested a review from JimmyVo16 May 7, 2026 10:36
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.77%. Comparing base (55e06e3) to head (2148a4f).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...llment/UpdateUserResetPasswordEnrollmentCommand.cs 95.12% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7594      +/-   ##
==========================================
+ Coverage   59.76%   59.77%   +0.01%     
==========================================
  Files        2103     2110       +7     
  Lines       92738    92786      +48     
  Branches     8262     8250      -12     
==========================================
+ Hits        55426    55464      +38     
- Misses      35354    35355       +1     
- Partials     1958     1967       +9     

☔ View full report in Codecov by Sentry.
📢 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.

@r-tome r-tome added the needs-qa label May 7, 2026
@JimmyVo16
Copy link
Copy Markdown
Contributor

Reviewing this will be my top priority today.

…asswordEnrollmentCommand to support nullable resetPasswordKey
OrganizationUser orgUser,
SutProvider<UpdateUserResetPasswordEnrollmentCommand> sutProvider)
{
orgUser.UserId = mismatchUserId ? Guid.NewGuid() : callingUserId;
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.

Not necessarily a blocker, but I find that conditional statements like this in tests make them harder to read and can lead to potential bugs in the test code. Can we break this out into separate tests with helper methods for the shared logic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refactored those tests and also renamed some to be clearer

Copy link
Copy Markdown
Contributor

@JimmyVo16 JimmyVo16 left a comment

Choose a reason for hiding this comment

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

Just one comment about the test code, but overall approved.

…mprove naming conventions and enhance clarity in test cases
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

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.

2 participants