test: regenerate snapshots for engine hash, metadata and interpolation - #271
test: regenerate snapshots for engine hash, metadata and interpolation#271robcohen wants to merge 2 commits into
Conversation
rustledger/rustledger#1967. Four snapshots move, and only one of the four is the meta.hash change that prompted this - the other three are engine fixes rustfava had not caught up with. Verified each structurally (compare every JSON leaf path old vs new) rather than eyeballing a single-line diff, because these files are one line each and `git diff` says nothing useful about them. test_internal_api-test_get_ledger_data 62 changed leaves, ALL of them `hash`. test_json_api-test_api-account_report_off_by_one_journal 1 changed leaf, the rendered journal HTML; its own diff is 16 lines, all of them `hash:` values. Both are rustledger/rustledger#1961, which length-prefixes the fields fed into compute_directive_hash, counts collection lengths and presence-tags optionals. It fixed real collisions - most importantly a transaction WITH a payee hashing identically to one WITHOUT, and 2 HOOL {100 USD} hashing identically to 2 HOOL {200 USD}. Every digest changes as a result. test_serialisation-test_serialise_entry_types `number-value: 10 + 10` was captured as '10', now '20'. Not a hash change. The engine now evaluates arithmetic in metadata values. Checked against Python beancount, which gives Decimal('20') - so the old snapshot was pinning a divergence. test_json_api-test_api_errors loses "interpolation failed: multiple postings missing amounts or with unresolved cost specs for currency USD (2 unknowns)". Also not a hash change, and the one worth reading twice: an error DISAPPEARING is what a regression looks like. It is not one. For 2018-07-07 * "a" "b" Assets:Cash -14.00 USD Expenses:Stuff 4.14 Expenses:Stuff the engine used to give up with "2 unknowns". Python beancount solves it - the bare 4.14 takes USD from the balancing currency, leaving 9.86 USD for the empty posting - and reports no error. rustledger now produces exactly the same three postings, so dropping the error moved it toward compatibility rather than away. Full suite: 666 passed, 1 skipped, 100% coverage, against a component built from rustledger main at 058293c7a.
|
CI red here is expected, and it exposes a constraint worth recording: rustfava@main cannot satisfy both its own CI and rustledger's downstream check at the same time right now. The two run against different engines:
All four engine changes these snapshots encode landed after v0.21.0 — the hash change on 2026-08-05, plus the metadata-arithmetic and interpolation fixes. So one set of snapshots cannot match both engines:
Verified rather than inferred: the failing tests on So this PR is correct against rustledger main and cannot go green until Nothing about the snapshot content is in doubt — the full suite passes locally (666 passed, 100% coverage) against a component built from rustledger main at 058293c7a, and each of the four changes was checked against Python beancount. |
|
Overlap to resolve: #270 already changes #270 (opened 2026-08-02, companion to rustledger/rustledger#1921) does that one file with the fuller rationale for why the interpolation error was wrong. This PR does the same file plus the three the So this is a strict superset with identical content on the shared file, and both are blocked by the same thing — the released-component pin described above, which is why #270 has been sitting red since 2026-08-02 rather than because anything is wrong with it. Suggest closing #270 in favour of this one so the four snapshots move together, since a partial update leaves rustfava red either way. Happy to do the reverse instead — drop |
Review — the snapshots are pinning something they mask everywhere elseTwo things, one of which would stop beancount#1967 from recurring rather than fixing this instance of it. 1. These snapshots need regenerating again, after rustledger#1984rustledger#1984 (the beancount#1968 decision — metadata becomes part of a directive's identity, plus four fields that reached no digest at all) changes every digest again. The literal hashes pinned here, e.g. "meta":{"filename":"TEST_DATA_DIR/long-example.beancount","hash":"3f43843fea1277977ca64674e0255cf3ac68b8e5900c57a2636d48a197f5569d","lineno":5809}all move. So this PR wants to be regenerated after beancount#1984 lands, not before — it was already waiting on the 2.
|
Resolves the conflict in test_get_ledger_data.json by taking main's version. This branch's update to that file is obsolete: #280 stopped pinning rustledger's directive hash in snapshots at all, so the 62 digests this branch was refreshing no longer appear in the file, and that test now passes against both the pinned release asset and a component built from rustledger main. What remains here is the part #280 could not fix - three snapshots whose expected values genuinely differ between the pinned component and main, so no single committed value is green on both sides. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018bGRsKA42peqSnz4VMreBG
|
Merged main in and dropped this PR's update to #280 stopped pinning rustledger's directive hash in snapshots altogether: the redaction the snapshot machinery already performed required an underscore ( What remains here is the part #280 could not fix — three snapshots whose expected values genuinely differ between the pinned component and
These cannot be green on both sides at once — regenerating them against Note CI here will fail until then, by construction: it runs against the pinned release asset, which still produces the old values. |
Regenerates the four snapshots that rustledger main has moved past. Tracked as
rustledger/rustledger#1967.
Only one of the four is the
meta.hashchange that prompted this. The otherthree are engine fixes rustfava had not caught up with, and two of them are the
failures that have been quietly red on every rustledger PR for a while — they
were never separate bugs.
I compared every JSON leaf path old-vs-new rather than reading the diff, because
these snapshots are a single line each and
git diffsays nothing useful.1–2. The hash change (rustledger/rustledger#1961)
test_get_ledger_datahashaccount_report_off_by_one_journalhash:valuesbeancount#1961 length-prefixes the fields fed into
compute_directive_hash, hashes eachcollection's length, and presence-tags the optionals. It fixed real collisions —
a transaction with a payee hashed identically to one without, and
2 HOOL {100 USD}hashed identically to2 HOOL {200 USD}. Every digestchanges as a result.
3. Metadata arithmetic
number-value: 10 + 10was captured as'10'; it is now'20'. Not a hashchange — the engine evaluates arithmetic in metadata values now. Checked against
Python beancount, which returns
Decimal('20'), so the old snapshot waspinning a divergence.
4. An error disappearing — the one worth reading twice
test_api_errorsloses:An error vanishing is what a regression looks like, so I checked it against
beancount rather than accepting the update. For this fixture:
the engine used to give up with "2 unknowns". Python beancount solves it —
the bare
4.14takesUSDfrom the balancing currency, leaving9.86 USDforthe empty posting — and reports no error at all:
rustledger now produces exactly those three postings. So the error was the
divergence, and dropping it moved toward compatibility.
Verification
Full suite against a component built from rustledger main at
058293c7a: