Skip to content

fix(billing): register the custom invoicing app in the jobs binary - #5004

Merged
turip merged 1 commit into
openmeterio:mainfrom
iskron:fix-jobs-custominvoicing
Aug 26, 2026
Merged

turip merged 1 commit into
openmeterio:mainfrom
iskron:fix-jobs-custominvoicing

Conversation

@iskron

@iskron iskron commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

The jobs binary (subscription sync cronjob) cannot resolve a billing profile driven by the custom_invoicing app:

getting billing profile: cannot resolve tax app: failed to get listing for app <id>: not found error: listing with type not found: custom_invoicing

Marketplace listings are registered as a side effect of constructing each app service, and wire only constructs what a binary's Application struct demands. cmd/jobs demands the sandbox and stripe apps but not custom invoicing; the server and cmd/billing-worker construct it, which is why the same app resolves fine on every other surface.

Repro: install custom_invoicing, create a default billing profile with it in all three slots, subscribe a customer to a paid plan, run openmeter-jobs billing subscriptionsync all. Free-plan subscriptions skip on "no billables" before profile resolution, so the failure only shows on paid ones.

Fix: demand the service from cmd/jobs as well; wire_gen.go regenerated. Verified against v1.0.0-beta.231 and .232 — the stock binary fails as above, the patched one reconciles the paid subscription into a gathering invoice.

Summary by CodeRabbit

  • New Features
    • Added support for custom invoicing services.
    • Custom invoicing billing profiles can now be recognized during subscription reconciliation.
    • Marketplace listings required for custom invoicing are registered automatically during application startup.

Greptile Summary

The PR adds the custom invoicing service to the jobs binary’s dependency graph so its marketplace listing is registered before subscription synchronization resolves billing profiles.

  • Adds appcustominvoicing.Service to the jobs Application.
  • Regenerates the Wire graph to construct and retain the service.
  • Preserves existing provider error cleanup and initialization ordering.

Confidence Score: 5/5

The PR appears safe to merge, with the jobs dependency graph now consistently registering the custom invoicing marketplace listing.

The added provider uses dependencies already available in the jobs graph, matches existing server and billing-worker composition, and preserves generated initialization and cleanup behavior.

Important Files Changed

Filename Overview
cmd/jobs/internal/wire.go Adds the custom invoicing service to the jobs application graph, making its registration side effect part of process initialization.
cmd/jobs/internal/wire_gen.go Regenerates the jobs provider graph to construct and retain the custom invoicing service with consistent error cleanup.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Start[Jobs application initialization] --> Construct[Construct custom invoicing service]
  Construct --> Register[Register custom_invoicing marketplace listing]
  Register --> Sync[Run paid subscription synchronization]
  Sync --> Resolve[Resolve custom invoicing billing profile]
  Resolve --> Invoice[Reconcile gathering invoice]
Loading

Reviews (1): Last reviewed commit: "fix(billing): register the custom invoic..." | Re-trigger Greptile

Context used:

Marketplace listings are registered as a side effect of constructing each
app service, and wire only constructs what a binary's Application struct
demands. cmd/jobs demands the sandbox and stripe apps but not custom
invoicing, so its in-process registry has no custom_invoicing listing and
subscription sync fails against a billing profile driven by that app:

  getting billing profile: cannot resolve tax app: failed to get listing
  for app <id>: not found error: listing with type not found: custom_invoicing

The server and cmd/billing-worker construct the service, which is why the
same app resolves fine on every other surface. Demand it from cmd/jobs as
well (wire_gen regenerated).
@iskron
iskron requested a review from a team as a code owner August 25, 2026 22:36
@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c13bd870-968d-4f4f-8665-6c8b12926fd0

📥 Commits

Reviewing files that changed from the base of the PR and between b2359ce and 3af4df4.

📒 Files selected for processing (2)
  • cmd/jobs/internal/wire.go
  • cmd/jobs/internal/wire_gen.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The job application wiring now imports, constructs, and exposes the custom invoicing service. Construction errors trigger the existing cleanup sequence before returning.

Changes

Custom invoicing wiring

Layer / File(s) Summary
Application service contract
cmd/jobs/internal/wire.go, cmd/jobs/internal/wire_gen.go
The Application type now exposes AppCustomInvoicing appcustominvoicing.Service. The wiring imports the custom invoicing package.
Service initialization
cmd/jobs/internal/wire_gen.go
Generated wiring constructs the custom invoicing service, runs registered cleanup functions when construction fails, and assigns the service to the returned Application.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 3af4d

This localized change registers the custom invoicing app for the jobs binary so paid subscription reconciliation can resolve the configured billing profile; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: galexihu, turip

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: registering the custom invoicing app in the jobs binary to fix billing behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@turip turip added release-note/bug-fix Release note: Bug Fixes area/billing labels Aug 26, 2026
@turip

turip commented Aug 26, 2026

Copy link
Copy Markdown
Member

Thank you for your contribution!

@turip
turip merged commit 52a7921 into openmeterio:main Aug 26, 2026
28 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants