Skip to content

Commit ac87dcd

Browse files
fix(webapp): use EntitlementResult for production entitlement validation
Replace the invalid @trigger.dev/platform/v3 import so billing limit typecheck passes in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent cb90d64 commit ac87dcd

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

apps/webapp/app/components/billing/billingAlertsFormat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type BillingLimitMode = "plan" | "custom" | "none";
1818

1919
export function getBillingLimitMode(billingLimit: BillingLimitResult): BillingLimitMode {
2020
if (!billingLimit.isConfigured) {
21-
return "plan";
21+
return "none";
2222
}
2323
return billingLimit.mode;
2424
}

apps/webapp/app/runEngine/validators/validateProductionEntitlement.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { ReportUsageResult } from "@trigger.dev/platform/v3";
1+
import type { EntitlementResult } from "~/services/billingLimit.schemas";
22
import { OutOfEntitlementError } from "~/v3/outOfEntitlementError.server";
33
import type { EntitlementValidationParams, EntitlementValidationResult } from "../types";
44

55
export type GetEntitlementFn = (
66
organizationId: string
7-
) => Promise<ReportUsageResult | undefined>;
7+
) => Promise<EntitlementResult | undefined>;
88

99
export async function validateProductionEntitlement(
1010
params: EntitlementValidationParams,

apps/webapp/test/billingAlertsFormat.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ describe("billingAlertsFormat", () => {
165165
expect(previewDollarAmountForPercent(10, 10_000)).toBe(10);
166166
});
167167

168-
it("defaults unconfigured billing limit to plan mode", () => {
169-
expect(getBillingLimitMode({ isConfigured: false, gracePeriodMs: 86_400_000 })).toBe("plan");
168+
it("defaults unconfigured billing limit to none mode", () => {
169+
expect(getBillingLimitMode({ isConfigured: false, gracePeriodMs: 86_400_000 })).toBe("none");
170170
});
171171

172172
it("detects configured alerts for the current billing limit mode", () => {

apps/webapp/test/billingLimitsRoute.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ describe("isBillingLimitFormDirty", () => {
261261
expect(
262262
isBillingLimitFormDirty({
263263
billingLimit: unconfiguredLimit,
264-
mode: "plan",
264+
mode: "none",
265265
customAmount: "",
266266
cancelInProgressRuns: false,
267267
})

0 commit comments

Comments
 (0)