;dev: change "1.44" to "1.50" in docs and error messages

This commit is contained in:
Simon Michael 2025-06-12 09:30:46 -10:00
parent 0d388a6f93
commit cda62d9a59
3 changed files with 6 additions and 6 deletions

View File

@ -152,8 +152,8 @@ transactionCheckBalanced BalancingOpts{commodity_styles_=_mglobalstyles, txn_bal
++ if bvsumokold then "" else oldbalancingmsg
oldbalancingmsg = unlines [
-- -------------------------------------------------------------------------------
"\nNote, hledger <1.44 accepted this entry because of the global display precision,"
,"but hledger 1.44+ checks more strictly, using the entry's local precision."
"\nNote, hledger <1.50 accepted this entry because of the global display precision,"
,"but hledger 1.50+ checks more strictly, using the entry's local precision."
,"You can use --txn-balancing=old to keep it working, or fix it (recommended);"
,"see 'Transaction balancing' in the hledger manual."
]

View File

@ -89,7 +89,7 @@ import Data.List (union)
-- | How to determine the precision used for checking that transactions are balanced. See #2402.
data TransactionBalancingPrecision =
TBPOld
-- ^ Legacy behaviour, as in hledger <1.44, included to ease upgrades.
-- ^ Legacy behaviour, as in hledger <1.50, included to ease upgrades.
-- use precision inferred from the whole journal, overridable by commodity directive or -c.
-- Display precision is also transaction balancing precision; increasing it can break journal reading.
-- Some valid journals are rejected until commodity directives are added.

View File

@ -1836,14 +1836,14 @@ Especially when it involves costs, which often are not exact, because of repeati
In each commodity, hledger sums the transaction's posting amounts, after converting any with costs;
then it checks if that sum is zero, when rounded to a suitable number of decimal digits - which we call the *balancing precision*.
Since version 1.44, hledger infers balancing precision in each transaction from the amounts in that transaction's journal entry (like Ledger).
Since version 1.50, hledger infers balancing precision in each transaction from the amounts in that transaction's journal entry (like Ledger).
Ie, when checking the balance of commodity A, it uses the highest decimal precision seen for A in the journal entry (excluding cost amounts).
This makes transaction balancing robust; any imbalances must be visibly accounted for in the journal entry,
display precision can be freely increased with `-c`, and compatibility with Ledger and Beancount journals is good.
Note that hledger versions before 1.44 worked differently: they allowed display precision to override the balancing precision.
Note that hledger versions before 1.50 worked differently: they allowed display precision to override the balancing precision.
This masked small imbalances and caused fragility (see issue #2402).
As a result, some journal entries (or CSV rules) that worked with hledger <1.44, are now rejected with an "unbalanced transaction" error.
As a result, some journal entries (or CSV rules) that worked with hledger <1.50, are now rejected with an "unbalanced transaction" error.
If you hit this problem, it's easy to fix:
- You can restore the old behaviour, by adding `--txn-balancing=old` to the command or to your `~/.hledger.conf` file.