feat: opening-balance pad automation (#7) #14
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-7-opening-balance-pad"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Opening-balance pad automation
First item of the P1 double-entry tier (#7): Beancount
pad/ Ledger balance-assignment.Pad an account to a target balance as-of a date by posting the computed difference
(
delta = target - currentBalance(asOf date)) as a.systemtwo-leg transaction, balancedagainst a pad/equity account (default "Opening Balance Equity"). A zero delta is a no-op.
Idempotent per
(account, date)via apad:content hash, mirroringsetOpeningBalance.Unlike
setOpeningBalance, a caller-supplied pad account is guarded liketxnAdd's offset: itmust differ from the account (else the two legs self-cancel and never reach the target) and
share its currency (else the offset balance is silently corrupted). No schema migration —
reuses
transactions/splits.Surfaces (server-depth, mirroring the P0 features)
Commands.padBalance+Commands.PadOutcomePadBalanceRPC (+ proto messages),WriterExecutor+ service implLedgerClient.padBalance+PadOutcomeInfopropose_pad_balance/commit_pad_balance(money-moving → propose/commit split)Tests
Store (
OpeningBalancePadTests), gRPC (PadBalanceRPCTests), and MCP (LedgerToolRegistryTests)layers — including pad-from-zero, non-zero adjust + passing assertion, no-op, idempotent re-pad,
explicit offset, negative delta, self-offset rejection, currency-mismatch rejection,
and re-pad-collision. Full suite green (
make test, 0 failures).Review
Independent architect review: APPROVE. Independent critic review raised two MAJOR findings on
the custom-offset surface (self-offset silent-wrong-result; currency-mismatch silent-corruption) —
both fixed here with the guards
txnAddalready uses, plus tests.Scope
Delivers exactly one item of #7. The remaining P1 items (budgets/envelopes, pending/cleared,
attachments, bitemporal dates, and the rest) stay open — this does not close #7.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.