Skip to content

fix(billing): use addon name from API instead of hardcoded label map#3059

Merged
lohanidamodar merged 1 commit into
mainfrom
fix-CLO-4381-addon-name
May 25, 2026
Merged

fix(billing): use addon name from API instead of hardcoded label map#3059
lohanidamodar merged 1 commit into
mainfrom
fix-CLO-4381-addon-name

Conversation

@lohanidamodar
Copy link
Copy Markdown
Member

Summary

The plan summary table on the billing page used a hardcoded addon_<key> → label map to render addon line items, with a fallback that labelled every unknown addon as an "overage" — e.g. addon_baa overage (1) for any addon not in the map, which was both wrong terminology (addons are not overages) and missing the friendly name.

Switch to reading addon.name from the API response. The aggregation endpoint now populates this field from the cloud's addon catalog, so the console no longer needs to maintain a parallel name registry.

The hardcoded map is kept as a fallback for older cloud builds during the rollout window; a plain resourceId is the final fallback in place of the misleading overage (N) string.

Related cloud change

The companion cloud change populates name, rate, desc on each addon_* entry in the aggregation resources map. This console PR should ship after that cloud change reaches production; before then, the fallback map keeps the existing addons rendering correctly.

Test plan

  • BAA addon still labelled "HIPAA BAA" on the billing summary (regression — via fallback before cloud rollout, via API afterwards)
  • Any new addon (e.g. backup_recovery) renders its catalog name instead of addon_<key> overage (N)
  • Unknown addon without a name renders the raw resourceId (no "overage")

🤖 Generated with Claude Code

The plan summary table used a hardcoded `addon_<key> -> label` lookup
to render addon line items, with a fallback that called every unknown
addon an "overage". Switch to reading `addon.name` from the API
response, which the aggregation endpoint now populates from the addon
catalog.

The hardcoded map stays as a fallback for older cloud builds that
don't yet send `addon.name`, and a plain resourceId is the final
fallback in place of the misleading "overage (N)" string.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 24, 2026

Greptile Summary

This PR fixes the billing plan summary to display addon names from the API response (addon.name) instead of relying solely on a hardcoded resourceId → label map that produced misleading overage (N) strings for unrecognised addons.

  • The name resolution priority is now: addon.name (API) → billingAddonNamesFallback[resourceId] (hardcoded map, kept for older cloud builds during rollout) → raw resourceId (final fallback). This is correct and safe at every stage of the cloud rollout.
  • The old variable billingAddonNames is renamed to billingAddonNamesFallback with an explanatory comment noting it can be removed after the companion cloud change reaches production.

Confidence Score: 5/5

Safe to merge — the change is a single-file, three-line label-resolution update with a well-structured fallback chain that preserves existing behaviour before the cloud rollout lands.

The fallback chain (addon.name → hardcoded map → raw resourceId) is correct at every rollout stage: before the cloud change ships, addon.name is absent so the hardcoded map keeps HIPAA BAA rendering correctly; after it ships, the API name takes over. The switch from ?? to || is appropriate since an empty-string name from the API should fall through rather than render a blank label. No logic outside the label ternary is touched, and planSummaryOld.svelte does not have a parallel addon-naming path that would need the same fix.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/organization-[organization]/billing/planSummary.svelte Adds addon.name as primary label source for addon line items, with the existing hardcoded map kept as a fallback and addon.resourceId as a final fallback instead of the old misleading overage string.

Reviews (1): Last reviewed commit: "fix(billing): use addon name from API in..." | Re-trigger Greptile

@lohanidamodar lohanidamodar merged commit 94b2648 into main May 25, 2026
4 checks passed
@lohanidamodar lohanidamodar deleted the fix-CLO-4381-addon-name branch May 25, 2026 03:21
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