Skip to content

Conversation

@mnafees
Copy link
Contributor

@mnafees mnafees commented Dec 11, 2025

Description

Make UI and backend changes for new billing on cloud. Also, gets rid of the legacy WORKFLOW_RUN usage meter and type.

Type of change

  • Refactor (non-breaking changes to code which doesn't change any behaviour)

@mnafees mnafees self-assigned this Dec 11, 2025
@vercel
Copy link

vercel bot commented Dec 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
hatchet-docs Ready Ready Preview, Comment Dec 18, 2025 7:14pm
hatchet-v0-docs Ready Ready Preview, Comment Dec 18, 2025 7:14pm

Copy link
Contributor

Copilot AI left a 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_RUN limit resource from backend and frontend enums, models, and validation logic
  • Updated billing data contracts to use camelCase naming and new subscription structure with currentSubscription and upcomingSubscription
  • Removed payment methods UI components and logic in favor of direct billing portal management
  • Added onSuccessMeterCb callback 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 UpdateTenantSubscriptionResponse union 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.


const subscriptionMutation = useMutation({
mutationKey: ['user:update:logout'],
mutationFn: async ({ plan_code }: { plan_code: string }) => {
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

@mrkaye97 mrkaye97 left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants