Skip to content

[PM-35357] Update Trial Length Parameter#7597

Open
sbrown-livefront wants to merge 30 commits intomainfrom
billing/pm-35357/update-trial-length-parameter
Open

[PM-35357] Update Trial Length Parameter#7597
sbrown-livefront wants to merge 30 commits intomainfrom
billing/pm-35357/update-trial-length-parameter

Conversation

@sbrown-livefront
Copy link
Copy Markdown
Collaborator

@sbrown-livefront sbrown-livefront commented May 7, 2026

🎟️ Tracking

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

📔 Objective

This pull request implements a custom trial length to be specified.

API and model changes:

  • Added TrialLength (with validation of 0–30 days) properties to organization creation and signup models (OrganizationCreateRequestModel, OrganizationNoPaymentCreateRequest, OrganizationSignup) and ensured these are passed through to business logic and billing.
  • Updated the API for sending trial initiation verification emails to require and validate the new fields.

Business logic and billing integration:

  • The billing service uses the custom trial length if provided and validated; otherwise, it falls back to the default plan trial period.

📸 Screenshots

Screen.Recording.2026-05-08.at.2.03.17.PM.mov

@sbrown-livefront sbrown-livefront self-assigned this May 7, 2026
@sbrown-livefront sbrown-livefront added the ai-review Request a Claude code review 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 PR adds a custom TrialLength (0–30 days) parameter to organization signup and trial-initiation flows, replacing the prior hard-coded 7-day default. Validation is layered (API model [Range(0, 30)], plus a BadRequestException in CloudOrganizationSignUpCommand.ValidateTrialLength), the previously identified cache-miss validation gap was resolved by removing the ITrialInitiationCache infrastructure, and the email copy logic now keys on TrialLength > 0 to preserve "free trial" wording for any non-zero trial. New tests cover boundary cases (negative, 0, 30, 31, null) at both the request model and command layers.

Code Review Details

No findings.

All previously raised concerns on this PR have been addressed:

  • Cache-miss bypass on TrialInitiationCache resolved by removing the cache entirely.
  • The decoupling of custom trial length from a verified email was confirmed intentional and the description was updated.
  • The earlier defective ValidateTrialLengthAsync_CacheMiss tests were superseded by new tests that exercise ValidateTrialLength through SignUpOrganizationAsync with explicit boundary values.

Comment thread src/Core/Billing/Cache/TrialInitiationCache.cs Outdated
@sbrown-livefront sbrown-livefront changed the title Billing/pm 35357/update trial length parameter [PM-35357] Update Trial Length Parameter May 7, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 78.26087% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.96%. Comparing base (dd19dd8) to head (17fe75b).

Files with missing lines Patch % Lines
.../Billing/Models/Mail/TrialInititaionVerifyEmail.cs 0.00% 6 Missing ⚠️
.../SendTrialInitiationEmailForRegistrationCommand.cs 0.00% 5 Missing ⚠️
...es/Organizations/CloudOrganizationSignUpCommand.cs 83.33% 2 Missing and 1 partial ⚠️
src/Core/Platform/Mail/HandlebarsMailService.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7597      +/-   ##
==========================================
+ Coverage   59.83%   59.96%   +0.12%     
==========================================
  Files        2103     2104       +1     
  Lines       92788    92840      +52     
  Branches     8266     8270       +4     
==========================================
+ Hits        55523    55672     +149     
+ Misses      35295    35198      -97     
  Partials     1970     1970              

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

@sbrown-livefront sbrown-livefront marked this pull request as ready for review May 8, 2026 18:29
@sbrown-livefront sbrown-livefront requested review from a team as code owners May 8, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants