Skip to content

refactor(billing): remove plan_id from the product create/update RPCs - #1824

Merged
rohilsurana merged 4 commits into
feat/reconcile-billing-productfrom
refactor/drop-product-request-plan-id
Jul 30, 2026
Merged

refactor(billing): remove plan_id from the product create/update RPCs#1824
rohilsurana merged 4 commits into
feat/reconcile-billing-productfrom
refactor/drop-product-request-plan-id

Conversation

@rohilsurana

@rohilsurana rohilsurana commented Jul 30, 2026

Copy link
Copy Markdown
Member

What

Remove plan_id from the product create and update RPCs. ProductRequestBody is shared by CreateProduct and UpdateProduct, and this drops the field from both:

  • Regenerates against proton, which reserves plan_id (field 4) on ProductRequestBody.
  • Updates the CreateProduct handler to stop reading plan_id (it no longer links a plan on create).
  • UpdateProduct already ignored plan_id, so it needs no code change beyond the regen.

Why

Plan membership is owned by the plan side. UpsertPlans creates a product and then links it with AddPlan, after checking the product has an active price at the plan's interval. The request-body plan_id was a way around that check: creating a product with a plan_id wrote the link straight to the database and skipped the matching-price check, so you could link a product to a plan that has no valid price for its interval. Removing it makes plan membership a single-owner concern (the plans) and closes that back door.

Nothing in Frontier set plan_id on create: the plan bootstrap and the reconcile flow both create products without it. The internal Product.PlanIDs and AddPlan are untouched; they remain the real linking path.

Depends on

Tests

Updated the connect handler tests (dropped the plan_id request field and the plan_id= fragment from the error messages) and the e2e billing regression test (dropped the empty PlanId on each ProductRequestBody). Connect, billing, and reconcile suites pass; build, gofmt, vet, and lint are clean.

@vercel

vercel Bot commented Jul 30, 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 Jul 30, 2026 9:01am

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 951e9935-d950-4fcc-9f39-2a24f0e9843a

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.

if planID := request.Msg.GetBody().GetPlanId(); planID != "" {
planIDs = []string{planID}
}
// a product is not linked to a plan here; plan membership is managed from the

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.

no need to mention these details here

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.

Removed in 4720da5.

@rohilsurana
rohilsurana marked this pull request as ready for review July 30, 2026 08:43
@coveralls

coveralls commented Jul 30, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 30528994665

Coverage increased (+0.001%) to 47.432%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: 2 of 2 lines across 1 file are fully covered (100%).
  • 146 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

146 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
core/membership/service.go 146 82.93%

Coverage Stats

Coverage Status
Relevant Lines: 39499
Covered Lines: 18735
Line Coverage: 47.43%
Coverage Strength: 15.14 hits per line

💛 - Coveralls

@rohilsurana
rohilsurana merged commit baccf42 into feat/reconcile-billing-product Jul 30, 2026
8 checks passed
@rohilsurana
rohilsurana deleted the refactor/drop-product-request-plan-id branch July 30, 2026 09:09
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.

3 participants