Skip to content

Conversation

@sbrown-livefront
Copy link
Collaborator

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

🎟️ Tracking

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

📔 Objective

  • Replaces hard-coded storage calculations with pricing property.
    • Removes optional check since maxStrorageGB and baseStorageGB should be included
  • Adds tests for PricingSummaryService

Note: This cannot be merged until after bitwarden/server#6571

📸 Screenshots

⏰ 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 14, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 14, 2025

Logo
Checkmarx One – Scan Summary & Details9ee8bb52-2717-4e3a-bafb-6e6840e55117

New Issues (1)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Missing_HSTS_Header /apps/web/src/app/dirt/reports/pages/inactive-two-factor-report.component.ts: 143
detailsThe web-application does not define an HSTS header, leaving it vulnerable to attack.
ID: alhjfubOVRYrjEwL%2BQtMJ8mzlvY%3D
Attack Vector

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.94%. Comparing base (9cd73b8) to head (380d8ef).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...c/billing/models/response/premium-plan.response.ts 0.00% 3 Missing ⚠️
...ling/organizations/change-plan-dialog.component.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17393      +/-   ##
==========================================
+ Coverage   40.93%   40.94%   +0.01%     
==========================================
  Files        3544     3544              
  Lines      101725   101727       +2     
  Branches    15240    15239       -1     
==========================================
+ Hits        41643    41656      +13     
+ Misses      58327    58299      -28     
- Partials     1755     1772      +17     

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

@sbrown-livefront sbrown-livefront marked this pull request as ready for review November 14, 2025 21:32
@sbrown-livefront sbrown-livefront requested a review from a team as a code owner November 14, 2025 21:32
@claude
Copy link

claude bot commented Nov 14, 2025

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


Review of Latest Changes

I've reviewed the recent commits pushed to address the previous feedback. Here's my assessment:

Summary

The author has successfully addressed the previously identified issues:

Finding 1:Null safety issues resolved - The storage calculation logic has been properly refactored in both change-plan-dialog.component.ts:622-627 and pricing-summary.service.ts:34 using Math.max(0, (sub?.maxStorageGb ?? 0) - plan.PasswordManager.baseStorageGb), which correctly handles null/undefined values.

Finding 2:Hard-coded template values fixed - The missed hard-coded storage references have been replaced:

  • Desktop premium component template now uses storageProvidedGb variable with proper i18n parameter
  • Cloud-hosted premium component template uses providedStorageGb$ observable
  • Organization plans component template uses selectedPlan.PasswordManager.baseStorageGb

Finding 3:Desktop translation updated - The premiumSignUpStorage translation key in apps/desktop/src/locales/en/messages.json:1490-1497 was properly updated to accept a $SIZE$ placeholder parameter, matching how it's used in the template.

Architecture Review

The implementation follows good practices:

  • Storage values flow from API responses through the service layer to components
  • Observable data patterns (ADR-0003) are used appropriately in web components
  • Desktop components properly extend the base PremiumComponent class
  • Null coalescing and Math.max prevent negative storage values

No New Issues

The changes are clean and focused on the objective. No new concerns identified in the latest commits.

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.

I think there are a few missed, hard-coded locations remaining:

  • The Desktop premium.component template
    • It's unclear to me if this component is still going to be in use after Kyle's work on PM-23713. I would ask @kdenney about it.
  • The cloud-hosted-premium.component template
  • The organization-plans.component template

const additionalStorageTotal = plan.PasswordManager?.hasAdditionalStorageOption
? plan.PasswordManager.additionalStoragePricePerGb *
(sub?.maxStorageGb ? sub.maxStorageGb - 1 : 0)
(sub.maxStorageGb - plan.PasswordManager.baseStorageGb)
Copy link
Contributor

Choose a reason for hiding this comment

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

If sub.maxStorageGb is null, doing null - number will result in NaN. Can we check for null

const discountPercentage = 20;
const acceptingSponsorship = false;
const storageGb = sub?.maxStorageGb ? sub?.maxStorageGb - 1 : 0;
const storageGb = sub.maxStorageGb - plan.PasswordManager.baseStorageGb;
Copy link
Contributor

Choose a reason for hiding this comment

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

If sub.maxStorageGb is null, doing null - number will result in NaN. Can we check for null

@sbrown-livefront
Copy link
Collaborator Author

sbrown-livefront commented Nov 19, 2025

I think there are a few missed, hard-coded locations remaining:

* The Desktop `premium.component` [template](https://github.com/bitwarden/clients/blob/main/apps/desktop/src/billing/app/accounts/premium.component.html#L16)
  
  * It's unclear to me if this component is still going to be in use after Kyle's work on [PM-23713](https://bitwarden.atlassian.net/browse/PM-23713). I would ask @kdenney   about it.

* The `cloud-hosted-premium.component` [template](https://github.com/bitwarden/clients/blob/main/apps/web/src/app/billing/individual/premium/cloud-hosted-premium.component.html#L83-L86)

* The `organization-plans.component` [template](https://github.com/bitwarden/clients/blob/main/apps/web/src/app/billing/organizations/organization-plans.component.html#L239-L245)

Gah, I tried a few combinations with search and still missed these. I'll update these.

@sbrown-livefront sbrown-livefront marked this pull request as draft November 20, 2025 00:52
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