Skip to content

fix(seer): don't skip pre-backfill #93204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions static/gsApp/views/amCheckout/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,40 @@ describe('AM2 Checkout', function () {
expect(screen.getByTestId('errors-volume-item')).toBeInTheDocument();
});

it('does not skip step 1 for business plan pre-backfill', async function () {
const launchOrg = OrganizationFixture({features: ['seer-billing']});
const am2BizSubscription = SubscriptionFixture({
organization: launchOrg,
plan: 'am2_business',
planTier: 'am2',
categories: {
errors: MetricHistoryFixture({reserved: 100_000}),
transactions: MetricHistoryFixture({reserved: 20_000_000}),
attachments: MetricHistoryFixture({reserved: 1}),
monitorSeats: MetricHistoryFixture({reserved: 1}),
profileDuration: MetricHistoryFixture({reserved: 1}),
replays: MetricHistoryFixture({reserved: 10_000}),
},
onDemandMaxSpend: 2000,
});

SubscriptionStore.set(launchOrg.slug, am2BizSubscription);

render(
<AMCheckout
{...RouteComponentPropsFixture()}
params={params}
api={api}
onToggleLegacy={jest.fn()}
checkoutTier={PlanTier.AM2}
/>,
{organization: launchOrg}
);
await screen.findByText('Choose Your Plan');
expect(screen.getByTestId('body-choose-your-plan')).toBeInTheDocument();
expect(screen.queryByTestId('errors-volume-item')).not.toBeInTheDocument();
});

it('skips step 1 for business plan with seer', async function () {
const seerOrg = OrganizationFixture({features: ['seer-billing']});
const seerSubscription = SubscriptionWithSeerFixture({
Expand Down
27 changes: 17 additions & 10 deletions static/gsApp/views/amCheckout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,23 @@ class AMCheckout extends Component<Props, State> {
isBizPlanFamily(props.subscription.planDetails) &&
props.checkoutTier === props.subscription.planTier
) {
const selectedAll = props.subscription.reservedBudgets?.every(budget => {
if (
Object.values(SelectableProduct).includes(
budget.apiName as string as SelectableProduct
)
) {
return budget.reservedBudget > 0;
}
return !props.organization.features.includes(budget.billingFlag || '');
});
// TODO(billing): cleanup condition after backfill
const selectedAll = props.organization.features.includes('seer-billing')
? props.subscription.reservedBudgets &&
props.subscription.reservedBudgets.length > 0
? props.subscription.reservedBudgets.every(budget => {
if (
Object.values(SelectableProduct).includes(
budget.apiName as string as SelectableProduct
)
) {
return budget.reservedBudget > 0;
}
return !props.organization.features.includes(budget.billingFlag || '');
})
: false // don't skip before backfill
: true; // skip if seer hasn't launched

if (selectedAll) {
step = 2;
}
Expand Down
Loading