Skip to content

ref: Replace hardcoded trial plans with API field#117895

Open
noahsmartin wants to merge 1 commit into
masterfrom
moveTrialPlan
Open

ref: Replace hardcoded trial plans with API field#117895
noahsmartin wants to merge 1 commit into
masterfrom
moveTrialPlan

Conversation

@noahsmartin

Copy link
Copy Markdown
Contributor

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

@noahsmartin noahsmartin requested a review from a team as a code owner June 17, 2026 05:24
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 17, 2026
// provisioned.
hasPerformance(plan) &&
plan.contractInterval === MONTHLY &&
!isTrialPlan(plan.id) &&

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This use case is no longer needed since the backend was updated to not include trial plans in this list at all

@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 8c1b31e. Configure here.

// provisioned.
hasPerformance(plan) &&
plan.contractInterval === MONTHLY &&
!isTrialPlan(plan.id) &&

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.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8c1b31e. Configure here.

onDemandPeriodEnd: string;
onDemandPeriodStart: string;
onDemandSpendUsed: number;
onTrialPlan: boolean;

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 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~379
  • static/gsApp/views/amCheckout/index.tsx:413~419
  • static/gsApp/views/amCheckout/steps/buildYourPlan.tsx:65~71
  • static/gsApp/components/upsellModal/details.tsx:250~256
  • static/gsApp/utils/billing.tsx:415~421
  • static/gsApp/views/amCheckout/utils.tsx:388~394
  • static/gsApp/views/amCheckout/utils.tsx:645~651

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