Skip to content

Conversation

@sbrown-livefront
Copy link
Collaborator

@sbrown-livefront sbrown-livefront commented Nov 18, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-26044
https://bitwarden.atlassian.net/browse/PM-26589

📔 Objective

The offboarding survey component is updated to dynamically include a "switching" reason based on whether the user is canceling an organization or personal plan. This involves modifying the reasons array to include either "switchToFreeOrg" or "switchToFreePlan" options. This change retains the "tooExpensive" message for organizations other than Families.

Changes

  • Added ChangeDetectionStrategy.OnPush
  • The reasons array initialization is moved from a field declaration to the constructor to allow for dynamic content based on dialogParams.
  • The getSwitchingReason method is added to conditionally create a "switching" reason based on the dialogParams.type ("Organization" or personal).
  • Removed tooExpensive translation that is only used in this component

📸 Screenshots

Families Cancellation

Screen.Recording.2025-11-18.at.3.23.15.PM.mov

Teams Cancellation

Screen.Recording.2025-11-20.at.9.52.39.AM.mov

User Cancellation

Screen.Recording.2025-11-18.at.3.22.49.PM.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@sbrown-livefront sbrown-livefront self-assigned this Nov 18, 2025
@sbrown-livefront sbrown-livefront requested a review from a team as a code owner November 18, 2025 20:20
@claude
Copy link

claude bot commented Nov 18, 2025

Claude finished @sbrown-livefront's task —— View job


Code Review Complete

  • Read all changed files
  • Review previous fix for OnPush change detection
  • Review previous fix for Stripe API values
  • Check for new issues
  • Post comprehensive review

Summary

This PR successfully implements dynamic offboarding survey reasons based on subscription type. The code is well-structured and previous review concerns have been properly addressed. However, test coverage remains critically low at 22.22% for the new logic.

Findings

Finding 1: Missing test coverage for core business logic (apps/web/src/app/billing/shared/offboarding-survey.component.ts:131-149)

The getSwitchingReason() method contains the core business logic for this PR but has no test coverage. This method makes important decisions based on subscription type and plan, which should be verified through tests.

Recommended test cases
describe('getSwitchingReason', () => {
  it('should return switchToFreePlan text for User type', () => {
    // Test user cancellation
  });

  it('should return switchToFreeOrg text for Families plans', () => {
    // Test FamiliesAnnually, FamiliesAnnually2019, FamiliesAnnually2025
  });

  it('should return tooExpensive text for non-Family organization plans', () => {
    // Test Teams, Enterprise, etc.
  });

  it('should always use too_expensive as the Stripe API value', () => {
    // Verify Stripe API constraint is maintained
  });
});

Positive Observations

👍 OnPush change detection safety issue properly addressed using optional chaining in the template (line 25)

👍 Correctly respects Stripe API cancellation_details.feedback constraint by using too_expensive value

👍 Clean separation of concerns with getSwitchingReason() method

👍 Proper handling of all three Families plan enum values

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

Logo
Checkmarx One – Scan Summary & Details64695ca1-a8cf-4645-9d47-b2cd8cc2c8a3

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.25%. Comparing base (81453ed) to head (591f370).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...app/billing/shared/offboarding-survey.component.ts 22.22% 7 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17472   +/-   ##
=======================================
  Coverage   41.25%   41.25%           
=======================================
  Files        3546     3546           
  Lines      102040   102047    +7     
  Branches    15308    15310    +2     
=======================================
+ Hits        42099    42104    +5     
- Misses      58177    58179    +2     
  Partials     1764     1764           

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

kdenney
kdenney previously approved these changes Nov 19, 2025
Copy link
Contributor

@kdenney kdenney left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@amorask-bitwarden amorask-bitwarden left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix!

@github-actions github-actions bot temporarily deployed to Web Vault - EU QA Cloud November 19, 2025 18:20 Inactive
@github-actions github-actions bot temporarily deployed to Web Vault - EU QA Cloud November 20, 2025 17:27 Inactive
@sbrown-livefront sbrown-livefront merged commit 9afba33 into main Nov 20, 2025
66 of 72 checks passed
@sbrown-livefront sbrown-livefront deleted the billing/pm-26044/update-survey-for-user-and-organization branch November 20, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants