-
Notifications
You must be signed in to change notification settings - Fork 283
Billing changes #2643
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
base: main
Are you sure you want to change the base?
Billing changes #2643
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes the legacy WORKFLOW_RUN usage meter and type from the billing system and updates the billing UI/API to use a new billing provider (transitioning from Lago to Autumn).
Key Changes:
- Removed
WORKFLOW_RUNlimit resource from backend and frontend enums, models, and validation logic - Updated billing data contracts to use camelCase naming and new subscription structure with
currentSubscriptionandupcomingSubscription - Removed payment methods UI components and logic in favor of direct billing portal management
- Added
onSuccessMeterCbcallback functionality to tenant limit repository
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| sql/schema/v0.sql | Removed WORKFLOW_RUN from LimitResource enum |
| cmd/hatchet-migrate/migrate/migrations/20251210215122_v1_0_56.sql | Migration to remove WORKFLOW_RUN with proper rollback |
| pkg/repository/v1/trigger.go | Removed WORKFLOW_RUN metering from workflow trigger logic |
| pkg/repository/v1/sqlcv1/models.go | Removed LimitResourceWORKFLOWRUN constant |
| pkg/repository/postgres/workflow_run.go | Removed metered wrapper from workflow run creation |
| pkg/repository/postgres/tenant_limit.go | Removed WORKFLOW_RUN default limits, added meter callback |
| pkg/repository/postgres/dbsqlc/models.go | Removed LimitResourceWORKFLOWRUN constant |
| pkg/config/server/server.go | Removed workflow run limit configuration fields |
| internal/services/admin/v1/server.go | Removed WORKFLOW_RUN limit check from trigger endpoint |
| internal/services/admin/server_v1.go | Removed WORKFLOW_RUN limit check from v1 trigger endpoint |
| frontend data-contracts.ts | Updated billing types to camelCase and new subscription structure |
| frontend Api.ts | Updated API client for Autumn webhooks and subscription response types |
| frontend subscription.tsx (v1) | Redesigned subscription UI without payment methods, added upcoming subscription display |
| frontend subscription.tsx (legacy) | Updated to use camelCase field names |
| frontend resource-limits/index.tsx (v1) | Removed payment methods display and related logic |
| frontend resource-limits/index.tsx (legacy) | Updated subscription field references |
| frontend billing/index.ts | Removed PaymentMethods export |
| frontend payment-methods.tsx | Deleted entire payment methods component |
| api-contracts tenant.yaml | Removed WORKFLOW_RUN from TenantResource enum |
Comments suppressed due to low confidence (1)
frontend/app/src/components/cloud/billing/subscription.tsx:90
- Inconsistent handling of the subscription update response. In the v1 component (lines 79-84 of subscription.tsx), the response is checked for a checkout URL and redirected accordingly. However, this older version doesn't handle the
UpdateTenantSubscriptionResponseunion type properly - it doesn't check if the response contains a checkout URL. This could lead to missing redirects to external checkout pages. Consider updating this file to match the handling in the v1 version.
const subscriptionMutation = useMutation({
mutationKey: ['user:update:logout'],
mutationFn: async ({ plan_code }: { plan_code: string }) => {
const [plan, period] = plan_code.split('_');
setLoading(plan_code);
await cloudApi.subscriptionUpsert(tenant.metadata.id, { plan, period });
},
onSuccess: async () => {
await Promise.all([
queryClient.invalidateQueries({
queryKey: queries.tenantResourcePolicy.get(tenant.metadata.id)
.queryKey,
}),
queryClient.invalidateQueries({
queryKey: queries.cloud.billing(tenant.metadata.id).queryKey,
}),
]);
setLoading(undefined);
},
onError: handleApiError,
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
frontend/app/src/pages/main/tenant-settings/resource-limits/index.tsx
Outdated
Show resolved
Hide resolved
|
|
||
| const subscriptionMutation = useMutation({ | ||
| mutationKey: ['user:update:logout'], | ||
| mutationFn: async ({ plan_code }: { plan_code: string }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to make these plan codes an enum so we can pattern match? not sure what they look like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am waiting on doing this since I am torn between making Autumn the source of truth and finalizing those plans. But going to do so for sure.
frontend/app/src/pages/main/tenant-settings/resource-limits/index.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
mrkaye97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple small comments but otherwise lgtm - I think we need to address Gabe's question re: breaking change though
Description
Make UI and backend changes for new billing on cloud. Also, gets rid of the legacy
WORKFLOW_RUNusage meter and type.Type of change