Skip to content

chore(server): remove the billing plans boot loader flow - #1870

Open
rohilsurana wants to merge 4 commits into
mainfrom
chore/remove-billing-plans-boot-loader
Open

chore(server): remove the billing plans boot loader flow#1870
rohilsurana wants to merge 4 commits into
mainfrom
chore/remove-billing-plans-boot-loader

Conversation

@rohilsurana

@rohilsurana rohilsurana commented Aug 11, 2026

Copy link
Copy Markdown
Member

What

Removes the billing.plans_path boot loader end to end. Billing products, plans, prices, and features are managed through the reconcile flow now (the BillingProduct and BillingPlan kinds), so the server no longer reads a plans file at startup.

  • cmd/serve.go: drop the billing blob store and the MigrateBillingPlans call.
  • internal/bootstrap: drop the BillingPlanRepository and PlanService dependencies and the MigrateBillingPlans method.
  • billing/config.go: remove the plans_path field.
  • internal/store/blob/plan_repository.go: removed, no longer used.
  • config/sample.config.yaml: drop the sample entry.
  • test/e2e: the billing regression suite seeds the fixtures it needs (support_credits and enterprise_yearly) through the admin API in SetupSuite instead of the boot loader.

UpsertPlans and plan.File stay: the admin CreatePlan handler still uses them to create a plan with its products.

Why it is safe

Existing plans and products live in the database, so this is a no-op for a server that has already migrated. The reconcile flow (frontier reconcile with the BillingProduct / BillingPlan kinds) owns this state now.

Gating

This is the billing counterpart to #1767 (the resources_config boot loader removal). Same rule: a deployment must run the reconcile flow so plans and products are owned there, and drop plans_path from its own config, before taking this build.

One boot-time dependency to call out: if a deployment sets billing.customer.credit_overdraft_product (or billing.customer.default_plan), that product or plan must already exist in the database before the server starts. InvoiceService.Init resolves the overdraft product at boot and fails startup if it is missing, and EnsureDefaultPlan needs the default plan to exist. The boot loader used to seed these; now they must come from the reconcile flow or already be present. Deployments that already ran the loader in a past release have this data, so this is a no-op for them. A fresh install must seed the catalog through reconcile first.

Verification

go build ./..., go vet ./..., and unit tests for internal/bootstrap, billing/plan, core/event, and internal/api/v1beta1connect pass. gofmt and lint clean.

@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview Aug 11, 2026 10:04am

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e0060840-3cbb-49f3-a6dd-6fffd33772f3

📥 Commits

Reviewing files that changed from the base of the PR and between caa4a30 and 26001fb.

📒 Files selected for processing (3)
  • docs/content/docs/reference/billing-configurations.mdx
  • docs/content/docs/reference/configurations.mdx
  • test/e2e/testbench/testbench.go
💤 Files with no reviewable changes (2)
  • docs/content/docs/reference/configurations.mdx
  • docs/content/docs/reference/billing-configurations.mdx

📝 Walkthrough

Summary by CodeRabbit

  • Breaking Changes

    • Removed support for configuring billing plans with billing.plans_path and YAML plan files.
    • Billing plans are no longer loaded or migrated automatically during application startup.
  • Billing

    • Billing products, prices, and plans can be provisioned through the database and administrative APIs.
  • Testing

    • Billing test environments now seed products and prices before startup and create plans through the administrative API.
  • Documentation

    • Removed references to the retired billing plans configuration.

Walkthrough

Changes

The PR removes YAML/blob-based billing plan loading from startup. Testbench initialization gains pre-start database seeders, and billing E2E tests create required products and plans through database and admin APIs.

Billing plan loading removal

Layer / File(s) Summary
Remove startup plan loading
billing/config.go, config/sample.config.yaml, internal/bootstrap/service.go, cmd/serve.go, core/event/service_test.go, docs/content/docs/reference/*.mdx
Removes PlansPath, billing plan repository wiring, bootstrap interfaces, MigrateBillingPlans, and related documentation.
Add pre-start database seeders
test/e2e/testbench/testbench.go
Adds PreStartSeeder callbacks to testbench.Init and runs them after migrations and before Frontier starts.
Move billing E2E fixture setup
test/e2e/regression/billing_test.go, test/e2e/regression/testdata/plans/subscription.credits.yaml
Seeds support_credits in PostgreSQL before startup and creates enterprise_yearly through the admin API after startup. Removes the YAML fixture.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: whoabhisheksah

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@coveralls

coveralls commented Aug 11, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 31480556679

Coverage increased (+0.07%) to 48.17%

Details

  • Coverage increased (+0.07%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (0 of 1 lines covered, 0.0%).
  • 2 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
cmd/serve.go 1 0 0.0%

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
cmd/serve.go 2 0.0%

Coverage Stats

Coverage Status
Relevant Lines: 39859
Covered Lines: 19200
Line Coverage: 48.17%
Coverage Strength: 15.39 hits per line

💛 - Coveralls

@rohilsurana
rohilsurana marked this pull request as ready for review August 11, 2026 09:18

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 30aa3df8-3256-4193-b63e-a3f29da80747

📥 Commits

Reviewing files that changed from the base of the PR and between 8e22bcf and caa4a30.

📒 Files selected for processing (9)
  • billing/config.go
  • cmd/serve.go
  • config/sample.config.yaml
  • core/event/service_test.go
  • internal/bootstrap/service.go
  • internal/store/blob/plan_repository.go
  • test/e2e/regression/billing_test.go
  • test/e2e/regression/testdata/plans/subscription.credits.yaml
  • test/e2e/testbench/testbench.go
💤 Files with no reviewable changes (5)
  • config/sample.config.yaml
  • test/e2e/regression/testdata/plans/subscription.credits.yaml
  • internal/store/blob/plan_repository.go
  • internal/bootstrap/service.go
  • core/event/service_test.go

Comment thread test/e2e/testbench/testbench.go Outdated

@rohilsurana rohilsurana left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated code review (xhigh). Findings below, most important first. The first two look like real boot/runtime regressions worth confirming before merge.

Comment thread cmd/serve.go
Comment thread billing/config.go
Comment thread test/e2e/testbench/testbench.go Outdated
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.

2 participants