Skip to content

Conversation

kdenney
Copy link
Contributor

@kdenney kdenney commented Oct 6, 2025

🎟️ Tracking

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

📔 Objective

This work was a refactor, so no functional or visual changes should be present. Note: these changes are only applied with the feature flag pm-25379-use-new-organization-metadata-structure

Here’s a list of changes made for this issue.

  1. All properties that were not being used anywhere in clients were removed from the models.
  2. The cloud-hosted organization subscription page:
    1. This page used to look at the organization metadata (provided by the server API) to determine if it should show the self hosting section. The property checked was isEligibleForSelfHost. This was updated to instead simply check that the org’s plan tier is either families or enterprise and the matching property was removed from the metadata models. (This is equivalent to the logic used by the server API before, but does not require any additional data to be fetched.)
    2. This page also used isManaged in org metadata to switch between two variations of UI for the “manage subscription” section. This was updated to instead use hasBillableProvider which the client already has access to on the org object and the property was removed from the metadata models. The UI switches:
      1. When the org is managed by a consolidated billing MSP.
      2. When the org is not managed by a consolidated billing MSP.
  3. The organization members page uses organization metadata fetched from the API in the following cases:
    1. isOnSecretsManagerStandalone is used to force the secrets manager access checkbox when inviting a new member or editing an existing member.
    2. occupiedSeatCount is used in the following cases:
      1. to restrict inviting additional members if the seat limit is reached
      2. to show the remaining seats on the invite dialog
  4. The member access report uses metadata simply to pass it along to the edit member dialog for the same usage as above when editing an existing member.

This PR is of course the server-side changes. It includes the new feature flag, removing of unused properties, refactoring the GetMetadata function into a new query class, and a new vnext endpoint to use that query.

⏰ 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

@kdenney kdenney changed the title Billing/pm 25379/clean up org metadata usage [PM-25379] Refactor org metadata Oct 6, 2025
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 76.66667% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.38%. Comparing base (e191ae9) to head (7d16f03).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
...ollers/VNext/OrganizationBillingVNextController.cs 0.00% 8 Missing ⚠️
...anizations/Queries/GetOrganizationMetadataQuery.cs 87.75% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6418      +/-   ##
==========================================
- Coverage   50.42%   50.38%   -0.05%     
==========================================
  Files        1853     1855       +2     
  Lines       82394    83141     +747     
  Branches     7265     7533     +268     
==========================================
+ Hits        41550    41893     +343     
- Misses      39260    39658     +398     
- Partials     1584     1590       +6     

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

Copy link
Contributor

github-actions bot commented Oct 6, 2025

Logo
Checkmarx One – Scan Summary & Details7b56d901-aca4-4b66-afb9-567178adf642

Fixed Issues (4)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Billing/Controllers/VNext/OrganizationBillingVNextController.cs: 106
MEDIUM CSRF /src/Api/Billing/Controllers/VNext/OrganizationBillingVNextController.cs: 94
MEDIUM CSRF /src/Api/Billing/Controllers/VNext/AccountBillingVNextController.cs: 60
MEDIUM CSRF /src/Api/Billing/Controllers/VNext/OrganizationBillingVNextController.cs: 48

@kdenney kdenney marked this pull request as ready for review October 6, 2025 19:42
@kdenney kdenney requested a review from a team as a code owner October 6, 2025 19:42
return TypedResults.NotFound();
}

var response = OrganizationMetadataResponse.From(metadata);
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ I'm fine with removing this layer of response models when they do nothing but copy the Core models if you want to. Your call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion; thanks! Especially now that it's only 2 properties, this class seems very superfluous now 😆 Removed in ddbf084

removing unneeded response model
@kdenney kdenney merged commit 3bef572 into main Oct 9, 2025
40 checks passed
@kdenney kdenney deleted the billing/pm-25379/clean-up-org-metadata-usage branch October 9, 2025 20:50
kdenney added a commit that referenced this pull request Oct 10, 2025
kdenney added a commit that referenced this pull request Oct 10, 2025
@kdenney kdenney restored the billing/pm-25379/clean-up-org-metadata-usage branch October 10, 2025 14:07
aliwahhan added a commit to aliwahhan/server that referenced this pull request Oct 12, 2025
* ignore serena

* removing unused properties from org metadata

* removing further properties that can already be fetched on the client side using available data

* new vnext endpoint for org metadata plus caching metadata first pass

including new feature flag

# Conflicts:
#    src/Core/Constants.cs

* [PM-25379] decided against cache and new query shouldn't use the service

* pr feedback

removing unneeded response model

* run dotnet format
aliwahhan added a commit to aliwahhan/server that referenced this pull request Oct 12, 2025
@kdenney kdenney deleted the billing/pm-25379/clean-up-org-metadata-usage branch October 13, 2025 15:49
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.

2 participants