Skip to content

ledgermill 0.1.3

Choose a tag to compare

@srod srod released this 03 Nov 07:37
· 120 commits to main since this release
4f88f38

Added

  • load reads several Beancount files, and hledger files together with Beancount files, in one call.
    Each Beancount file is its own ledger (include is still refused) and all the hledger
    files together are one. transactions(), postings() and prices() are merged by date, then by
    the position of the item's file in the list; check() lists each ledger's findings by the position
    of their file; at_cost() and value() are answered per ledger and line up with transactions();
    holdings() adds the rows of the same account and commodity. The several-beancount-files and
    mixed-formats refusals are gone. A set of one ledger answers as before. See
    spec/beancount/several-files.md.
  • Harness: sets of several ledgers are compared with the reference. The reference runs per
    ledger (bean-check and bean-query on each Beancount file, hledger on all the hledger files
    together) and the harness merges the results by the rule of the note with an implementation of its
    own; the wasm loaded with the whole set must give the same transactions, postings(), prices(),
    at_cost(), value() and holdings() (rows of one account and commodity added by value) and the
    same first error. compare.ts has 40 such sets (the several-files probes in every order, the
    rejected and the refused ones, Plainledger's own journals); fuzz.ts --multi writes random sets
    (60 per push, 5,000 in the release gate); the summary has a multi-ledger line. See
    harness/README.md, "Several ledgers".

Fixed

  • A Beancount currency of one capital letter glued to the next character ({2 X}, 1 X,, X;, X at
    the end of a CRLF line or of the file) was accepted; bean-check says Invalid token: 'X}'.
    It is now a parse-error on the line of the letter, the line bean-check gives. A letter followed by a
    space, a tab or the end of the line, or by more currency characters (X1, X.B), is read as before.
    fuzz.ts --beancount now adds X to three journals in ten (seed 411, 1,000 journals: 0 fail; of 300,
    79 use X, 49 accepted by bean-check, 25 refused on the X).
  • A Beancount date or time written with digits other than 0-9 (٢٠٢٦-01-02, time: ١:٢٣) made the
    parser panic, a crash in a browser or an app. It is now a parse-error on its line, the
    line bean-check gives, and format() returns the file unchanged. The fix is in our parser fork
    (ledgermill-beancount-parser 0.16.4). fuzz.ts --beancount now puts such a digit in one journal
    in five.
  • hledger: in a transaction with a balance assignment, the postings are now taken in order of their
    own dates (date: tag or [DATE]). A posting dated before the transaction comes before its
    assignments and undated postings, wherever it is written, as hledger does. It used to be taken in
    the order written, so check() could report a different first failing assertion from hledger's
    (fuzz --multi 500 908, case 289; 0.1.2 did the same). The block itself stays at the
    transaction's date. See spec/hledger/assignment-processing.md.
  • Beancount format(): an account is now read with the character classes bean-format uses. It
    starts with an uppercase letter, a later component with an uppercase letter or a decimal digit
    (5, ٣, 3), and components go on with letters, decimal digits and -. A posting on an
    account with another kind of number in it (Assets:L², Assets:LⅫ) used to be aligned and could
    move the column of the whole file; it is now kept as written, as bean-format does (fuzz
    --beancount 500 905 and 909). See spec/beancount/format.md, "Which characters".
  • The check for a glued one-letter currency (above) made a Beancount load about 15% slower than in
    0.1.2 on the bench ledger. It now reads each line once: on a Pixel 7 Pro, load() and
    transactions() on 10,000 transactions take a median of 505 ms, against 491 ms for 0.1.2 (12
    runs each, alternated).

Release gate

From the release-gate workflow on commit ea9e776 (run 41521006303, 2026-11-02), CI on the same
commit (run 41513527166), and the owner's own runs.

  • Random hledger journals (5,000): 0 mismatches (2,308 that hledger accepts; the rest rejected by
    both, 43 skipped, all conversion-postings)
  • Random Beancount journals (5,000): 0 mismatches (3,735 that bean-check accepts)
  • Random price networks (5,000): 0 mismatches
  • Random Beancount journals with pairs priced both ways (5,000): 0 mismatches
  • Random sets of several ledgers (5,000, new in this gate): 0 mismatches (2,259 sets the reference
    accepts; 63 skipped, all conversion-postings)
  • Corpus comparison: 12,582 pass, 0 fail, 47 skip
  • Desktop bench against 0.1.2 from npm (CI runner, 10,000 transactions): every operation within
    0.78–1.07× of 0.1.2 (the 0.78 is Beancount prices, at 0.12 ms; the 1.07 is Beancount format,
    452 to 483 ms); load+transactions 95.9 ms (hledger), 138.0 ms (Beancount); start 20.6 ms
  • Stress test, 100,000 transactions: ok, no crash (peak wasm memory 930 MB hledger, 549 MB Beancount)
  • Similarity check score: max 0.089 (JPlag against rustledger 0.24.0; fail at 0.15), 0 fail,
    8 warn; copydetect max 0.275 (information only)
  • Real journals: pass (21 pass, 0 fail)
  • Device targets: not met (Beancount load+transactions on a Pixel 7 Pro: median 505 ms over 12 runs,
    worst of 3 above 500 ms in 3 of 4 rounds; 0.1.2 on the same phone, alternated: median 491 ms, also
    above 500 ms in 3 of 4 rounds). Every other target met: hledger load+transactions worst 312 ms,
    start 19 ms, value 61 ms, holdings 36 ms, memory 48.2 MB hledger and 43.4 MB Beancount