Skip to content

fix(rpc): remove hosted billing requirements from self-hosting - #816

Merged
izadoesdev merged 6 commits into
stagingfrom
codex/selfhost-local-features
Sep 17, 2026
Merged

izadoesdev merged 6 commits into
stagingfrom
codex/selfhost-local-features

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 16, 2026

Copy link
Copy Markdown
Member

With SELFHOST=true, local analytics features and configured AI run without an Autumn account. Goals, funnels, flags, error analytics, and investigations retain their authorization checks while skipping hosted subscription limits. AI still requires the operator's provider key.

The dashboard hides billing and upgrade prompts, disables its internal rollout flags, and shows an AI setup message when needed. Server billing calls, feedback credit redemption, Autumn webhooks, and webhook replay are disabled even when copied provider keys are present. Existing hosted billing paths remain enabled outside self-host mode.

Validation

  • API, RPC, AI, investigation, and dashboard boundary tests cover both self-host behavior and hosted billing enforcement.
  • Repository lint, all 33 typecheck tasks, and all 27 root test tasks pass.
  • Combined runtime verification covers signup, login, website creation, event ingestion, analytics display, more than five goals, feature flags, error analytics, and rejection of an unrelated website. No Autumn account is configured.
  • The production dashboard build and browser checks pass with copied synthetic billing keys: no hosted billing, rollout-flag, telemetry, or feedback-credit requests; billing pages redirect. The API starts with a malformed synthetic webhook key and both Autumn endpoints return 404.
  • Disposable test services and synthetic database volumes were removed.

Dependencies and overlaps

Based directly on staging. Depends on #806 for forwarding SELFHOST through Turbo; #804 supplies the self-host dashboard build setting and Compose setup. #814 and #815 complete the Redis and Kafka reductions; #808 documents the combined setup.

Overlaps #790 in packages/rpc/src/orpc.ts: the explicit self-host guard must remain before the hosted billing lookup. #806 adds an adjacent CI test step; retain both steps. #814 adds the same AI workspace dependency, which should appear once in the merged manifest and lockfile.

AI-assisted implementation and verification with Codex. Draft for maintainer review; no production deployment performed.


Summary by cubic

With SELFHOST=true, self-hosted instances no longer require an Autumn account for analytics or provider-backed features. Hosted billing calls are disabled even when stale billing keys are present; hosted behavior remains unchanged otherwise.

  • Dashboard hides billing, upgrade prompts, event limits, telemetry, credit balances, and billing-based investigation actions; billing routes redirect.
  • Goals, funnels, flags, error analytics, and investigations keep authorization checks while skipping plan, subscription, and usage limits.
  • Provider-backed actions require the configured provider key; missing setup shows an administrator message and stops replies, retries, applied actions, and generation before writes or queueing.
  • Self-hosted API billing routes and Autumn webhooks return 404, while webhook replay, balance writes, credit redemption, and investigation billing are skipped.

Written for commit c367789. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
dashboard Ready Ready Preview Sep 17, 2026 7:43am UTC
databuddy-status Ready Ready Preview Sep 17, 2026 7:43am UTC
1 Skipped Deployment
Project Deployment Actions Updated
documentation Skipped Skipped Sep 17, 2026 7:43am UTC

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: eaff1af2-b647-4936-9874-b6cb8a9c64a6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@unkey-deploy

unkey-deploy Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
links (preview) Ready Visit Preview Inspect Sep 17, 2026 7:42am

@blacksmith-sh

This comment has been minimized.

@izadoesdev
izadoesdev marked this pull request as ready for review September 17, 2026 06:53
@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with all previous findings resolved and no new actionable issues introduced since the previous review.

Summary

This PR separates self-hosted deployments from hosted billing while preserving authorization boundaries and AI provider requirements.

  • Skips Autumn billing, subscription limits, webhook processing, replay, and credit redemption when self-hosting is enabled.
  • Keeps workspace permissions and resource authorization checks active while allowing local analytics features without hosted plans.
  • Exposes AI availability from operator configuration and removes billing, upgrade, telemetry, and rollout-flag UI from the self-hosted dashboard.
  • Adds boundary coverage for self-hosted and hosted behavior across the API, RPC, AI, investigations, and dashboard.
  • The changes since the previous review replace the reported nested ternary with explicit branching and add text-pretty to all three affected paragraphs without changing behavior.

Reviews (6) · Last reviewed commit: "refactor(dashboard): clarify self-hosted..."

Comment thread packages/rpc/src/routers/insights.ts Outdated
Comment thread apps/api/src/routes/webhooks/autumn.test.ts Outdated
Comment thread apps/api/src/routes/webhooks/autumn.test.ts Outdated
@izadoesdev

Copy link
Copy Markdown
Member Author

@greptileai review this

@izadoesdev

Copy link
Copy Markdown
Member Author

@greptileai review this. The current-head summary still says repository-rule violations remain, but no new finding is attached and all three original threads are fixed: shared AI preflight covers retries/actions before writes, the webhook handler has its actual result type, and env cleanup uses Reflect.deleteProperty. The credential cases use test.each. Please identify any remaining current-head file/line or update the summary; final head is 6e37075.

Comment thread packages/rpc/src/utils/autumn-balance.test.ts Outdated
Comment thread apps/dashboard/components/providers/selfhost-billing.test.tsx Outdated
@izadoesdev

Copy link
Copy Markdown
Member Author

@greptileai review this. Both new current-head findings are fixed in bbf93ed: the balance test reuses its existing failure predicate, and all delete operators introduced by this PR use Reflect.deleteProperty. Please review the final head.

@izadoesdev

Copy link
Copy Markdown
Member Author

@greptileai review this. Final head 4d50018 rebases onto staging and preserves its new dashboard test coverage with --isolate, fixing cached hosted environment state across test files. The failure reproduced as 153 passing and 2 failing tests before isolation; all 155 now pass. All 33 type tasks, 22 policy checks, and 29 pre-push tasks pass. Previous review fixes are retained.

Comment thread apps/dashboard/app/(main)/insights/page.tsx Outdated
Comment thread apps/dashboard/app/(main)/insights/page.tsx Outdated
@izadoesdev

Copy link
Copy Markdown
Member Author

@greptileai review this. Final head c367789 fixes both UI style findings. An AST audit of all added TS/TSX lines also covered nested ternaries, paragraph text-pretty, prohibited types/delete, and await inside loops; the additional detail-page paragraph was fixed. Behavior is unchanged. All 155 dashboard tests, lint, 33 type tasks, and 29 pre-push tasks pass.

@izadoesdev
izadoesdev merged commit d0070b5 into staging Sep 17, 2026
22 checks passed
@izadoesdev
izadoesdev deleted the codex/selfhost-local-features branch September 17, 2026 07:48
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.

1 participant