Repository navigation
fix: assume that non-flat prices are UBP - #2603
Conversation
📝 WalkthroughWalkthroughThe changes focus on the Changes
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 (1.64.8)Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2 ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
openmeter/billing/worker/subscription/sync.go (1)
442-453: Simplified handling of non-flat price typesThe code now treats all non-flat prices as usage-based pricing, which aligns with the PR objective. This simplification removes special handling for different price types and streamlines the control flow.
Consider adding a nil check for
FeatureKeybefore dereferencing it on line 451 to prevent potential panic:line.UsageBased = &billing.UsageBasedLine{ Price: item.SubscriptionItem.RateCard.Price, - FeatureKey: *item.SubscriptionItem.RateCard.FeatureKey, + FeatureKey: *item.SubscriptionItem.RateCard.FeatureKey, // Safe because we validate FeatureKey exists for UBP }Also, consider adding a comment explaining the assumption that all non-flat prices are UBP to make the intention clear.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
openmeter/billing/worker/subscription/sync.go(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: Quickstart
- GitHub Check: E2E
- GitHub Check: CI
- GitHub Check: Test
- GitHub Check: Migration Checks
- GitHub Check: Lint
- GitHub Check: Developer environment
- GitHub Check: Commit hooks
- GitHub Check: Build
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (go)
Summary by CodeRabbit