Repository navigation
feat: add async invoice collection event - #4625
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 selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds a customer invoice collection event, wires it through the billing worker, and updates dependency injection to construct and pass the new billing collector. It also forwards ChangesBilling Invoice Collection Event
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 adds an async customer invoice collection event for the billing worker. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "Wrap collect event validation errors" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openmeter/billing/eventscollection.go`:
- Around line 32-48: The Validate method on CollectCustomerInvoicesEvent
currently returns errors.Join(errs...) directly; update this to wrap the joined
result with models.NewNillableGenericValidationError so the validation error
type is preserved while keeping the combined message intact. Add the pkg/models
import, and make the return in CollectCustomerInvoicesEvent.Validate use
models.NewNillableGenericValidationError(errors.Join(errs...)) after collecting
namespace, customer_id, and as_of validation failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 275a3063-8d68-48e1-898c-7a82d318ebe8
📒 Files selected for processing (7)
app/common/openmeter_billingworker.gocmd/billing-worker/wire_gen.goopenmeter/billing/eventscollection.goopenmeter/billing/eventscollection_test.goopenmeter/billing/worker/collect/asynccollect.goopenmeter/billing/worker/collect/asynccollect_test.goopenmeter/billing/worker/worker.go
Summary
Adds an OSS billing command event for customer-scoped invoice collection and wires the billing worker to consume it through the existing invoice collector path.
This keeps OSS collection triggering unchanged while allowing external scanners, such as Cloud Temporal workflows, to publish
billing.invoice.collect.v1events for due customers.Changes
billing.CollectCustomerInvoicesEventwith customer resource metadata and validation.InvoiceCollector.CollectCustomerInvoice.Validation
make generatego test ./openmeter/billing ./openmeter/billing/worker/collectgo test ./openmeter/billing/worker/...go test ./app/common/...go vet ./openmeter/billing ./openmeter/billing/worker/... ./app/commongo test ./openmeter/billing/...Summary by CodeRabbit
invoice.collectevent with validation and standardized event metadata.AsOfis forwarded when collecting pending invoice lines.