Skip to content

test(returns): cross-validate XIRR against an independent solver - #1848

Merged
robcohen merged 2 commits into
mainfrom
chore/returns-reference-validation
Jul 22, 2026
Merged

robcohen merged 2 commits into
mainfrom
chore/returns-reference-validation

Conversation

@robcohen

Copy link
Copy Markdown
Member

What

Closes the one open Phase-1 validation item from #1814: cross-check the
investment-returns math against a reference implementation.

Adds xirr_matches_independent_reference in rustledger-returns — five diverse
cash-flow shapes pinned against values computed by a deliberately independent
pure-Python bisection root-finder of the same canonical definition rledger
implements (NPV(r) = Σ cfᵢ/(1+r)^(dᵢ/365), actual/365 from the earliest flow).

The reference solver is committed as crates/rustledger-returns/reference/xirr_reference.py
(stdlib-only, re-runnable) so the golden values are reproducible provenance
rather than magic numbers.

Why this is a real cross-check

XIRR was already validated against the canonical spreadsheet =XIRR()
example (excel_xirr_reference_example → 0.373362535), and TWR against two
hand-derived unit-value chains (20% and 15.5%). But:

  • the XIRR coverage was a single shape, and
  • both were checked only by rledger's own Newton/Brent solver.

Bisection is a different algorithm — a bug in one solver (bad derivative,
bracket, damping) does not reproduce in the other — so agreement is evidence
about the definition, not a shared quirk. The new scenarios broaden coverage
to an intermediate distribution, an outright loss, a second contribution, and a
sub-year (annualization-extrapolated) hold. rledger matches every value to
within 1e-6.

The reference self-anchors on a clean 365-day −1000/+1100 series that yields
exactly 0.10 — the same answer a spreadsheet gives — so the reference itself
is not free-floating.

Why no new TWR test

TWR is a deterministic product of sub-period ratios, not a root-find, so there
is no solver-divergence risk to catch. Its two existing golden cases derive the
expected chain by hand from known valuations, which is already the strongest
check available for that arithmetic. Manufacturing an "independent" Python
re-multiplication would restate the same hand math without adding signal. This
is called out so a reviewer doesn't read the XIRR-only scope as an oversight.

How to test

cargo test -p rustledger-returns xirr_matches_independent_reference
python3 crates/rustledger-returns/reference/xirr_reference.py   # regenerates the golden values

Notes

  • The Rust test embeds static values and never shells out to Python, so it stays
    fully hermetic — no availability gate, no silent-skip risk (per the
    CLAUDE.md rule on availability-gated tests).
  • Test-only + a reference script; no production code changes. rustledger-returns
    suite: 59 passing (was 58).

The one open Phase-1 validation item from #1814 was to cross-check the
returns math against a reference implementation. XIRR was already pinned
against the canonical spreadsheet =XIRR() example (excel_xirr_reference_example)
and TWR against two hand-derived unit-value chains, but the XIRR coverage was a
single shape and both were checked only by rledger's own Newton/Brent solver.

Add `xirr_matches_independent_reference`: five diverse cash-flow shapes (an
intermediate distribution, an outright loss, a second contribution, and a
sub-year annualization-extrapolated hold) pinned against values computed by a
deliberately independent pure-Python bisection root-finder of the same
actual/365 NPV=0 definition. Bisection is a different algorithm than Newton/
Brent, so agreement is evidence about the definition rather than a shared quirk;
rledger matches every value to within 1e-6.

The reference solver is committed as reference/xirr_reference.py (stdlib only,
re-runnable) so the golden values are reproducible provenance, not magic
numbers. It self-anchors on a clean 365-day -1000/+1100 series yielding exactly
0.10 — the same answer a spreadsheet gives.

The Rust test embeds static values and never shells out, so it stays hermetic
(no availability gate, no silent-skip risk).
@robcohen
robcohen requested a review from a team as a code owner July 22, 2026 02:49
Copilot AI review requested due to automatic review settings July 22, 2026 02:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional validation for rustledger-returns’ XIRR implementation by pinning several cash-flow scenarios against golden rates generated by a deliberately independent Python bisection solver, strengthening confidence in the definition rather than a particular root-finding algorithm.

Changes:

  • Add xirr_matches_independent_reference test with five cash-flow shapes and 1e-6 agreement threshold.
  • Add a stdlib-only Python reference solver script (reference/xirr_reference.py) to regenerate the embedded golden values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/rustledger-returns/src/lib.rs Adds a new Rust unit test validating XIRR outputs against independently generated golden values across multiple scenarios.
crates/rustledger-returns/reference/xirr_reference.py Adds a rerunnable Python bisection-based XIRR reference implementation used to produce/reproduce the test’s golden values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Tool Time Memory
rustledger 35.2ms ± 0.3ms 23.7 MB
beancount 766.2ms ± 12.6ms 50.5 MB
Comparison 21.8x faster 2.1x less

vs main branch (2026-07-21)

Metric main this PR Change
Time 33.5ms 35.2ms +5.1% 🟡
10K transactions · 5 runs, 2 warmup · hyperfine
What do these numbers mean?
  • Time: Wall-clock time to parse and validate the ledger (± std dev)
  • Memory: Peak resident set size (RSS)
  • vs main: Compared to latest nightly benchmark on main branch

@github-actions

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100%
Full AST Match 100%
Total Files 812
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

Copilot review: xirr() returns None when the NPV never crosses zero on the
bracket; the sanity assert and the per-scenario npv(r, flows) call would then
raise a cryptic TypeError. The committed scenarios all bracket cleanly so this
never fires for them, but the script is a re-runnable reference others may edit
— add explicit `is not None` guards so a degenerate/edited series fails with a
clear message instead. No change to the golden values.
Copilot AI review requested due to automatic review settings July 22, 2026 03:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@robcohen
robcohen merged commit bb1cebd into main Jul 22, 2026
54 checks passed
@robcohen
robcohen deleted the chore/returns-reference-validation branch July 22, 2026 04:02
robcohen added a commit that referenced this pull request Jul 22, 2026
Eighth review pass (a coherence review of the strict-clean revert; the refuted
finding confirmed the strict behavior is intended). Three items:

- Elided un-booked postings silently understated (CONFIRMED correctness). The
  strict-clean contract is "un-booked ledger -> clean Err", and an unmatched
  reduction already surfaces via the fallible realization. But `try_apply` SKIPS
  a non-Complete (elided / uninterpolated) posting, so an un-booked in-scope
  investment leg was dropped from the valuation with no error — a silently
  understated figure, the exact thing strict-clean exists to prevent. Add an
  `apply_booked` helper (used at all three realization sites) that rejects a
  transaction with any elided posting as `UnbookedInput`, alongside the existing
  over-sell detection. Test `unbooked_elided_posting_errors_not_understates`.

- The `twr` eager `UnbookedInput` scan lived in the shared `twr_from_values` hot
  path, where it's inert for `compute_returns` (protected by its eager
  `end_value?`). Moved it to the standalone public `twr` wrapper — the only path
  that needs it — off the per-scope hot path. The unit test is retargeted from
  `twr_from_values` to the public `twr`.

- Fixed the stale module `# Input contract` doc that still claimed un-booked
  reductions are "silently dropped into wrong inventory" — they now surface as
  `UnbookedInput`.

(Out of scope: the reviewer also flagged the #1848 XIRR golden constants having
no CI guard re-running the reference script — pre-existing on main, not this PR.)

Tests: returns 62; component 7 + parity 24; CLI 16. clippy + doc clean.
robcohen added a commit that referenced this pull request Jul 22, 2026
…1847) (#1849)

* feat(returns): expose session.returns on the WIT component (#1847)

Phase 3 of the investment-returns feature (#1814): add a typed `returns`
operation to the `session` resource on the WIT contract
(`rustledger:[email protected]` -> `@3.9.0`), so an embedder (rustfava) can chart
money-weighted (XIRR) and time-weighted (TWR) returns over a held ledger
without re-deriving cash-flow extraction or the returns math.

`SessionState::returns` reuses the same booked, pad-expanded stream `query`
builds (the returns engine's input contract, via the `padded` cell) and builds
the `PriceDatabase` the same way the CLI's `report returns` does, then calls
`rustledger_returns::compute_returns` — the boundary runs the exact engine over
identical inputs, so it cannot drift from the CLI. `investments`/`income` are
the scope prefixes; `currency` empty falls back to the first
`operating_currency`; `end-date` is required (a component has no clock).
Fallible on bad date / no currency / load errors / unpriceable flow.

The `PriceDbOracle` adapter is a deliberate, compiler-enforced duplicate of the
CLI's (the returns crate is a leaf without a query dep), documented at both
sites per canonical-function discipline.

Drift guards both directions: a native test pins `session.returns` against a
direct `compute_returns` over the same inputs, and a wasm parity test pins the
component's result against the native engine across the boundary (decimals exact,
rates within tolerance for wasm-vs-native float). API_VERSION bumped in lockstep
(the version-parity test + CI wit-version-gate enforce it).

The speculative BQL `#returns` table (the issue's second bullet) stays deferred
until composable-query demand appears. Advances #1847.

* refactor(returns): share one returns composition across CLI and component

Addresses the deep review of the session.returns PR:

- Extract the returns wiring into `rustledger_query::{scope_returns,
  scopes_returns}` (Finding 3). The CLI's `report returns` and the component's
  `session.returns` both duplicated the same composition — build the
  PriceDatabase, adapt it to the returns engine's PriceOracle, build the Scope,
  call compute_returns — each with its own `PriceDbOracle` copy. Both surfaces
  now call the single shared helper, so they cannot compute different figures
  for the same ledger, and there is one price-oracle adapter instead of two.
  The drift guards now pin the component against that shared helper (i.e.
  against the CLI's returns path), not against a private re-implementation.

- session.returns no longer traps on recovered load errors (Finding 1). The
  resource's documented contract is that load failures surface via
  info().errors, not a trap (see from-file), and session.format — the sibling
  result<_,string> op — already computes over the held directives regardless.
  returns now matches that convention and the CLI report, which prints load
  errors to stderr and still renders. The WIT/# Errors docs and the load-error
  test are updated to the proceed-and-surface behavior.

- Document that the returns-result decimal fields are RAW, full-precision
  strings (matching amount.number), NOT display-formatted like the CLI's
  rendered report — no thousands separators or precision padding; the host
  formats for its locale (Finding 2). This is the correct convention for a
  programmatic surface, so it is documented rather than changed.

- Note that the usize->u32 cash_flows clamp is unreachable defensive code, not
  a lossy path (Finding 4).

Finding 5 (the parity test skips without the wasm artifact) follows the
file-wide convention and is exercised by the "Component Parity (wasip2)" CI job.

Tests: CLI returns 15 unit + 1 integration; component 28 native (incl. the
proceed-on-recovered-errors case) + the wasm parity drift guard; query 170.

* fix(returns): guard session.returns against booking-errored ledgers

Second review pass on #1849 found that dropping the load-error guard (the
first-pass response to "match the CLI / the not-a-trap convention") exposed a
real hazard: the loader re-merges a booking-FAILED transaction into the held
directives in its un-booked shape, and session.returns REALIZES inventory over
them. Realizing an un-booked reduction (over-sell with no matching lot)
`debug_assert`-traps the booking engine in debug and silently over-sells in
release — a wrong figure a host would chart as truth.

The correct reading of the WIT contract's "load failures surface via
info().errors, NOT a trap" is that a realizing op must NOT risk that trap:
returning a clean `Err` IS surfacing, not trapping. `session.query` guards for
exactly this reason; `format`/`filter`/`clamp` don't realize, so they proceed.
So reinstate the guard — with a comment explaining why returns follows query,
not format — and add a regression test on an actual booking failure (buy 5,
sell 10 with empty cost) that would abort the native test without the guard.

Also from the review:
- Centralize the price-oracle adapter as `PriceDatabase::as_oracle()`, removing
  the third (CLI-test) copy; the shared helpers and the CLI test now share one
  adapter (Finding 8).
- Add the missing `# Errors` section to `scopes_returns` (Finding 6).

Findings 2 (drift guard scoped to the shared helper) and 5 (per-scope
PriceDatabase rebuild) are unchanged: the guard pins component→shared-helper
which the CLI also calls, and the single-scope rebuild is not a regression (the
component builds the index per call as it did before the refactor).

Tests: component 29 native (incl. the booking-error trap guard) + parity 24;
CLI returns 15+1; query 170. clippy + doc clean.

* fix(returns): make the returns realization refuse unbooked input, not trap

Third review pass found the reinstated guard was incomplete: it only covers
from_source/from_file sessions. `from_entries`/`from_entries_with_options` set
`errors: vec![]` and don't run booking, so an over-sell in held entries bypassed
the guard and reached the realization; and the CLI `report returns` has the
identical exposure with no guard at all. The root cause is that the returns
realization traps (debug) / silently over-sells (release) on the un-booked
transactions the loader re-merges into `Ledger.directives`.

Fix it at the source, closing all three paths (from_source, from_entries, CLI):

- rustledger-booking: add a fallible `BookingEngine::try_apply` that returns
  `Err` the moment a reduction has no matching lot, instead of `debug_assert`ing
  / ignoring. `apply` keeps its exact contract (ignore-and-continue), now sharing
  one `apply_posting` core with `try_apply` so the two can't drift.
- rustledger-returns: the three realization sites use `try_apply` and surface a
  new `ExtractError::UnbookedInput`; compute_returns / twr / *_multi now return a
  clean `Err` on a contract-violating stream rather than trapping. The now-stale
  `# Panics` sections are reframed accordingly.

With the engine fix the trap is impossible, so both surfaces error cleanly: the
component's guard stays (early-out + parity with `query`) but is no longer the
only thing standing between an un-booked entry set and a wasm trap.

Regression tests that would ABORT without the fix: returns-crate
`unbooked_oversell_errors_not_traps`; component
`returns_from_entries_oversell_errors_not_traps` (the bypassed from_entries
path); CLI `compute_group_errors_on_unbooked_oversell_not_traps` (the
pre-existing CLI exposure).

Tests: booking 110, returns 60, loader 95, validate 103 (apply refactor
downstream-safe); component 7 returns + parity 24; CLI 16+1; query 170. clippy +
doc clean.

* fix(returns): surface UnbookedInput from twr eagerly, not as Ok(None)

Fourth review pass. The booking-engine refactor's blast radius came back clean,
but two engine-fix interactions survived:

- Public `twr` could swallow `UnbookedInput` into `Ok(None)`. `twr_from_values`
  short-circuits to `Ok(None)` at an earlier non-positive / wiped-out sub-period
  (a documented lazy behavior for MissingPrice), which can return before the loop
  reaches a later un-booked flow value — so a broken ledger was reported as
  "n/a" instead of erroring. `compute_returns` is protected by its eager terminal
  valuation, but standalone `twr` (public) was not. Add an eager scan that
  surfaces `UnbookedInput` before the lazy short-circuits; `MissingPrice` stays
  lazy (a later price gap is genuinely irrelevant once the chain is undefined).
  Regression test `twr_surfaces_unbooked_despite_earlier_short_circuit`.

- Doc accuracy: `scope_returns`' stale `# Panics` (the engine now returns
  `Err`, doesn't panic; the cross-referenced section was removed) and
  `scopes_returns`' `# Errors` (omitted `UnbookedInput`) are corrected. Both now
  state that `UnbookedInput` is NOT per-scope: the booking pass is shared, so a
  contract-violating ledger fails every scope — `report returns --by-group`
  errors wholesale rather than rendering a partial report over a broken ledger,
  consistent with single-scope `report returns`. This is deliberate (a partial
  report would need per-scope booking isolation and mask a broken ledger), now
  documented on `compute_returns_multi`.

Tests: returns 61; component 7 returns; CLI 16. clippy + doc clean. No
production change outside rustledger-returns (twr) + docs.

* fix(returns): scope-filter the realization; make returns lenient like fava

Fifth review pass. The booking-engine change came back clean; the surviving
correctness item was that the shared realization books EVERY account, so
switching to try_apply made an over-sell in an account OUTSIDE the returns scope
abort the whole report — where release builds previously ignored it and still
valued the in-scope accounts.

Prior art decides it: the beancount ecosystem is lenient — the loader always
returns entries alongside errors, and fava renders reports over
loaded-with-errors entries with errors surfaced separately. rledger mirrors this
(`check` is the strict gate; `report returns` prints errors and proceeds). So a
booking error OUTSIDE the returns scope should not block an in-scope report.

- rustledger-booking: expose `BookingEngine::try_apply_posting` (the per-posting
  core `apply`/`try_apply` already share), so a consumer can realize a subset of
  a transaction's postings.
- rustledger-returns: the three realization sites now book only the postings
  they will VALUE (in-scope Investment accounts) via a new `apply_scoped` helper.
  An over-sell outside the scope is skipped, not fatal; an in-scope over-sell
  still surfaces as `UnbookedInput` (its valuation would otherwise be wrong).
  Clean-ledger output is byte-identical (out-of-scope postings never touched the
  valued inventories). Test: `out_of_scope_oversell_does_not_abort_report`.

- rustledger-ffi-component: with the engine trap-safe and out-of-scope errors
  skipped, the `self.errors` guard made session.returns STRICTER than the CLI
  (refusing on any load error). Remove it so the component computes over the held
  directives exactly as the CLI renders — the fava model, errors via
  info().errors — with the engine providing safety. session.returns and CLI
  `report returns` now agree on every ledger, broken or not. Component tests
  updated: proceeds over a recovered parse error; an in-scope over-sell still
  errs (now via the engine, no guard).

Also clarified (from the review) that the twr eager UnbookedInput scan is inert
for compute_returns (protected by its eager current_value) and kept only for the
standalone public twr contract.

Tests: booking 110, returns 62, loader 95, validate 103; component 7 + parity
24; CLI returns 16. clippy + doc clean.

* fix(returns): isolate --by-group over-sells per scope; guard elided input

Sixth review pass. The scope-filter's fundamental soundness held (an in-scope
account's lot-matching never depends on a skipped out-of-scope posting — lots
are per-account), but three real issues surfaced:

- --by-group could error a CLEAN group. `investment_values_multi` books the
  UNION of every scope's investment accounts in one shared pass, so an over-sell
  in group A's account errored and stamped `UnbookedInput` into EVERY scope —
  including a clean, disjoint group B that values fine on its own (and does via
  the single-scope path and the unsorted fallback). Fix: on a booking error the
  shared pass now degrades to the per-scope realization (exactly the unsorted
  fallback), so only the group owning the un-booked reduction errors. Test
  `multi_isolates_oversell_to_the_owning_scope` (date-sorted, so it exercises
  the shared pass, not the fallback).

- Silent understatement on elided in-scope input. `try_apply_posting` skips a
  posting whose units aren't `Complete`, so an un-booked in-scope leg (elided,
  not yet interpolated — reachable via a raw `from_entries` set) was dropped
  from the valuation with no error. `apply_scoped` now surfaces an in-scope
  non-`Complete` posting as `UnbookedInput` rather than understating. Test
  `elided_in_scope_posting_errors_not_understates`.

- Dead code. `BookingEngine::try_apply` (whole-transaction) had zero callers
  after the pass-5 switch to per-posting `try_apply_posting`; removed, and the
  two doc cross-references + the `apply` debug-assert hint repointed.

Clean-ledger output stays byte-identical (out-of-scope postings never touched
the valued inventories; the union pass equals per-scope on a clean stream).

Tests: booking 110, returns 64, loader 95, validate 103; component 7 + parity
24; CLI 16. clippy + doc clean.

* refactor(returns): strict-clean broken-ledger behavior (safer than beangrow)

Seventh review pass exposed that the passes 5-6 broken-ledger *leniency* was a
rabbit hole: the per-scope --by-group isolation never even reached the CLI (the
TOTAL-first `?` collapsed it), the elided-units guard over-rejected an in-scope
residual of an out-of-scope failure, and the machinery kept spawning edges.

Grounded in prior art: beangrow (the closest analog) is maximally lenient — it
`load_file`s and discards the errors list entirely, reporting a number over a
broken ledger regardless. That is a MISFEATURE: a returns figure the user can't
trust, with no signal. rledger's house style is to be stricter/safer than
upstream (CLAUDE.md), and — unlike beancount, which books everything — our
loader re-merges booking failures un-booked, so we hit hazards beangrow never
does.

So: strict-clean. A booking error anywhere -> a clean `Err` ("un-booked ledger;
run rledger check"), never a trap and never a figure over a contract-violating
stream. Revert the scope-filter / per-scope isolation / elided-units guard:

- rustledger-booking: `try_apply_posting` is private again (the shared core of
  `apply`/`try_apply`); re-add the whole-transaction `try_apply` the realization
  uses.
- rustledger-returns: the three realization sites apply the whole transaction via
  `try_apply` and surface any over-sell as `ExtractError::UnbookedInput`. The
  multi path fills every scope on error (the shared pass is contract-violating for
  the whole ledger) — matching its own now-accurate `# Errors` doc. Removed the
  three leniency tests; kept the over-sell and twr-eager-scan guards.
- component/WIT: docs updated — a parse-recovered error still proceeds (like the
  CLI), a booking error is fatal (stricter than beangrow, deliberately). The
  guard stays removed, so the component still matches the CLI on every ledger.

Parse-recovered errors remain lenient (no realization hazard); only booking
errors are fatal. Clean-ledger output is unchanged.

Follow-up: beangrow-style permissive leniency, if wanted, is a separate
holistically-designed effort (to be tracked in an issue).

Tests: booking 110, returns 61, loader 95, validate 103; component 7 + parity
24; CLI 16. clippy + doc clean. Net -161 lines.

* fix(returns): error on elided un-booked postings; tidy twr scan + docs

Eighth review pass (a coherence review of the strict-clean revert; the refuted
finding confirmed the strict behavior is intended). Three items:

- Elided un-booked postings silently understated (CONFIRMED correctness). The
  strict-clean contract is "un-booked ledger -> clean Err", and an unmatched
  reduction already surfaces via the fallible realization. But `try_apply` SKIPS
  a non-Complete (elided / uninterpolated) posting, so an un-booked in-scope
  investment leg was dropped from the valuation with no error — a silently
  understated figure, the exact thing strict-clean exists to prevent. Add an
  `apply_booked` helper (used at all three realization sites) that rejects a
  transaction with any elided posting as `UnbookedInput`, alongside the existing
  over-sell detection. Test `unbooked_elided_posting_errors_not_understates`.

- The `twr` eager `UnbookedInput` scan lived in the shared `twr_from_values` hot
  path, where it's inert for `compute_returns` (protected by its eager
  `end_value?`). Moved it to the standalone public `twr` wrapper — the only path
  that needs it — off the per-scope hot path. The unit test is retargeted from
  `twr_from_values` to the public `twr`.

- Fixed the stale module `# Input contract` doc that still claimed un-booked
  reductions are "silently dropped into wrong inventory" — they now surface as
  `UnbookedInput`.

(Out of scope: the reviewer also flagged the #1848 XIRR golden constants having
no CI guard re-running the reference script — pre-existing on main, not this PR.)

Tests: returns 62; component 7 + parity 24; CLI 16. clippy + doc clean.

* style(returns): backtick code items in a doc comment (clippy 1.97 doc_markdown)

CI pins clippy 1.97.0, whose `doc_markdown` lint is stricter than the nix-pinned
1.96.0 used locally — it flags `compute_group` / `scope_returns` in a test doc
comment as needing backticks. This tripped the CI Clippy check (has been red
since the engine-fix commit; local per-crate clippy under 1.96.0 didn't catch
it). No behavior change.

* fix(returns): address Copilot review — currency msg, elided account, docs

- The component's no-reporting-currency error used a `\` line-continuation with
  an indented next line, embedding a run of spaces into the message. Collapse to
  a single-line literal.
- `apply_booked`'s elided-input error now names the offending account (via
  `find` instead of `any`), not just the transaction date.
- `BookingEngine::try_apply` rustdoc: clarify it catches an unmatched reduction
  but still SKIPS an elided/uninterpolated posting (like `apply`), so a caller
  that must reject elided input checks `units` itself (as the returns realization
  does in `apply_booked`).

No behavior change beyond the two message strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants