Repository navigation
fix(billing): accept persisted charge validation issues - #5168
Conversation
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openmeterio/openmeter/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughAutomatic charge advancement now skips usage-based charges with matching persisted product-catalog validation issues. The charge remains unchanged, later attempts can resume after repair, and regression coverage verifies the behavior. ChangesPersisted validation handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 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 |
Overview
Treat usage-charge advancement failures as a successful blocked state when the same product-catalog validation issue is already persisted on the charge. This prevents expected missing-feature or missing-meter state from failing the billing worker and being sent to the DLQ, while preserving existing error behavior for unpersisted validation and operational failures.
Adds regression coverage for subscription-created meterless usage charges and documents the lifecycle contract.
Notes for reviewer
The match uses the stable validation component and code because subscription creation records the issue before the charge has an identity path, while advancement reports the same issue with the charge path attached.
Validation:
Summary by CodeRabbit
Bug Fixes
Documentation
The behavioral change appears safe, but the repository’s explicit lifecycle-test documentation convention must be satisfied before merging.
Fix with agent prompt
Summary
This PR allows usage-charge advancement to treat an already-persisted product-catalog validation issue as a successful blocked state rather than a worker failure.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Advance usage charge] --> B{AdvanceCharge returns error?} B -- No --> C[Process charge and invoice patches] B -- Yes --> D{Validation-only error?} D -- No --> E[Return operation failure] D -- Yes --> F{Every component and code already persisted?} F -- No --> E F -- Yes --> G[Keep charge blocked and unchanged] G --> H[Continue processing other charges] H --> I[Later advancement or collection retries after repair]Reviews (1) · Last reviewed commit: "fix(billing): accept persisted charge va..."