fix(billing): include plans without products in plan listings - #1834
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughChangesBilling plan listing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (1 passed)
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 |
Coverage Report for CI Build 30882789189Coverage decreased (-0.01%) to 47.537%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
rohilsurana
marked this pull request as ready for review
August 4, 2026 06:08
rohilsurana
enabled auto-merge (squash)
August 4, 2026 06:11
AmanGIT07
reviewed
Aug 4, 2026
AmanGIT07
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
BillingPlanRepository.ListWithProductsINNER JOINedbilling_productsonplan.id = ANY(product.plan_ids), so any plan with no products was dropped from the result.UpsertPlansallows creating a plan with an empty product set, so such plans can exist. This switches the join to a LEFT JOIN so those plans are returned.ListWithProducts.PlanProductRowbecome pointers, because a left join leaves them null for a plan with no products.getProductdereferences them.product_idis null, and always stores the accumulated plan back into the map (this also fixes a latent store-back bug where a multi-product plan could lose products after the first).plan_deleted_atwas selected from the product table by mistake, so a plan could report its product's deletion time as its own. It now comes from the plans table.Why
This affects both
FrontierService.ListPlansand, once #1830 lands,AdminService.ListAllPlans. An admin listing (and the future BillingPlan reconcile export) must be able to see every plan, including a misconfigured one with no products, so it can be reported or fixed.Testing
go build ./...,go vet, andgolangci-lintare clean.billing_product_repository_test.go).Closes #1832.