Add monetized subscription data to xds#1709
Conversation
SummaryThis pull request extends the subscription data structures to include billing and plan information, enabling better tracking of subscription-to-billing associations. Changessubscription_xds.go:
subscription_store.go:
OutcomeSubscriptions now carry billing and plan metadata alongside their existing status and quota information, allowing the system to associate individual subscriptions with their corresponding billing records and plans. WalkthroughThe subscription store and subscription data structures are extended with billing-related fields. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.4)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies" 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
sdk/core/policyengine/subscription_xds.go (1)
28-36: Align Go field naming: useBillingCustomerIDandBillingSubscriptionIDto matchSubscriptionEntry.The new fields are well-formed, but
SubscriptionDatausesBillingCustomerId/BillingSubscriptionId(lowercase 'd') while the matching fields onSubscriptionEntryinsubscription_store.goare spelledBillingCustomerID/BillingSubscriptionID(uppercase 'D'). This inconsistency makes find-and-replace fragile across the codebase. The JSON tags can remain lowercase (billingCustomerId/billingSubscriptionId) to preserve wire format; only the Go field names need alignment.Note: Both structs already use
*stringfor the billing fields consistently, so the pointer type is not an issue. The nullable semantics distinguish "explicitly null" from "empty string" over the wire, which is intentional.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@sdk/core/policyengine/subscription_xds.go` around lines 28 - 36, The Go field names in SubscriptionData should be renamed from BillingCustomerId and BillingSubscriptionId to BillingCustomerID and BillingSubscriptionID to match the fields on SubscriptionEntry (in subscription_store.go); keep the json and yaml tags unchanged (billingCustomerId/billingSubscriptionId) and preserve the *string pointer types and comments so only the identifier casing changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@sdk/core/policyengine/subscription_xds.go`:
- Around line 28-36: The Go field names in SubscriptionData should be renamed
from BillingCustomerId and BillingSubscriptionId to BillingCustomerID and
BillingSubscriptionID to match the fields on SubscriptionEntry (in
subscription_store.go); keep the json and yaml tags unchanged
(billingCustomerId/billingSubscriptionId) and preserve the *string pointer types
and comments so only the identifier casing changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1da6b4b3-79b5-4b75-80c9-f3c4b6c5a47c
📒 Files selected for processing (2)
sdk/core/policyengine/subscription_store.gosdk/core/policyengine/subscription_xds.go
Purpose
This pull request adds support for storing and tracking additional billing and plan information in subscription data structures. The changes ensure that each subscription now includes plan name and billing identifiers, making it easier to associate subscriptions with billing records and plans.
Approach
Enhancements to subscription data structures:
PlanName,BillingCustomerId, andBillingSubscriptionIdfields to theSubscriptionDatastruct insubscription_xds.goto store plan and billing information.PlanName,BillingCustomerID, andBillingSubscriptionIDfields to theSubscriptionEntrystruct insubscription_store.goto mirror the new data.Synchronization of new fields:
ReplaceAllmethod inSubscriptionStore(subscription_store.go) to copy the new plan and billing fields fromSubscriptionDataintoSubscriptionEntry.