fix: invoice pending lines via charges#4059
Conversation
📝 WalkthroughWalkthroughAdds an InvoicePendingLinesService interface and threads it through billing registry, HTTP handlers, workers, router, server, and tests; refactors consumers to call the new dedicated service instead of the broader billing service. Changes
Sequence Diagram(s)(Skipped — changes are wiring/refactor without introducing a new multi-component runtime flow that benefits from sequence visualization.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
767cd9e to
c8546e4
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
openmeter/billing/service.go (1)
98-100:RecalculateGatheringInvoicesis declared in bothInvoiceServiceandGatheringInvoiceService.This method appears in both interfaces (lines 98-100 and line 126). Since
Serviceembeds both, this works fine, but it's a bit redundant. If this is intentional (e.g., allowing consumers to depend on either interface), that's cool! If not, you might want to keep it in just one place.Also applies to: 126-126
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@openmeter/billing/service.go` around lines 98 - 100, The RecalculateGatheringInvoices method is duplicated in both InvoiceService and GatheringInvoiceService; decide which interface should own it (e.g., keep it only in GatheringInvoiceService or only in InvoiceService) and remove the redundant declaration from the other interface so Service still inherits it by embedding the correct interface; update any docs/comments to reflect the single source of truth and ensure callers reference the chosen interface name (RecalculateGatheringInvoices, InvoiceService, GatheringInvoiceService, Service) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@openmeter/billing/service.go`:
- Around line 98-100: The RecalculateGatheringInvoices method is duplicated in
both InvoiceService and GatheringInvoiceService; decide which interface should
own it (e.g., keep it only in GatheringInvoiceService or only in InvoiceService)
and remove the redundant declaration from the other interface so Service still
inherits it by embedding the correct interface; update any docs/comments to
reflect the single source of truth and ensure callers reference the chosen
interface name (RecalculateGatheringInvoices, InvoiceService,
GatheringInvoiceService, Service) accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9a0b1f4a-f51b-414a-8591-7468c1b3ca00
📒 Files selected for processing (14)
app/common/billing.gocmd/server/main.goopenmeter/billing/charges/service.goopenmeter/billing/httpdriver/handler.goopenmeter/billing/httpdriver/invoice.goopenmeter/billing/service.goopenmeter/billing/worker/collect/collect.goopenmeter/billing/worker/subscriptionsync/service/base_test.goopenmeter/billing/worker/subscriptionsync/service/service.goopenmeter/billing/worker/subscriptionsync/service/sync.goopenmeter/server/router/router.goopenmeter/server/server_test.gotest/billing/subscription_test.gotest/subscription/framework_test.go
✅ Files skipped from review due to trivial changes (2)
- openmeter/billing/worker/subscriptionsync/service/base_test.go
- openmeter/billing/charges/service.go
🚧 Files skipped from review as they are similar to previous changes (8)
- test/billing/subscription_test.go
- test/subscription/framework_test.go
- openmeter/server/server_test.go
- openmeter/billing/httpdriver/handler.go
- openmeter/server/router/router.go
- app/common/billing.go
- openmeter/billing/worker/subscriptionsync/service/service.go
- openmeter/billing/worker/collect/collect.go
Overview
When credits enabled we need to use charges to invoke InvoicePendingLines until the refactored billing worker's in place.
This patch makes sure that we are using the right backend.
Notes for reviewer
Summary by CodeRabbit
Refactor
Tests