ref: Replace hardcoded trial plans with API field#117895
Conversation
| // provisioned. | ||
| hasPerformance(plan) && | ||
| plan.contractInterval === MONTHLY && | ||
| !isTrialPlan(plan.id) && |
There was a problem hiding this comment.
This use case is no longer needed since the backend was updated to not include trial plans in this list at all
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 8c1b31e. Configure here.
| // provisioned. | ||
| hasPerformance(plan) && | ||
| plan.contractInterval === MONTHLY && | ||
| !isTrialPlan(plan.id) && |
There was a problem hiding this comment.
Trial enterprise plans provisionable
Medium Severity
Removing the trial-plan exclusion from the provisionable enterprise plan filter leaves monthly enterprise trial SKUs (for example am3_t_ent) eligible in the admin Plan dropdown when they still have isTestPlan: false, which the old isTrialPlan(plan.id) guard blocked.
Reviewed by Cursor Bugbot for commit 8c1b31e. Configure here.
| onDemandPeriodEnd: string; | ||
| onDemandPeriodStart: string; | ||
| onDemandSpendUsed: number; | ||
| onTrialPlan: boolean; |
There was a problem hiding this comment.
Bug: The new required field onTrialPlan is likely missing from the backend API response. This will cause subscription.onTrialPlan to be undefined, leading to incorrect behavior for trial users.
Severity: CRITICAL
Suggested Fix
Ensure the backend API endpoint /customers/{orgSlug}/ serializes and returns the on_trial_plan boolean field. Alternatively, make the onTrialPlan field optional in the TypeScript type and add defensive checks in the frontend code to handle cases where the field is undefined, providing a default value or fallback logic.
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/types/index.tsx#L386
Potential issue: The `onTrialPlan` field was added as a required boolean to the
`Subscription` type. This field is expected to be populated by the
`/customers/{orgSlug}/` API endpoint. However, the backend does not appear to return
this field. Consequently, `subscription.onTrialPlan` will be `undefined` at runtime.
Since `undefined` is falsy, logic relying on this field will incorrectly treat trial
plan users as if they are not on a trial. This affects critical flows such as checkout,
add-on prepopulation, UI badges, and analytics tracking, leading to a broken experience
for trial users.
Also affects:
static/gsApp/views/amCheckout/index.tsx:373~379static/gsApp/views/amCheckout/index.tsx:413~419static/gsApp/views/amCheckout/steps/buildYourPlan.tsx:65~71static/gsApp/components/upsellModal/details.tsx:250~256static/gsApp/utils/billing.tsx:415~421static/gsApp/views/amCheckout/utils.tsx:388~394static/gsApp/views/amCheckout/utils.tsx:645~651
Did we get this right? 👍 / 👎 to inform future reviews.


We don't want to have frontend logic that makes assumption about the plan.id format. Moving the trial plan logic to be based on a new backend provided boolean instead