ref: Support billing platform defined line items - #124997
noahsmartin wants to merge 1 commit into
Conversation
f624234 to
c3e0de7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 || |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit c3e0de7. Configure here.
| : metricHistory?.isDisabled === false || | ||
| (metricHistory?.prepaid ?? 0) !== 0 || | ||
| !!metricHistory?.softCapType || | ||
| !!getActiveProductTrial(subscription.productTrials ?? null, dataCategory) || | ||
| (subscription.onDemandBudgets?.budgetMode === OnDemandBudgetMode.SHARED |
There was a problem hiding this comment.
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.


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
planCategoriesfor their reserved amounts