Repository navigation
fix(billing): return minimal invoice advancement targets - #4923
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughPending invoice advancement now returns structured candidates with invoice and customer identities. The adapter retrieves customer IDs without resolving workflow or tax-code references. Service, worker, command, test, and no-op implementations use the new candidate type. ChangesInvoice advancement candidate contract and listing
Service and worker propagation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 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 |
|
approved |
Summary
namespace,id, andcustomer_idduring candidate discoveryThis lets event dispatchers publish advancement work without hydrating a full invoice and resolving its workflow apps.
Follow-up
Cloud should consume
InvoiceAdvancementCandidatedirectly and remove the per-candidateGetStandardInvoiceByIdcall fromSendInvoiceAdvanceEvents.Jira: no ticket yet; follow-up tickets are pending for the broader incident work.
Verification
POSTGRES_HOST=127.0.0.1 go test -tags=dynamic ./test/billing -run 'TestInvoicing/(TestListCustomerIDsPendingCollectionReturnsUniqueCustomersAcrossNamespaces|TestListPendingAdvancementDoesNotResolveWorkflowReferences)$' -count=1go test -tags=dynamic ./openmeter/billing/... ./cmd/jobs/billing/advance ./openmeter/servernix develop --impure .#ci -c make lint-go-fastGreptile Summary
The PR introduces lightweight invoice-advancement candidates so discovery can return invoice and customer identifiers without hydrating workflow dependencies.
Confidence Score: 5/5
The PR appears safe to merge, with no concrete correctness, security, or compatibility defects identified.
The changed interfaces and callers remain aligned, the partial projection includes every mapped non-nullable field, and concurrent advancement uses each candidate’s namespaced invoice ID with goroutine-local error state.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Job as Billing advance job participant Worker as AutoAdvancer participant Service as Billing service participant Adapter as Billing adapter participant DB as PostgreSQL Job->>Worker: ListInvoicesToAdvance(filters) Worker->>Service: ListStandardInvoicesPendingAdvancement Service->>Adapter: List pending candidates Adapter->>DB: SELECT namespace, id, customer_id DB-->>Adapter: Lightweight rows Adapter-->>Worker: InvoiceAdvancementCandidate[] loop Candidate batches Worker->>Service: AdvanceInvoice(candidate.InvoiceID) endReviews (1): Last reviewed commit: "fix(billing): return minimal invoice adv..." | Re-trigger Greptile
Context used:
Summary by CodeRabbit
New Features
Bug Fixes