hledger
hledger copied to clipboard
--alias doesn't interact well with balance assertions and assignments
Occasionally one may want to use --alias to combine different accounts into one. However, if one does this, balance assertions may start to fail because the assertions meant for the original accounts no longer hold for the merged account names.
This issue can be worked around by using --ignore-assertions, so this is not a high priority, but it seems suboptimal. Perhaps account aliases should only be applied after parsing and verifying assertions.
A slightly larger issue arises in that balance assignments will give different values if aliases are applied. This is in some sense worse because the output of the journal will silently be different, rather than raising an ignorable error. However, some people may rely on this functionality to generate different output in different cases. That seems dangerous and probably shouldn't be allowed.
There is some discussion of account aliases' ability to break your journal starting at https://hledger.org/dev/hledger.html#aliases-can-generate-bad-account-names .
They are a powerful sharp tool and I'm not sure it's possible to keep everything working with arbitrary aliases. So I'm not sure this is a bug. I'd be glad to try out alternatives though.
I don't think this a bug (but an example might be useful to get your point across). Maybe the documentation could clarify hledger's order of operations so people can plan accordingly, when using these features together.
+1 to more docs on order of operations and more docs/examples on impact of aliases on balance assertions and balance assignments.