Skip to content

feat: pay-as-you-go billing (usage page + retention UI) - #4913

Merged
grutt merged 38 commits into
mainfrom
feat/pay-as-you-go-billing
Sep 25, 2026
Merged

grutt merged 38 commits into
mainfrom
feat/pay-as-you-go-billing

Conversation

@grutt

@grutt grutt commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Exposes tenant dataRetentionPeriod and gates events, logs, and runs history with a retention upgrade modal / expired-run state instead of a silent empty table.
  • Adds an Invoices section to the organization Billing & Usage page (upcoming preview dialog, previous invoices via Autumn hosted URLs). Invoice loading is isolated so a failure does not break plan management.
  • Combines the improved billing/usage UI with the enforce-retention dashboard work on a single feat/pay-as-you-go-billing branch.

Supersedes #4812. Depends on the control-plane companion: https://github.com/hatchet-dev/hatchet-control-plane/pull/134

Test plan

  • Retention period is present on tenant memberships after the control-plane deploy
  • Time pickers past retention open the upgrade modal (events, logs, runs)
  • Expired run detail shows the expired-run empty state
  • Billing & Usage page shows previous invoices for the seeded sdks org
  • Upcoming invoice dialog on an org with a live paid Stripe subscription
  • Previous invoice row opens the hosted invoice in a new tab
  • Invoice query error leaves subscription UI usable

Write plan retention onto the tenant via UpdateTenant, expose
dataRetentionPeriod on the API, and show a billing upgrade banner
when the UI looks past the window. The API is not restricted.
Replace the post-query RetentionBanner with picker-native limits so out-of-bound ranges never apply.
Add upcoming and previous invoice history above plan history, using Autumn-hosted invoice links for past charges.
@vercel

vercel Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hatchet-docs Ready Ready Preview Sep 24, 2026 5:32pm UTC

Request Review

@github-actions github-actions Bot added engine Related to the core Hatchet engine dashboard Related to the Hatchet dashboard labels Sep 7, 2026
@greptile-apps

greptile-apps Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because the previously reported duration-parser defect still allows backend-valid retention values to bypass the new retention UI.

Summary

The PR exposes tenant retention periods, adds retention-aware dashboard states, and expands organization billing with usage and invoice views.

  • Adds backend retention metadata and analytics for requests outside retention windows.
  • Adds frontend retention gates, expired-run states, and time-window handling.
  • Adds billing usage, upcoming-invoice, and previous-invoice interfaces.

Reviews (3) · Last reviewed commit: "fix import"

Comment on lines +6 to +8
const re = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/;
const match = period.trim().match(re);

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.

P2 Go duration parser is incomplete

If a tenant uses a backend-valid Go duration such as 1.5h or 500ms, parseGoDuration returns null, so the new UI retention checks fail open and omit the retention dialog and expired-run state. Either parse the full backend-supported grammar or constrain accepted values consistently.

grutt added 10 commits September 7, 2026 15:18
Hide legacy plans from the selector, drop annual billing, and send welcome-modal upgrades to the new Pay as you Go plan.
Rebuild billing around Autumn balances and sparkline detail, and list the upcoming invoice as the first row of one invoices table.
…r, and retention limits

Lead with the value of upgrading, send Upgrade straight to Stripe checkout, and keep Details as a secondary view of plan contents.
…te modal

Color meters at 75% and 95%, sort by current usage, and open the Pay as you Go pitch instead of jumping straight to Stripe or a second details screen.
…retention

ToTask and ToTaskSummary left the required top-level createdAt at Go's zero
time, which serialized as 0001-01-01 and made the run page treat every
standalone task run as retention-expired. Also guard isBeforeRetention
against invalid or pre-epoch timestamps.
…iance page

Rework the welcome modal around Pay as you Go, make SSO/audit/Prometheus
gates consistent, spell out Single Sign On, and add a cloud-only compliance
settings page with inactivity timeout and Trust Center links.
The Limit reached menu only knew about tenant engine caps, so org features like users never appeared. Surface those usage rows and persist dismissals in localStorage so they stay hidden after refresh.
Legacy subscriptions can no longer upgrade to Pay as you Go from the billing page; they get a Talk to sales CTA instead.
The new pricing language should match across welcome, upgrade gates,
and enterprise unlocks, and compliance settings should live on one page.
grutt and others added 4 commits September 22, 2026 11:42
Render the gate on the SetupCard dialog surface used by the onboarding,
welcome, and invoice dialogs, with small footer buttons. Titles are in
active voice and descriptions point at the upgrade instead of repeating
numbers. Below the header, two labelled tables compare Free with Pay as you
Go: metered usage (included per month, then overage priced from the plan
API) and plan limits. The table opens collapsed to the single gated row,
highlighted, with a "See full breakdown" toggle.

Pass the gated feature id from the usage meters so the usage gate can name
the resource. Give SetupCard dialogs a solid backing; the card's own fill is
translucent and page text bled through.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The chart row was declared as { date: string } & Record<string, number>,
which no object literal can satisfy because date collides with the numeric
index signature. Widen the index signature to string | number via a shared
TenantChartPoint type.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 22, 2026
@github-actions github-actions Bot added sdk-ts Related to the Typescript SDK sdk-py Related to the Python sdk sdk-ruby Related to the Ruby SDK labels Sep 22, 2026

@abelanger5 abelanger5 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.

approving to unblock

Comment thread api/v1/server/handlers/v1/events/get.go Resolved
@grutt
grutt merged commit 233d03d into main Sep 25, 2026
65 checks passed
@grutt
grutt deleted the feat/pay-as-you-go-billing branch September 25, 2026 13:45

This branch was successfully deployed

1 active deployment
Preview — 4046c581 Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dashboard Related to the Hatchet dashboard documentation Improvements or additions to documentation engine Related to the core Hatchet engine sdk-py Related to the Python sdk sdk-ruby Related to the Ruby SDK sdk-ts Related to the Typescript SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants