Repository navigation
feat(billing): gate gathering line invoice assignment - #5090
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughBilling adds invoice-assignment gating for gathering lines. Line engines can exclude lines before invoice creation. The service validates gate responses, preserves line limits, handles all-excluded candidates, and rolls back collection on gate errors. ChangesInvoice assignment gating
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The gating behavior and its tested collection semantics are ready to merge, with no identified material risk. Sequence Diagram(s)sequenceDiagram
participant Collection
participant prepareBillableLines
participant LineEngine
Collection->>prepareBillableLines: prepare pending gathering lines
prepareBillableLines->>LineEngine: GateInvoiceAssignment(candidate lines)
LineEngine-->>prepareBillableLines: exclusion decisions or error
prepareBillableLines-->>Collection: filtered lines or collection failure
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 |
0e2f11b to
7f32069
Compare
Overview
Add a line-engine gate that can exclude otherwise billable gathering lines from invoice assignment based on external state.
GateInvoiceAssignmentresponse where omitted line IDs are allowed by defaultErrInvoiceCreateNoLinesworker warningsErrInvoiceCreateNoLinesbehaviorNotes for reviewer
ErrInvoiceCreateNoLinesremains unchanged when there were no otherwise billable candidates.Validation
go test ./openmeter/billing ./openmeter/billing/service ./openmeter/billing/charges/creditpurchase/service ./openmeter/billing/charges/flatfee/service ./openmeter/billing/charges/usagebased/servicePOSTGRES_HOST=127.0.0.1 go test -tags=dynamic ./test/billing -run '^TestLineEngine$'make lint-go-fastGreptile Summary
This PR introduces a sparse, engine-specific gate between billability selection and invoice materialization.
Confidence Score: 5/5
The PR appears safe to merge, with no outstanding correctness, security, or repository-rule violations identified.
The gate is applied at the intended collection boundary, validates engine responses, preserves sparse allow-by-default behavior, and distinguishes fully excluded candidates from having no billable candidates. The earlier testing-convention thread was manually resolved without explanation.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR G[Gathering lines] --> B[Billability selection] B --> E[Group candidates by line engine] E --> A[Gate invoice assignment] A -->|Excluded| P[Remain pending] A -->|Allowed| L[Apply invoice line limit] L --> S[Split progressive lines] S --> M[Materialize standard invoice] A -->|All excluded| N[Successful empty result]Reviews (3): Last reviewed commit: "test(billing): address gate review feedb..." | Re-trigger Greptile
Context used:
Summary by CodeRabbit
New Features
Documentation
Tests