Skip to content

failed balance assertion explanation could include a breakdown of subaccounts when ==* is used #1535

@lestephane

Description

@lestephane

My understanding is that ==* is very useful to check that virtual / transfer accounts are all zero at the end of the month, or beginning of the year. I call those accounts zerosum accounts.

2021-02-01 Zerosum accounts start the month empty
    ; generated-transaction: ~ monthly from 2021-01-01 to 2022-01-01
    ...
    Transfers                                                     0 ==* 0 EUR
    Transfers                                                     0 ==* 0 USD
    Transfers                                                     0 ==* 0 GBP
    nothing

assertion details:
date:       2021-02-01
account:    Transfers (and subs)
commodity:  EUR
calculated: -22.30000000
asserted:   0
difference: 22.30000000

Then I need to figure out which of the sub-accounts contributed to the assertion failure .

Putting the breakdown of those non-zero subaccount balances would save time.

I started using ==* only this month, and realized how many of my transfers account were non-zero (a typical sign of bugs in my own hledger-flow import scripts). It even found some EUR in subaccounts that were actually named with USD at the end.

Workaround (Edit 2021-04-21)

To find out the culprit(s) (in this example)

hledger bal -I --end 2018-04-02 Transfers: cur:EUR

notice the date is the date from the assertion details + 1 day

(Edit 2021-04-22)

Use reg and slide the date forwards to discover whether the situation 'corrects' itself in time.

hledger reg -I --end 2018-04-15 Transfers: cur:EUR

If not, it's a bug (ie, the journal contains money in a transitory transfer account that is only put in, and
never taken out, or vice versa). If it does correct itself, consider changing the date of that assertions to another
day where there is less noise. Most of the time, the failure will not be a bug, but a transfer that
was still ongoing at the time the balance_assertion is checked (left the source account, but did
not arrive yet in the destination account).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WISHSome kind of improvement request or proposal.cliCommand line parsing, options, arguments and suchlike.journalThe journal file format, and its features.needs-designTo unblock: needs more thought/planning, leading to a spec/planneeds-mockup/screenshotTo unblock: needs a rough mockup, eg in plain text, or a screenshotneeds-testsTo unblock: needs more automated tests or test updates

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions