Skip to content

feat(ledger): accounts and transactions - #3898

Merged
GAlexIHU merged 22 commits into
mainfrom
feat/ledger-provisioning
Mar 17, 2026
Merged

GAlexIHU merged 22 commits into
mainfrom
feat/ledger-provisioning

Conversation

@GAlexIHU

@GAlexIHU GAlexIHU commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Fixes #(issue)

Notes for reviewer

Summary by CodeRabbit

  • Documentation

    • Added an overview of the platform, maintenance guidance, testing notes (local/single/E2E), and new "Ledger gotchas" and "Ent gotchas" sections.
  • Chores

    • Added editor/test configuration guidance to improve local analysis and test runs.
  • Refactor

    • Modularized the ledger stack to better compose ledger services and repositories for maintainability.

@GAlexIHU
GAlexIHU requested a review from a team as a code owner February 24, 2026 15:16
@GAlexIHU GAlexIHU added the release-note/ignore Ignore this change when generating release notes label Feb 24, 2026
@coderabbitai

coderabbitai Bot commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds documentation and maintenance guidance to AGENTS.md (testing, ledger/Ent gotchas), introduces a new VS Code go.testTags setting, and adds a ledger DI/wiring module (app/common/ledger.go) with constructors and wire.Bind declarations to compose ledger-related repos and services.

Changes

Cohort / File(s) Summary
Docs — AGENTS guidance
AGENTS.md
Adds project overview, contributor/maintenance guidance, expanded testing/codegen notes, and new "Ledger gotchas" and "Ent gotchas" sections covering Postgres/test migration caveats, array handling, encode/decode paths, and Ent code regeneration tips.
Editor settings
.vscode/settings.json
Introduces go.testTags ("dynamic") and explanatory comments about wireinject for gopls; preserves existing go.buildTags.
Ledger wiring / DI
app/common/ledger.go
New LedgerStack wire provider set and multiple constructors (account/historical/resolvers repos, live services, account service, historical ledger, resolvers service) plus wire.Bind statements to connect interfaces to concrete types.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant App as App Bootstrap
    participant Wire as Wire (DI)
    participant DB as entdb.Client
    participant Locker as lockr.Locker
    participant Repo as Ledger Repos
    participant AccSvc as Account Service
    participant Hist as Historical Ledger
    participant Res as Resolvers Service

    App->>Wire: Initialize LedgerStack
    Wire->>DB: provide entdb.Client
    Wire->>Locker: provide lockr.Locker
    Wire->>Repo: NewLedgerAccountRepo / NewLedgerHistoricalRepo / NewLedgerResolversRepo
    Wire->>AccSvc: NewLedgerAccountService (repo, live services)
    Wire->>Hist: NewLedgerHistoricalLedger (historical repo, accountSvc, locker)
    Wire->>Res: NewLedgerResolversService (accountSvc, resolvers repo)
    App->>AccSvc: Use account service
    App->>Hist: Use historical ledger
    App->>Res: Use resolvers service
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: introducing ledger wiring infrastructure with accounts and transaction resolution components as core additions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ledger-provisioning
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes with custom instructions.

Set the reviews.auto_title_instructions setting to generate a title for your PR based on the changes in the PR with custom instructions.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENTS.md`:
- Line 3: Change the phrase "OpenMeter is a metering and billing platform with
usage based pricing and access control." in AGENTS.md to hyphenate the compound
adjective so it reads "usage-based pricing" (i.e., replace "usage based pricing"
with "usage-based pricing") to fix the grammar nit.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b128019 and 614df30.

⛔ Files ignored due to path filters (57)
  • go.sum is excluded by !**/*.sum, !**/*.sum
  • openmeter/ent/db/client.go is excluded by !**/ent/db/**
  • openmeter/ent/db/cursor.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ent.go is excluded by !**/ent/db/**
  • openmeter/ent/db/expose.go is excluded by !**/ent/db/**
  • openmeter/ent/db/hook/hook.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/migrate/schema.go is excluded by !**/ent/db/**
  • openmeter/ent/db/mutation.go is excluded by !**/ent/db/**
  • openmeter/ent/db/paginate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/predicate/predicate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/runtime.go is excluded by !**/ent/db/**
  • openmeter/ent/db/selectedparse.go is excluded by !**/ent/db/**
  • openmeter/ent/db/setorclear.go is excluded by !**/ent/db/**
  • openmeter/ent/db/tx.go is excluded by !**/ent/db/**
  • tools/migrate/migrations/atlas.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (54)
  • AGENTS.md
  • openmeter/ent/entc.go
  • openmeter/ent/schema/ledger_account.go
  • openmeter/ent/schema/ledger_dimension.go
  • openmeter/ent/schema/ledger_entry.go
  • openmeter/ent/schema/ledger_transaction.go
  • openmeter/ent/schema/ledger_transaction_group.go
  • openmeter/ledger/account.go
  • openmeter/ledger/account/acc_customer.go
  • openmeter/ledger/account/account.go
  • openmeter/ledger/account/adapter/account.go
  • openmeter/ledger/account/adapter/dimension.go
  • openmeter/ledger/account/adapter/repo.go
  • openmeter/ledger/account/adapter/repo_test.go
  • openmeter/ledger/account/adapter/subaccount.go
  • openmeter/ledger/account/address.go
  • openmeter/ledger/account/dimension.go
  • openmeter/ledger/account/error.go
  • openmeter/ledger/account/ledger.go
  • openmeter/ledger/account/repo.go
  • openmeter/ledger/account/service.go
  • openmeter/ledger/account/service/service.go
  • openmeter/ledger/account/subaccount.go
  • openmeter/ledger/accounts.go
  • openmeter/ledger/customer/hooks.go
  • openmeter/ledger/customer/service.go
  • openmeter/ledger/dimension.go
  • openmeter/ledger/errors.go
  • openmeter/ledger/historical/adapter/ledger.go
  • openmeter/ledger/historical/adapter/ledger_test.go
  • openmeter/ledger/historical/adapter/repo.go
  • openmeter/ledger/historical/adapter/sumentries_query.go
  • openmeter/ledger/historical/entry.go
  • openmeter/ledger/historical/ledger.go
  • openmeter/ledger/historical/repo.go
  • openmeter/ledger/historical/transaction.go
  • openmeter/ledger/ledger_fx_test.go
  • openmeter/ledger/ledger_test.go
  • openmeter/ledger/primitives.go
  • openmeter/ledger/query.go
  • openmeter/ledger/transactions/customer.go
  • openmeter/ledger/transactions/fx.go
  • openmeter/ledger/transactions/input.go
  • openmeter/ledger/transactions/template.go
  • openmeter/ledger/transactions/testutils/anytemplate.go
  • openmeter/ledger/transactions/testutils/anytransaction.go
  • openmeter/ledger/validations.go
  • pkg/framework/entutils/entcursor/cursor.go
  • pkg/framework/entutils/entcursor/cursor.tpl
  • pkg/framework/entutils/entcursor/cursor_test.go
  • pkg/framework/entutils/testutils/ent1/db/cursor.go
  • pkg/framework/entutils/testutils/ent1/entc.go
  • tools/migrate/migrations/20260218122624_ledger.down.sql
  • tools/migrate/migrations/20260218122624_ledger.up.sql

Comment thread AGENTS.md
@@ -1,9 +1,20 @@
# OpenMeter

OpenMeter is a metering and billing platform with usage based pricing and access control.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Tiny grammar nit: hyphenate "usage-based"

"usage-based pricing" is a compound adjective and needs a hyphen. Static analysis caught this one too!

✏️ Suggested fix
-OpenMeter is a metering and billing platform with usage based pricing and access control.
+OpenMeter is a metering and billing platform with usage-based pricing and access control.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
OpenMeter is a metering and billing platform with usage based pricing and access control.
OpenMeter is a metering and billing platform with usage-based pricing and access control.
🧰 Tools
🪛 LanguageTool

[grammar] ~3-~3: Use a hyphen to join words.
Context: ...metering and billing platform with usage based pricing and access control. ## Ti...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 3, Change the phrase "OpenMeter is a metering and billing
platform with usage based pricing and access control." in AGENTS.md to hyphenate
the compound adjective so it reads "usage-based pricing" (i.e., replace "usage
based pricing" with "usage-based pricing") to fix the grammar nit.

@GAlexIHU
GAlexIHU force-pushed the feat/ledger-provisioning branch from 614df30 to 149626a Compare February 24, 2026 15:30

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
AGENTS.md (1)

3-3: ⚠️ Potential issue | 🟡 Minor

Tiny grammar nit: hyphenate “usage-based”.

This was already flagged in a prior review comment; repeating here just to keep it visible.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 3, Update the sentence in AGENTS.md that currently reads
"OpenMeter is a metering and billing platform with usage based pricing and
access control." to hyphenate "usage-based" so it reads "OpenMeter is a metering
and billing platform with usage-based pricing and access control." Make this
exact text replacement in the file (look for the sentence string) to fix the
grammar nit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@AGENTS.md`:
- Line 3: Update the sentence in AGENTS.md that currently reads "OpenMeter is a
metering and billing platform with usage based pricing and access control." to
hyphenate "usage-based" so it reads "OpenMeter is a metering and billing
platform with usage-based pricing and access control." Make this exact text
replacement in the file (look for the sentence string) to fix the grammar nit.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 614df30 and 149626a.

⛔ Files ignored due to path filters (57)
  • go.sum is excluded by !**/*.sum, !**/*.sum
  • openmeter/ent/db/client.go is excluded by !**/ent/db/**
  • openmeter/ent/db/cursor.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ent.go is excluded by !**/ent/db/**
  • openmeter/ent/db/expose.go is excluded by !**/ent/db/**
  • openmeter/ent/db/hook/hook.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/migrate/schema.go is excluded by !**/ent/db/**
  • openmeter/ent/db/mutation.go is excluded by !**/ent/db/**
  • openmeter/ent/db/paginate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/predicate/predicate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/runtime.go is excluded by !**/ent/db/**
  • openmeter/ent/db/selectedparse.go is excluded by !**/ent/db/**
  • openmeter/ent/db/setorclear.go is excluded by !**/ent/db/**
  • openmeter/ent/db/tx.go is excluded by !**/ent/db/**
  • tools/migrate/migrations/atlas.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (54)
  • AGENTS.md
  • openmeter/ent/entc.go
  • openmeter/ent/schema/ledger_account.go
  • openmeter/ent/schema/ledger_dimension.go
  • openmeter/ent/schema/ledger_entry.go
  • openmeter/ent/schema/ledger_transaction.go
  • openmeter/ent/schema/ledger_transaction_group.go
  • openmeter/ledger/account.go
  • openmeter/ledger/account/acc_customer.go
  • openmeter/ledger/account/account.go
  • openmeter/ledger/account/adapter/account.go
  • openmeter/ledger/account/adapter/dimension.go
  • openmeter/ledger/account/adapter/repo.go
  • openmeter/ledger/account/adapter/repo_test.go
  • openmeter/ledger/account/adapter/subaccount.go
  • openmeter/ledger/account/address.go
  • openmeter/ledger/account/dimension.go
  • openmeter/ledger/account/error.go
  • openmeter/ledger/account/ledger.go
  • openmeter/ledger/account/repo.go
  • openmeter/ledger/account/service.go
  • openmeter/ledger/account/service/service.go
  • openmeter/ledger/account/subaccount.go
  • openmeter/ledger/accounts.go
  • openmeter/ledger/customer/hooks.go
  • openmeter/ledger/customer/service.go
  • openmeter/ledger/dimension.go
  • openmeter/ledger/errors.go
  • openmeter/ledger/historical/adapter/ledger.go
  • openmeter/ledger/historical/adapter/ledger_test.go
  • openmeter/ledger/historical/adapter/repo.go
  • openmeter/ledger/historical/adapter/sumentries_query.go
  • openmeter/ledger/historical/entry.go
  • openmeter/ledger/historical/ledger.go
  • openmeter/ledger/historical/repo.go
  • openmeter/ledger/historical/transaction.go
  • openmeter/ledger/ledger_fx_test.go
  • openmeter/ledger/ledger_test.go
  • openmeter/ledger/primitives.go
  • openmeter/ledger/query.go
  • openmeter/ledger/transactions/customer.go
  • openmeter/ledger/transactions/fx.go
  • openmeter/ledger/transactions/input.go
  • openmeter/ledger/transactions/template.go
  • openmeter/ledger/transactions/testutils/anytemplate.go
  • openmeter/ledger/transactions/testutils/anytransaction.go
  • openmeter/ledger/validations.go
  • pkg/framework/entutils/entcursor/cursor.go
  • pkg/framework/entutils/entcursor/cursor.tpl
  • pkg/framework/entutils/entcursor/cursor_test.go
  • pkg/framework/entutils/testutils/ent1/db/cursor.go
  • pkg/framework/entutils/testutils/ent1/entc.go
  • tools/migrate/migrations/20260224152448_ledger.down.sql
  • tools/migrate/migrations/20260224152448_ledger.up.sql

@GAlexIHU
GAlexIHU force-pushed the feat/ledger-provisioning branch from 149626a to 2774b26 Compare February 26, 2026 12:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
AGENTS.md (1)

3-3: ⚠️ Potential issue | 🟡 Minor

Quick grammar fix: hyphenate “usage-based”

Nice intro line—just one tiny nit: compound adjective should be hyphenated on Line 3.

✏️ Suggested tweak
-OpenMeter is a metering and billing platform with usage based pricing and access control.
+OpenMeter is a metering and billing platform with usage-based pricing and access control.

As per coding guidelines, markdown quality checks should cover spelling and grammar.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 3, Replace the unhyphenated compound adjective "usage
based pricing" in the AGENTS.md intro line with the hyphenated form "usage-based
pricing" so the sentence reads "OpenMeter is a metering and billing platform
with usage-based pricing and access control."; update that phrase wherever it
appears to conform to the markdown grammar rule.
🧹 Nitpick comments (1)
AGENTS.md (1)

7-7: Consider tightening this guidance sentence for readability

Line 7 is helpful, but it’s a bit long/repetitive. A shorter version will be easier to scan.

✂️ Suggested rewrite
-If during your work anything confuses you or something isn't trivial for you, please augment AGENTS.md with your findings so next time it will be easier for you. AGENTS.md files are for you to edit and update as you go so you can interact with the codebase the most effectively.
+If anything is unclear during your work, add your findings to `AGENTS.md` so future contributors can move faster. Keep updating this file as you learn the codebase.

As per coding guidelines, markdown style should keep documentation clear and well-organized.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 7, Tighten the long sentence in AGENTS.md (the sentence
beginning "If during your work anything confuses you or something isn't trivial
for you, please augment AGENTS.md with your findings so next time it will be
easier for you.") by replacing it with a concise, scannable alternative such as:
"If something confuses you or isn't straightforward, update AGENTS.md with your
findings to help future readers." Locate that sentence in AGENTS.md and swap it
out, keeping tone and intent but improving readability and brevity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@AGENTS.md`:
- Line 3: Replace the unhyphenated compound adjective "usage based pricing" in
the AGENTS.md intro line with the hyphenated form "usage-based pricing" so the
sentence reads "OpenMeter is a metering and billing platform with usage-based
pricing and access control."; update that phrase wherever it appears to conform
to the markdown grammar rule.

---

Nitpick comments:
In `@AGENTS.md`:
- Line 7: Tighten the long sentence in AGENTS.md (the sentence beginning "If
during your work anything confuses you or something isn't trivial for you,
please augment AGENTS.md with your findings so next time it will be easier for
you.") by replacing it with a concise, scannable alternative such as: "If
something confuses you or isn't straightforward, update AGENTS.md with your
findings to help future readers." Locate that sentence in AGENTS.md and swap it
out, keeping tone and intent but improving readability and brevity.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 149626a and 2774b26.

⛔ Files ignored due to path filters (64)
  • go.sum is excluded by !**/*.sum, !**/*.sum
  • openmeter/ent/db/client.go is excluded by !**/ent/db/**
  • openmeter/ent/db/cursor.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ent.go is excluded by !**/ent/db/**
  • openmeter/ent/db/expose.go is excluded by !**/ent/db/**
  • openmeter/ent/db/hook/hook.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount/ledgercustomeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/migrate/schema.go is excluded by !**/ent/db/**
  • openmeter/ent/db/mutation.go is excluded by !**/ent/db/**
  • openmeter/ent/db/paginate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/predicate/predicate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/runtime.go is excluded by !**/ent/db/**
  • openmeter/ent/db/selectedparse.go is excluded by !**/ent/db/**
  • openmeter/ent/db/setorclear.go is excluded by !**/ent/db/**
  • openmeter/ent/db/tx.go is excluded by !**/ent/db/**
  • tools/migrate/migrations/atlas.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (58)
  • AGENTS.md
  • openmeter/ent/entc.go
  • openmeter/ent/schema/ledger_account.go
  • openmeter/ent/schema/ledger_customer_account.go
  • openmeter/ent/schema/ledger_dimension.go
  • openmeter/ent/schema/ledger_entry.go
  • openmeter/ent/schema/ledger_transaction.go
  • openmeter/ent/schema/ledger_transaction_group.go
  • openmeter/ledger/account.go
  • openmeter/ledger/account/acc_customer.go
  • openmeter/ledger/account/account.go
  • openmeter/ledger/account/adapter/account.go
  • openmeter/ledger/account/adapter/dimension.go
  • openmeter/ledger/account/adapter/repo.go
  • openmeter/ledger/account/adapter/repo_test.go
  • openmeter/ledger/account/adapter/subaccount.go
  • openmeter/ledger/account/address.go
  • openmeter/ledger/account/dimension.go
  • openmeter/ledger/account/error.go
  • openmeter/ledger/account/ledger.go
  • openmeter/ledger/account/repo.go
  • openmeter/ledger/account/resolver.go
  • openmeter/ledger/account/service.go
  • openmeter/ledger/account/service/service.go
  • openmeter/ledger/account/subaccount.go
  • openmeter/ledger/accounts.go
  • openmeter/ledger/dimension.go
  • openmeter/ledger/errors.go
  • openmeter/ledger/historical/adapter/ledger.go
  • openmeter/ledger/historical/adapter/ledger_test.go
  • openmeter/ledger/historical/adapter/repo.go
  • openmeter/ledger/historical/adapter/sumentries_query.go
  • openmeter/ledger/historical/entry.go
  • openmeter/ledger/historical/ledger.go
  • openmeter/ledger/historical/repo.go
  • openmeter/ledger/historical/transaction.go
  • openmeter/ledger/ledger_fx_test.go
  • openmeter/ledger/ledger_test.go
  • openmeter/ledger/primitives.go
  • openmeter/ledger/query.go
  • openmeter/ledger/resolvers/adapter/repo.go
  • openmeter/ledger/resolvers/hooks.go
  • openmeter/ledger/resolvers/repo.go
  • openmeter/ledger/resolvers/service.go
  • openmeter/ledger/transactions/customer.go
  • openmeter/ledger/transactions/fx.go
  • openmeter/ledger/transactions/input.go
  • openmeter/ledger/transactions/template.go
  • openmeter/ledger/transactions/testutils/anytemplate.go
  • openmeter/ledger/transactions/testutils/anytransaction.go
  • openmeter/ledger/validations.go
  • pkg/framework/entutils/entcursor/cursor.go
  • pkg/framework/entutils/entcursor/cursor.tpl
  • pkg/framework/entutils/entcursor/cursor_test.go
  • pkg/framework/entutils/testutils/ent1/db/cursor.go
  • pkg/framework/entutils/testutils/ent1/entc.go
  • tools/migrate/migrations/20260226124536_ledger.down.sql
  • tools/migrate/migrations/20260226124536_ledger.up.sql

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/common/ledger.go (1)

18-20: LedgerStack is labeled “full,” but AccountLiveServices is intentionally partial.

Line 19 says this is the full ledger stack, while Line 46 documents that Querier is intentionally nil. That mismatch can confuse future callers and make misuse easier. Consider renaming this set to a write/commit-specific name (or splitting full vs commit-only provider sets).

As per coding guidelines: **/*.go: In general when reviewing the Golang code make readability and maintainability a priority, even potentially suggest restructuring the code to improve them.

Also applies to: 44-47

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/common/ledger.go` around lines 18 - 20, The wire provider set named
LedgerStack is documented as "full" but includes AccountLiveServices which is
intentionally partial (Querier left nil), causing misleading API; rename or
split it: either (A) rename LedgerStack to a commit/write-specific name (e.g.,
LedgerCommitStack or LedgerWriteSet) or (B) split into two wire sets (e.g.,
LedgerFullStack that composes all providers including a non-nil Querier, and
LedgerCommitStack/AccountLiveServices for the commit-only providers). Update the
set declaration(s) and any references to use the new name(s) and ensure the
recorded comment matches the actual contents (mentioning Querier nil in the
partial set and documenting which set is full vs commit-only).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/common/ledger.go`:
- Around line 18-20: The wire provider set named LedgerStack is documented as
"full" but includes AccountLiveServices which is intentionally partial (Querier
left nil), causing misleading API; rename or split it: either (A) rename
LedgerStack to a commit/write-specific name (e.g., LedgerCommitStack or
LedgerWriteSet) or (B) split into two wire sets (e.g., LedgerFullStack that
composes all providers including a non-nil Querier, and
LedgerCommitStack/AccountLiveServices for the commit-only providers). Update the
set declaration(s) and any references to use the new name(s) and ensure the
recorded comment matches the actual contents (mentioning Querier nil in the
partial set and documenting which set is full vs commit-only).

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2774b26 and c0eaccc.

⛔ Files ignored due to path filters (1)
  • tools/migrate/migrations/atlas.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (18)
  • .vscode/settings.json
  • app/common/ledger.go
  • openmeter/ledger/account/service/service.go
  • openmeter/ledger/historical/ledger.go
  • openmeter/ledger/ledger_fx_test.go
  • openmeter/ledger/ledger_test.go
  • openmeter/ledger/resolvers/service.go
  • openmeter/ledger/testutil/generate.go
  • openmeter/ledger/testutil/wire.go
  • openmeter/ledger/testutil/wire_gen.go
  • openmeter/ledger/transactions/customer.go
  • openmeter/ledger/transactions/fx.go
  • openmeter/ledger/transactions/input.go
  • openmeter/ledger/transactions/resolve.go
  • openmeter/ledger/transactions/template.go
  • openmeter/ledger/transactions/testutils/anytransaction.go
  • tools/migrate/migrations/20260226142755_ledger_customer_accounts.down.sql
  • tools/migrate/migrations/20260226142755_ledger_customer_accounts.up.sql

@GAlexIHU
GAlexIHU force-pushed the feat/ledger-provisioning branch from 9f71f3f to f5f6a34 Compare March 4, 2026 12:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
AGENTS.md (1)

3-3: ⚠️ Potential issue | 🟡 Minor

Grammar nit: "usage-based" needs a hyphen.

This was caught by static analysis. Quick fix:

-OpenMeter is a metering and billing platform with usage based pricing and access control.
+OpenMeter is a metering and billing platform with usage-based pricing and access control.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 3, Update the sentence in AGENTS.md to use the hyphenated
adjective form by changing "usage based pricing" to "usage-based pricing" so the
line reads: "OpenMeter is a metering and billing platform with usage-based
pricing and access control." This is a simple text edit to the content string in
AGENTS.md.
🧹 Nitpick comments (1)
app/common/ledger.go (1)

44-51: Heads up: nil Querier could bite someone later.

The comment helpfully explains why Querier is nil (only needed for GetBalance, not the commit path). That said, if someone later calls GetBalance through this wiring, they'll hit a nil pointer dereference at runtime.

A couple of options to consider:

  1. Add a brief note in the LedgerStack doc comment warning that GetBalance isn't supported via this wiring.
  2. Or, if feasible, wire up a Querier implementation that returns a clear "not supported" error.

Not blocking since the current use case doesn't need it, but worth documenting more prominently so future devs don't trip over it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/common/ledger.go` around lines 44 - 51, The NewLedgerAccountLiveServices
function currently returns ledgeraccount.AccountLiveServices with Locker set but
Querier nil, which can cause a nil deref if GetBalance is later called; update
either the LedgerStack documentation to explicitly state that GetBalance is
unsupported when using NewLedgerAccountLiveServices, or (preferred) implement
and wire a small Querier stub that implements the expected Querier interface and
returns a clear "GetBalance not supported" error, then assign that stub to
AccountLiveServices. Locate NewLedgerAccountLiveServices and
ledgeraccount.AccountLiveServices to add the stub assignment (or add the doc
comment on LedgerStack) so callers see an explicit non-nil Querier that fails
fast with a descriptive error instead of panicking.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@AGENTS.md`:
- Line 3: Update the sentence in AGENTS.md to use the hyphenated adjective form
by changing "usage based pricing" to "usage-based pricing" so the line reads:
"OpenMeter is a metering and billing platform with usage-based pricing and
access control." This is a simple text edit to the content string in AGENTS.md.

---

Nitpick comments:
In `@app/common/ledger.go`:
- Around line 44-51: The NewLedgerAccountLiveServices function currently returns
ledgeraccount.AccountLiveServices with Locker set but Querier nil, which can
cause a nil deref if GetBalance is later called; update either the LedgerStack
documentation to explicitly state that GetBalance is unsupported when using
NewLedgerAccountLiveServices, or (preferred) implement and wire a small Querier
stub that implements the expected Querier interface and returns a clear
"GetBalance not supported" error, then assign that stub to AccountLiveServices.
Locate NewLedgerAccountLiveServices and ledgeraccount.AccountLiveServices to add
the stub assignment (or add the doc comment on LedgerStack) so callers see an
explicit non-nil Querier that fails fast with a descriptive error instead of
panicking.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2a828d1-2388-44aa-902a-9e73f5bfd9e3

📥 Commits

Reviewing files that changed from the base of the PR and between c0eaccc and f5f6a34.

⛔ Files ignored due to path filters (63)
  • go.sum is excluded by !**/*.sum, !**/*.sum
  • openmeter/ent/db/client.go is excluded by !**/ent/db/**
  • openmeter/ent/db/cursor.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ent.go is excluded by !**/ent/db/**
  • openmeter/ent/db/expose.go is excluded by !**/ent/db/**
  • openmeter/ent/db/hook/hook.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/ledgeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgeraccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount/ledgercustomeraccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgercustomeraccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/ledgerdimension.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerdimension_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/ledgerentry.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgerentry_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/ledgersubaccount.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgersubaccount_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/ledgertransaction.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransaction_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup/where.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_create.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_delete.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_query.go is excluded by !**/ent/db/**
  • openmeter/ent/db/ledgertransactiongroup_update.go is excluded by !**/ent/db/**
  • openmeter/ent/db/migrate/schema.go is excluded by !**/ent/db/**
  • openmeter/ent/db/mutation.go is excluded by !**/ent/db/**
  • openmeter/ent/db/paginate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/predicate/predicate.go is excluded by !**/ent/db/**
  • openmeter/ent/db/runtime.go is excluded by !**/ent/db/**
  • openmeter/ent/db/selectedparse.go is excluded by !**/ent/db/**
  • openmeter/ent/db/setorclear.go is excluded by !**/ent/db/**
  • openmeter/ent/db/tx.go is excluded by !**/ent/db/**
📒 Files selected for processing (11)
  • .vscode/settings.json
  • AGENTS.md
  • app/common/ledger.go
  • openmeter/ent/entc.go
  • openmeter/ent/schema/ledger_account.go
  • openmeter/ent/schema/ledger_customer_account.go
  • openmeter/ent/schema/ledger_dimension.go
  • openmeter/ent/schema/ledger_entry.go
  • openmeter/ent/schema/ledger_transaction.go
  • openmeter/ent/schema/ledger_transaction_group.go
  • openmeter/ledger/account.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • .vscode/settings.json

@GAlexIHU
GAlexIHU force-pushed the feat/ledger-provisioning branch from f5f6a34 to b9f812c Compare March 5, 2026 16:01
@GAlexIHU
GAlexIHU force-pushed the feat/ledger-provisioning branch from dd969a6 to 7438e70 Compare March 13, 2026 10:42
GAlexIHU and others added 17 commits March 16, 2026 17:51
- Add LedgerCustomerAccount ent schema (linking table: customer → ledger accounts)
- Run ent codegen for the new entity
- Extend account.Repo/Service with ListAccounts and GetDimensionByKeyAndValue
- Add SubAccountCreatorLister interface; wire self-reference in service constructor
- Add internal dimensionIDer interface for DB ID extraction from dimension objects
- Add CustomerFBOAccountImpl, CustomerReceivableAccountImpl, BusinessAccountImpl
  with find-or-create GetSubAccountForDimensions (currency-only for now, TBD for rest)
- Relax SubAccountDimensionInput.ValidateForAccountType to currency-only
- Add DimensionResolver (ledger/account/resolver.go)
- Rename ledger/customer package to ledger/resolvers; implement full Service
  (CreateCustomerAccounts, GetCustomerAccounts, GetBusinessAccounts)
- Add ledger/resolvers/adapter with ent-backed Repo implementation

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Keep currency-only provisioning explicit while preserving deferred dimensions, and make customer account provisioning transactional to avoid orphaned accounts under concurrent create flows.
turip
turip previously approved these changes Mar 17, 2026
@GAlexIHU
GAlexIHU enabled auto-merge (squash) March 17, 2026 14:56
@GAlexIHU
GAlexIHU merged commit 5aa9cdc into main Mar 17, 2026
24 checks passed
@GAlexIHU
GAlexIHU deleted the feat/ledger-provisioning branch March 17, 2026 15:00

This branch was previously deployed

1 inactive deployment
dev — 58f3673e Deployed Mar 17, 2026 by GAlexIHU via Migration Checks #12589
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/ignore Ignore this change when generating release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants