Skip to content

ref: Support billing platform defined line items - #124997

Open
noahsmartin wants to merge 1 commit into
masterfrom
uncappedPlatformLineItems
Open

noahsmartin wants to merge 1 commit into
masterfrom
uncappedPlatformLineItems

Conversation

@noahsmartin

Copy link
Copy Markdown
Contributor

Billing platform line items don't have a public "DataCategory" instead they use the line item uid and display name in API responses. PR has a few changes to support them on the frontend:

1 - allow categoryDisplayNames to be keyed by a string instead of just DataCategory. A string uid is used for platform line items
2 - pass an explicit isDisabled field from the backend for the lock/unlocked status of this line item on the subscription page
3 - support line items that don't have planCategories for their reserved amounts

@noahsmartin
noahsmartin requested a review from a team as a code owner September 19, 2026 00:35
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Sep 19, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread static/gsApp/utils/billing.tsx

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c3e0de7. Configure here.

)
: (metricHistory?.prepaid ?? 0) !== 0 ||
: metricHistory?.isDisabled === false ||
(metricHistory?.prepaid ?? 0) !== 0 ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Disabled flag ignored in product selection

Medium Severity

isDisabled === false is ORed with the legacy prepaid, soft-cap, trial, and PAYG checks, so isDisabled: true never blocks URL selection. productIsEnabled treats a defined isDisabled as exclusive, so a locked platform line item can still be selected from the query string when a shared PAYG budget exists.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c3e0de7. Configure here.

Comment on lines +68 to 72
: metricHistory?.isDisabled === false ||
(metricHistory?.prepaid ?? 0) !== 0 ||
!!metricHistory?.softCapType ||
!!getActiveProductTrial(subscription.productTrials ?? null, dataCategory) ||
(subscription.onDemandBudgets?.budgetMode === OnDemandBudgetMode.SHARED

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The productIsEnabled function short-circuits on isDisabled, while the isSelectable logic in the usage overview does not. This can lead to inconsistent UI states for disabled products.
Severity: LOW

Suggested Fix

Align the logic in both locations. The isSelectable logic in static/gsApp/views/subscriptionPage/usageOverview/index.tsx should be updated to prioritize the isDisabled flag, similar to how productIsEnabled works. If metricHistory.isDisabled is defined, its value should be the sole determinant, and the other checks for prepaid or softCapType should be skipped.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/gsApp/views/subscriptionPage/usageOverview/index.tsx#L68-L72

Potential issue: There is a logical inconsistency in how a product's disabled status is
determined. The `productIsEnabled` utility function will immediately return `false` if
`metricHistory.isDisabled` is `true`. However, the `isSelectable` logic in the usage
overview component checks `isDisabled === false` but then continues to evaluate other
conditions like `prepaid` and `softCapType`. If the backend ever sends a product with
`isDisabled: true` but also a non-zero `prepaid` value, the product will appear disabled
in some parts of the UI but remain selectable in the usage overview, creating an
inconsistent user experience.

Also affects:

  • static/gsApp/utils/billing.tsx:947~949

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant