refactor(billing): remove plan_id from the product create/update RPCs - #1824
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
| 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 |
There was a problem hiding this comment.
no need to mention these details here
Coverage Report for CI Build 30528994665Coverage increased (+0.001%) to 47.432%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions146 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
What
Remove
plan_idfrom the product create and update RPCs.ProductRequestBodyis shared byCreateProductandUpdateProduct, and this drops the field from both:plan_id(field 4) onProductRequestBody.CreateProducthandler to stop readingplan_id(it no longer links a plan on create).UpdateProductalready ignoredplan_id, so it needs no code change beyond the regen.Why
Plan membership is owned by the plan side.
UpsertPlanscreates a product and then links it withAddPlan, after checking the product has an active price at the plan's interval. The request-bodyplan_idwas a way around that check: creating a product with aplan_idwrote 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_idon create: the plan bootstrap and the reconcile flow both create products without it. The internalProduct.PlanIDsandAddPlanare untouched; they remain the real linking path.Depends on
plan_idonProductRequestBody) is merged.PROTON_COMMITis pinned to its merge commit91eaffc.plan_idremoval. Base isfeat/reconcile-billing-product; rebase ontomainonce feat(reconcile): add BillingProduct kind #1816 lands.Tests
Updated the connect handler tests (dropped the
plan_idrequest field and theplan_id=fragment from the error messages) and the e2e billing regression test (dropped the emptyPlanIdon eachProductRequestBody). Connect, billing, and reconcile suites pass; build, gofmt, vet, and lint are clean.