feat(api): expose charge system intent#4612
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds ChangesSystem Intent for Charge Overrides
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Greptile SummaryThis PR exposes shadowed system charge intent in v3 charge responses. The main changes are:
Confidence Score: 4/5The usage-based charge read path needs a fix before merging.
api/v3/handlers/customers/charges/convert.go Important Files Changed
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
api/v3/handlers/customers/charges/convert.go:170
**Unsupported Base Prices Break Reads**
When a manual override shadows a system-owned usage-based charge whose base subscription price is `dynamic` or `package`, this new `system_intent` path converts the base price through `toAPIBillingPrice`, which returns `unsupported price type`. The top-level response could previously serialize the effective override price, but now listing or getting that charge can fail the whole request instead of returning the charge.
Reviews (1): Last reviewed commit: "feat(api): expose charge system intent" | Re-trigger Greptile |
|
|
||
| baseIntent := intent.GetBaseIntent() | ||
|
|
||
| price, err := toAPIBillingPrice(baseIntent.Price) |
There was a problem hiding this comment.
Unsupported Base Prices Break Reads
When a manual override shadows a system-owned usage-based charge whose base subscription price is dynamic or package, this new system_intent path converts the base price through toAPIBillingPrice, which returns unsupported price type. The top-level response could previously serialize the effective override price, but now listing or getting that charge can fail the whole request instead of returning the charge.
Prompt To Fix With AI
This is a comment left during a code review.
Path: api/v3/handlers/customers/charges/convert.go
Line: 170
Comment:
**Unsupported Base Prices Break Reads**
When a manual override shadows a system-owned usage-based charge whose base subscription price is `dynamic` or `package`, this new `system_intent` path converts the base price through `toAPIBillingPrice`, which returns `unsupported price type`. The top-level response could previously serialize the effective override price, but now listing or getting that charge can fail the whole request instead of returning the charge.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Adds a system_intent read model to v3 customer charge responses for charges whose customer-facing intent is manually overridden while the original lifecycle controller remains system-owned.
Behavior
Validation
Summary by CodeRabbit