Repository navigation
feat(ledger): accounts and transactions - #3898
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
🚥 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 unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (57)
go.sumis excluded by!**/*.sum,!**/*.sumopenmeter/ent/db/client.gois excluded by!**/ent/db/**openmeter/ent/db/cursor.gois excluded by!**/ent/db/**openmeter/ent/db/ent.gois excluded by!**/ent/db/**openmeter/ent/db/expose.gois excluded by!**/ent/db/**openmeter/ent/db/hook/hook.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_update.gois excluded by!**/ent/db/**openmeter/ent/db/migrate/schema.gois excluded by!**/ent/db/**openmeter/ent/db/mutation.gois excluded by!**/ent/db/**openmeter/ent/db/paginate.gois excluded by!**/ent/db/**openmeter/ent/db/predicate/predicate.gois excluded by!**/ent/db/**openmeter/ent/db/runtime.gois excluded by!**/ent/db/**openmeter/ent/db/selectedparse.gois excluded by!**/ent/db/**openmeter/ent/db/setorclear.gois excluded by!**/ent/db/**openmeter/ent/db/tx.gois excluded by!**/ent/db/**tools/migrate/migrations/atlas.sumis excluded by!**/*.sum,!**/*.sum
📒 Files selected for processing (54)
AGENTS.mdopenmeter/ent/entc.goopenmeter/ent/schema/ledger_account.goopenmeter/ent/schema/ledger_dimension.goopenmeter/ent/schema/ledger_entry.goopenmeter/ent/schema/ledger_transaction.goopenmeter/ent/schema/ledger_transaction_group.goopenmeter/ledger/account.goopenmeter/ledger/account/acc_customer.goopenmeter/ledger/account/account.goopenmeter/ledger/account/adapter/account.goopenmeter/ledger/account/adapter/dimension.goopenmeter/ledger/account/adapter/repo.goopenmeter/ledger/account/adapter/repo_test.goopenmeter/ledger/account/adapter/subaccount.goopenmeter/ledger/account/address.goopenmeter/ledger/account/dimension.goopenmeter/ledger/account/error.goopenmeter/ledger/account/ledger.goopenmeter/ledger/account/repo.goopenmeter/ledger/account/service.goopenmeter/ledger/account/service/service.goopenmeter/ledger/account/subaccount.goopenmeter/ledger/accounts.goopenmeter/ledger/customer/hooks.goopenmeter/ledger/customer/service.goopenmeter/ledger/dimension.goopenmeter/ledger/errors.goopenmeter/ledger/historical/adapter/ledger.goopenmeter/ledger/historical/adapter/ledger_test.goopenmeter/ledger/historical/adapter/repo.goopenmeter/ledger/historical/adapter/sumentries_query.goopenmeter/ledger/historical/entry.goopenmeter/ledger/historical/ledger.goopenmeter/ledger/historical/repo.goopenmeter/ledger/historical/transaction.goopenmeter/ledger/ledger_fx_test.goopenmeter/ledger/ledger_test.goopenmeter/ledger/primitives.goopenmeter/ledger/query.goopenmeter/ledger/transactions/customer.goopenmeter/ledger/transactions/fx.goopenmeter/ledger/transactions/input.goopenmeter/ledger/transactions/template.goopenmeter/ledger/transactions/testutils/anytemplate.goopenmeter/ledger/transactions/testutils/anytransaction.goopenmeter/ledger/validations.gopkg/framework/entutils/entcursor/cursor.gopkg/framework/entutils/entcursor/cursor.tplpkg/framework/entutils/entcursor/cursor_test.gopkg/framework/entutils/testutils/ent1/db/cursor.gopkg/framework/entutils/testutils/ent1/entc.gotools/migrate/migrations/20260218122624_ledger.down.sqltools/migrate/migrations/20260218122624_ledger.up.sql
| @@ -1,9 +1,20 @@ | |||
| # OpenMeter | |||
|
|
|||
| OpenMeter is a metering and billing platform with usage based pricing and access control. | |||
There was a problem hiding this comment.
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.
| 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.
614df30 to
149626a
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
AGENTS.md (1)
3-3:⚠️ Potential issue | 🟡 MinorTiny 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
⛔ Files ignored due to path filters (57)
go.sumis excluded by!**/*.sum,!**/*.sumopenmeter/ent/db/client.gois excluded by!**/ent/db/**openmeter/ent/db/cursor.gois excluded by!**/ent/db/**openmeter/ent/db/ent.gois excluded by!**/ent/db/**openmeter/ent/db/expose.gois excluded by!**/ent/db/**openmeter/ent/db/hook/hook.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_update.gois excluded by!**/ent/db/**openmeter/ent/db/migrate/schema.gois excluded by!**/ent/db/**openmeter/ent/db/mutation.gois excluded by!**/ent/db/**openmeter/ent/db/paginate.gois excluded by!**/ent/db/**openmeter/ent/db/predicate/predicate.gois excluded by!**/ent/db/**openmeter/ent/db/runtime.gois excluded by!**/ent/db/**openmeter/ent/db/selectedparse.gois excluded by!**/ent/db/**openmeter/ent/db/setorclear.gois excluded by!**/ent/db/**openmeter/ent/db/tx.gois excluded by!**/ent/db/**tools/migrate/migrations/atlas.sumis excluded by!**/*.sum,!**/*.sum
📒 Files selected for processing (54)
AGENTS.mdopenmeter/ent/entc.goopenmeter/ent/schema/ledger_account.goopenmeter/ent/schema/ledger_dimension.goopenmeter/ent/schema/ledger_entry.goopenmeter/ent/schema/ledger_transaction.goopenmeter/ent/schema/ledger_transaction_group.goopenmeter/ledger/account.goopenmeter/ledger/account/acc_customer.goopenmeter/ledger/account/account.goopenmeter/ledger/account/adapter/account.goopenmeter/ledger/account/adapter/dimension.goopenmeter/ledger/account/adapter/repo.goopenmeter/ledger/account/adapter/repo_test.goopenmeter/ledger/account/adapter/subaccount.goopenmeter/ledger/account/address.goopenmeter/ledger/account/dimension.goopenmeter/ledger/account/error.goopenmeter/ledger/account/ledger.goopenmeter/ledger/account/repo.goopenmeter/ledger/account/service.goopenmeter/ledger/account/service/service.goopenmeter/ledger/account/subaccount.goopenmeter/ledger/accounts.goopenmeter/ledger/customer/hooks.goopenmeter/ledger/customer/service.goopenmeter/ledger/dimension.goopenmeter/ledger/errors.goopenmeter/ledger/historical/adapter/ledger.goopenmeter/ledger/historical/adapter/ledger_test.goopenmeter/ledger/historical/adapter/repo.goopenmeter/ledger/historical/adapter/sumentries_query.goopenmeter/ledger/historical/entry.goopenmeter/ledger/historical/ledger.goopenmeter/ledger/historical/repo.goopenmeter/ledger/historical/transaction.goopenmeter/ledger/ledger_fx_test.goopenmeter/ledger/ledger_test.goopenmeter/ledger/primitives.goopenmeter/ledger/query.goopenmeter/ledger/transactions/customer.goopenmeter/ledger/transactions/fx.goopenmeter/ledger/transactions/input.goopenmeter/ledger/transactions/template.goopenmeter/ledger/transactions/testutils/anytemplate.goopenmeter/ledger/transactions/testutils/anytransaction.goopenmeter/ledger/validations.gopkg/framework/entutils/entcursor/cursor.gopkg/framework/entutils/entcursor/cursor.tplpkg/framework/entutils/entcursor/cursor_test.gopkg/framework/entutils/testutils/ent1/db/cursor.gopkg/framework/entutils/testutils/ent1/entc.gotools/migrate/migrations/20260224152448_ledger.down.sqltools/migrate/migrations/20260224152448_ledger.up.sql
149626a to
2774b26
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
AGENTS.md (1)
3-3:⚠️ Potential issue | 🟡 MinorQuick 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 readabilityLine 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
⛔ Files ignored due to path filters (64)
go.sumis excluded by!**/*.sum,!**/*.sumopenmeter/ent/db/client.gois excluded by!**/ent/db/**openmeter/ent/db/cursor.gois excluded by!**/ent/db/**openmeter/ent/db/ent.gois excluded by!**/ent/db/**openmeter/ent/db/expose.gois excluded by!**/ent/db/**openmeter/ent/db/hook/hook.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount/ledgercustomeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_update.gois excluded by!**/ent/db/**openmeter/ent/db/migrate/schema.gois excluded by!**/ent/db/**openmeter/ent/db/mutation.gois excluded by!**/ent/db/**openmeter/ent/db/paginate.gois excluded by!**/ent/db/**openmeter/ent/db/predicate/predicate.gois excluded by!**/ent/db/**openmeter/ent/db/runtime.gois excluded by!**/ent/db/**openmeter/ent/db/selectedparse.gois excluded by!**/ent/db/**openmeter/ent/db/setorclear.gois excluded by!**/ent/db/**openmeter/ent/db/tx.gois excluded by!**/ent/db/**tools/migrate/migrations/atlas.sumis excluded by!**/*.sum,!**/*.sum
📒 Files selected for processing (58)
AGENTS.mdopenmeter/ent/entc.goopenmeter/ent/schema/ledger_account.goopenmeter/ent/schema/ledger_customer_account.goopenmeter/ent/schema/ledger_dimension.goopenmeter/ent/schema/ledger_entry.goopenmeter/ent/schema/ledger_transaction.goopenmeter/ent/schema/ledger_transaction_group.goopenmeter/ledger/account.goopenmeter/ledger/account/acc_customer.goopenmeter/ledger/account/account.goopenmeter/ledger/account/adapter/account.goopenmeter/ledger/account/adapter/dimension.goopenmeter/ledger/account/adapter/repo.goopenmeter/ledger/account/adapter/repo_test.goopenmeter/ledger/account/adapter/subaccount.goopenmeter/ledger/account/address.goopenmeter/ledger/account/dimension.goopenmeter/ledger/account/error.goopenmeter/ledger/account/ledger.goopenmeter/ledger/account/repo.goopenmeter/ledger/account/resolver.goopenmeter/ledger/account/service.goopenmeter/ledger/account/service/service.goopenmeter/ledger/account/subaccount.goopenmeter/ledger/accounts.goopenmeter/ledger/dimension.goopenmeter/ledger/errors.goopenmeter/ledger/historical/adapter/ledger.goopenmeter/ledger/historical/adapter/ledger_test.goopenmeter/ledger/historical/adapter/repo.goopenmeter/ledger/historical/adapter/sumentries_query.goopenmeter/ledger/historical/entry.goopenmeter/ledger/historical/ledger.goopenmeter/ledger/historical/repo.goopenmeter/ledger/historical/transaction.goopenmeter/ledger/ledger_fx_test.goopenmeter/ledger/ledger_test.goopenmeter/ledger/primitives.goopenmeter/ledger/query.goopenmeter/ledger/resolvers/adapter/repo.goopenmeter/ledger/resolvers/hooks.goopenmeter/ledger/resolvers/repo.goopenmeter/ledger/resolvers/service.goopenmeter/ledger/transactions/customer.goopenmeter/ledger/transactions/fx.goopenmeter/ledger/transactions/input.goopenmeter/ledger/transactions/template.goopenmeter/ledger/transactions/testutils/anytemplate.goopenmeter/ledger/transactions/testutils/anytransaction.goopenmeter/ledger/validations.gopkg/framework/entutils/entcursor/cursor.gopkg/framework/entutils/entcursor/cursor.tplpkg/framework/entutils/entcursor/cursor_test.gopkg/framework/entutils/testutils/ent1/db/cursor.gopkg/framework/entutils/testutils/ent1/entc.gotools/migrate/migrations/20260226124536_ledger.down.sqltools/migrate/migrations/20260226124536_ledger.up.sql
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/common/ledger.go (1)
18-20:LedgerStackis labeled “full,” butAccountLiveServicesis intentionally partial.Line 19 says this is the full ledger stack, while Line 46 documents that
Querieris 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
⛔ Files ignored due to path filters (1)
tools/migrate/migrations/atlas.sumis excluded by!**/*.sum,!**/*.sum
📒 Files selected for processing (18)
.vscode/settings.jsonapp/common/ledger.goopenmeter/ledger/account/service/service.goopenmeter/ledger/historical/ledger.goopenmeter/ledger/ledger_fx_test.goopenmeter/ledger/ledger_test.goopenmeter/ledger/resolvers/service.goopenmeter/ledger/testutil/generate.goopenmeter/ledger/testutil/wire.goopenmeter/ledger/testutil/wire_gen.goopenmeter/ledger/transactions/customer.goopenmeter/ledger/transactions/fx.goopenmeter/ledger/transactions/input.goopenmeter/ledger/transactions/resolve.goopenmeter/ledger/transactions/template.goopenmeter/ledger/transactions/testutils/anytransaction.gotools/migrate/migrations/20260226142755_ledger_customer_accounts.down.sqltools/migrate/migrations/20260226142755_ledger_customer_accounts.up.sql
9f71f3f to
f5f6a34
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
AGENTS.md (1)
3-3:⚠️ Potential issue | 🟡 MinorGrammar 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
Querieris nil (only needed forGetBalance, not the commit path). That said, if someone later callsGetBalancethrough this wiring, they'll hit a nil pointer dereference at runtime.A couple of options to consider:
- Add a brief note in the
LedgerStackdoc comment warning thatGetBalanceisn't supported via this wiring.- 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
⛔ Files ignored due to path filters (63)
go.sumis excluded by!**/*.sum,!**/*.sumopenmeter/ent/db/client.gois excluded by!**/ent/db/**openmeter/ent/db/cursor.gois excluded by!**/ent/db/**openmeter/ent/db/ent.gois excluded by!**/ent/db/**openmeter/ent/db/expose.gois excluded by!**/ent/db/**openmeter/ent/db/hook/hook.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/ledgeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgeraccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount/ledgercustomeraccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgercustomeraccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/ledgerdimension.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerdimension_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/ledgerentry.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgerentry_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/ledgersubaccount.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgersubaccount_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/ledgertransaction.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransaction_update.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/ledgertransactiongroup.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup/where.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_create.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_delete.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_query.gois excluded by!**/ent/db/**openmeter/ent/db/ledgertransactiongroup_update.gois excluded by!**/ent/db/**openmeter/ent/db/migrate/schema.gois excluded by!**/ent/db/**openmeter/ent/db/mutation.gois excluded by!**/ent/db/**openmeter/ent/db/paginate.gois excluded by!**/ent/db/**openmeter/ent/db/predicate/predicate.gois excluded by!**/ent/db/**openmeter/ent/db/runtime.gois excluded by!**/ent/db/**openmeter/ent/db/selectedparse.gois excluded by!**/ent/db/**openmeter/ent/db/setorclear.gois excluded by!**/ent/db/**openmeter/ent/db/tx.gois excluded by!**/ent/db/**
📒 Files selected for processing (11)
.vscode/settings.jsonAGENTS.mdapp/common/ledger.goopenmeter/ent/entc.goopenmeter/ent/schema/ledger_account.goopenmeter/ent/schema/ledger_customer_account.goopenmeter/ent/schema/ledger_dimension.goopenmeter/ent/schema/ledger_entry.goopenmeter/ent/schema/ledger_transaction.goopenmeter/ent/schema/ledger_transaction_group.goopenmeter/ledger/account.go
🚧 Files skipped from review as they are similar to previous changes (1)
- .vscode/settings.json
f5f6a34 to
b9f812c
Compare
dd969a6 to
7438e70
Compare
- 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.
2545afb to
383e6be
Compare
Overview
Fixes #(issue)
Notes for reviewer
Summary by CodeRabbit
Documentation
Chores
Refactor