The five-part check ran on CI for the first time (the slowest part done 43 minutes after the push, where the one job took 72), with deny, notices-check and kernel-only in its lint part. Co-Authored-By: Claude <noreply@anthropic.com>
222 lines
13 KiB
Markdown
222 lines
13 KiB
Markdown
# Triage, 2026-11-09
|
|
|
|
What a full evaluation of the project found, in the order it should be
|
|
worked. Each item says what is wrong, how it is known, what closes it and
|
|
who does it. "Mine" is the orchestrating session; "worker" is a delegated
|
|
model (`docs/routing.md`); "owner" is Steve.
|
|
|
|
The engine itself is in good shape: 36 parity items done, more than 188
|
|
Lean theorems, 97 Kani harnesses, every rule cited by its bookspec id,
|
|
95.5% of ledger-core's lines covered. Nothing below is a wrong number in the live
|
|
books. The gaps are in what the gates do not see.
|
|
|
|
## P0: broken now
|
|
|
|
1. **`portable-windows` was red for four pushes and nobody looked.** Only
|
|
`check` was being read. Cause: a test named a Unix path for
|
|
`backup.folder`. Fixed in 5cad55023, pushed with 0ef1ef2c2, and that
|
|
commit's Windows gate read green on 2026-11-09 (all four gates green).
|
|
Closed. The rule since: read all four gates after every batch push.
|
|
|
|
## P1: a promise of the manual that is not kept, or a correctness risk
|
|
|
|
1. **The kernel rule was not met and nothing enforced it.** Done. Bar item 1
|
|
says money arithmetic lives in `kernel/` and nowhere else.
|
|
`scripts/raw-decimal-arith.sh` (95ae7717d) asks the compiler, and at
|
|
8ad55e82a it lists **210 places in ledger-core** that add, subtract,
|
|
multiply, negate or sum a `Decimal` outside the kernel: raw operators
|
|
that panic on overflow, and `checked_*` calls that reach rust_decimal's
|
|
methods (which round silently past 28 digits) instead of the kernel's.
|
|
The outer crates, after K-U9: **ledger-gui 123** (the viewer computes
|
|
averages, shares and totals of its own in `books.rs` and the pages;
|
|
137 before K-U9), ledger-import 18 (was 22), ledger-mcp 19,
|
|
ledger-package 13, ledger-store 8, ledger-config 2, and none in
|
|
ledger-cli, ledger-host, ledger-reader and ledger-vault. Closes with:
|
|
- K-U11a, ledger-core: done (merged 411c3aae1). Every one of the 210
|
|
goes through the kernel, by a script driven by the compiler's own
|
|
spans, so no site is hand-copied; no figure moves. `just kernel-only`
|
|
in the lint part of `just check` holds ledger-core and the four
|
|
outer crates already at zero there. What it found: with K-U10's
|
|
exact sum, the K-1 worksheet's running total of 28-digit shares
|
|
refused every split by thirds (two tests caught it before main);
|
|
that sum is a rounded figure by construction, and the kernel now
|
|
names it (`checked_add_rounded`, `checked_sub_rounded`). Four places
|
|
changed a figure's written places with `Decimal::rescale`, which can
|
|
round; `kernel::rescale_exact` cannot. `docs/proofs/k-u11.md`.
|
|
- K-U12, the outer crates: done (merged 1c28760d8, a167766dd,
|
|
e444a4107). All 183 places go through the kernel: ledger-store and
|
|
ledger-config by hand, the other four crates by two workers from a
|
|
rule table and a decision for every site that was not a plain sum
|
|
or sign, each diff read against it. No figure moves; a sum exact
|
|
arithmetic cannot hold is a blank or a refusal where it panicked or
|
|
was rounded. `docs/proofs/k-u12.md`.
|
|
- The script in `just check` at zero, so the count cannot rise again:
|
|
done for every crate of the workspace, and `just kernel-only` fails
|
|
on a crate that is not in its list.
|
|
2. **Decimal sums and products rounded silently.** Done (K-U10a, merged
|
|
e632855f1). `Decimal::checked_add` and `checked_mul` return a rounded
|
|
answer when the exact one needs more than 28 digits; the kernel's
|
|
`Amount for Decimal` now gives the exact answer or refuses, and a
|
|
foreign amount is rounded once from a 256-bit product. Within the line
|
|
cap no sum moves and no golden moved. One figure a new line can book
|
|
does move: 1050000010.0000000001 at 9.9999999999 books 10500000099.89,
|
|
the exact product's cent, where the double rounding booked .90 (posted
|
|
lines are not recomputed). What the worker's own run missed and the
|
|
checks found: `checked_div_exact` accepted a rounded quotient (10 / 3);
|
|
the independent review's six findings, all reproduced (a refusal at
|
|
steps of 27 and 28 places the docs did not state, four gaps in what
|
|
the properties covered, stale sentences). Not proved: the 256-bit
|
|
helpers have no Kani harness (checked against exact rationals by
|
|
property instead; `docs/proofs/k-u10.md` says why).
|
|
3. **An exact tie between shares went where Decimal's 28th digit sent
|
|
it.** Done (K-U10b, merged 5e9591725). The docs and bookspec's Lean
|
|
say a tie goes to the earlier part; the engine ranked rounded
|
|
remainders, so 20.00 by 4/1/1 came out 13.33 / 3.34 / 3.33. The owner
|
|
decided on 2026-11-09 (D-76): exact ranking from now on (13.34 / 3.33
|
|
/ 3.33). No golden moved; of the engine's splits only the K-1
|
|
worksheet's share of contributed property can differ, by a cent a
|
|
part. Kani then found the same rule on whole numbers: a part whose
|
|
share is exact never takes a leftover unit (5 by 2/3/5 is 1, 2, 2),
|
|
and the harness now asserts it with the strict bound. The worker had
|
|
not run Kani; its cover would have failed `just prove`.
|
|
4. **The audit's close check** (V-D3, merged abafa94a5, 09a8707e2): it
|
|
checked a JPY close at a cent, and its pre-true-up bound ignored the
|
|
member count. Left open: the bound covers one legacy close, not
|
|
several in one set of books.
|
|
5. **Rounding for display was done outside the kernel** in ledger-gui,
|
|
ledger-import and ledger-package, each with its own copy, and the
|
|
viewer's percentages were f64. Done (K-U9, merged 0e9990f11): one
|
|
`round_display` through the kernel, percentages by the kernel's
|
|
`percent_of`. A change against a zero or negative base now shows no
|
|
percentage.
|
|
6. **Recorded regression seeds that no test read.** Fixed (129a90dcf): the
|
|
failures are replayed again, and a seed file no test reads fails the
|
|
build.
|
|
7. **`overflow-checks` was off in the release profile.** An integer
|
|
overflow in the shipped program wrapped silently where the test build
|
|
would panic. Fixed (724edc61f), checked with a release build.
|
|
8. **The live books are not on `documents_v2` or `schedule_minor_unit`.**
|
|
Two format upgrades the code supports and the live file has not taken.
|
|
Owner (exact commands when he is ready).
|
|
9. **P12 step 2 has never run on today's code**: the overnight mutation
|
|
and fuzz run (`just p12-night`). Owner, overnight.
|
|
|
|
10. **Another app's AppImage was taken for this program's own.** Found on
|
|
2026-11-10 by the batch's gate, not by the evaluation: one test
|
|
(`the_host_outlives_the_app_scope_that_started_it`) passes its own
|
|
environment on, and the gate ran in a session started from an
|
|
AppImage app. `APPIMAGE` was believed whenever it named a file, and
|
|
everything an AppImage app starts inherits it (a terminal, an editor,
|
|
an agent's app). From there wanderbooks started that app's image as
|
|
its host (the books never opened), would have named it in an agent's
|
|
pointer file, and `wanderbooks update` replaced that app's file with
|
|
wanderbooks; both reproduced by a test before the fix. Fixed: the
|
|
image is believed only when the running executable is inside
|
|
`APPDIR` (`start.rs` INVARIANT 6). Not checked against a built
|
|
AppImage: the first trial of one does.
|
|
|
|
## P2: the gates themselves
|
|
|
|
1. **CI's `check` took 72 minutes**, one test binary at a time. Done
|
|
(5544a3e66): five parts on five runners from one definition in the
|
|
justfile, and the lint part fails if CI's list is not the justfile's.
|
|
Seen on CI on 2026-11-10 (8ec1b7995): all five parts green, the
|
|
slowest done 43 minutes after the push.
|
|
2. **`just prove` had one 1800 s cap for all 97 Kani harnesses.** On a
|
|
loaded machine it was cut off with no failure named. Done (fe3b10e2d):
|
|
a cap per harness, and a run that does not verify everything lists
|
|
what failed, what ran past its cap and what never finished.
|
|
3. **There was no supply-chain gate.** Done: `just deny` (cargo-deny,
|
|
`deny.toml`) in the lint part of `just check` and in the weekly run.
|
|
Its first run found 23 known vulnerabilities in the lock file, one
|
|
unsound crate, two yanked and nine unmaintained. Closed by upgrades
|
|
(quick-xml 0.42, rusqlite 0.41, rust_xlsxwriter 0.102, rmcp 3.9,
|
|
rustls, tokio, zstd, pulldown-cmark); two quick-xml advisories remain
|
|
for the copy typst brings, which parses nothing from outside, and are
|
|
written down in `deny.toml`. The upgrade also found a wrong answer:
|
|
**the XLSX reader dropped every `&` and `&#...;` in a cell**
|
|
(`AT&T` read as `ATT`), since the parser reports a reference as
|
|
its own event and the reader took only the text. Fixed with a test.
|
|
The licence list allows two that are not plain permissive: MPL-2.0
|
|
(one crate, unchanged) and CDLA-Permissive-2.0 (Mozilla's root
|
|
certificates). It allows no font licence: egui's default font set
|
|
carried Ubuntu Light under the Ubuntu Font Licence, which Debian and
|
|
Fedora class as non-free, so that set is switched off and the viewer
|
|
names its own fonts (Inter, Hack, Noto, two symbol fonts; OFL 1.1, MIT
|
|
and Bitstream Vera), each beside its licence
|
|
(`crates/ledger-gui/assets/fonts/README.md`).
|
|
4. **The packages carried no third-party licence notices.** The fonts
|
|
(OFL, MIT, Bitstream Vera) and the MIT, Apache and BSD crates all ask
|
|
that their notice travel with a binary. Done (merged 9d1cb28f2, then
|
|
two commits of mine): `THIRD-PARTY-NOTICES.txt` is generated from the
|
|
lock file (`just notices`: cargo-about for the crates, the font
|
|
licences beside it), compiled into the program (`wanderbooks
|
|
licenses`), and `just notices-check` in the lint part fails when it is
|
|
out of date (about 2 minutes). What checking it found: for 70 crates
|
|
cargo-about could give only a licence's standard text with a
|
|
placeholder where the copyright line goes (`Copyright (c) <year>
|
|
<copyright holders>`), since their own licence file is a compound one
|
|
(chrono, libm, aws-lc, the windows crates) or they were packaged with
|
|
none (egui, objc2, wasmi). MIT, BSD and ISC ask for the notice itself,
|
|
so the file now also gives those crates' own licence files whole, and
|
|
names the repository of the 35 packaged with none. The bundled C
|
|
libraries are covered: zstd's and AWS-LC's notices come from their
|
|
`-sys` crates, and SQLite is in the public domain. The .deb, the .rpm
|
|
and the Arch tarball carry the file under `/usr/share/doc/wanderbooks/`
|
|
and the package test compares it with what the program prints; **no
|
|
package was built to check those entries** (the first `just
|
|
package-linux` does). The AppImage, the .dmg and the Windows program
|
|
carry it compiled in.
|
|
5. **The Lean model of the books covers 14 steps; the Rust `Ledger` has
|
|
119 commands**, and no list mapped one to the other, so "every
|
|
reachable state" covered less than it read. The inventory is done
|
|
(`docs/command-steps.md`, kept whole by `tests/command_steps.rs`): 71
|
|
commands are the `record` step, 11 are one step, 19 are several steps
|
|
run as one, 17 are replay doors and one is no step. What it found, each
|
|
closing with Lean in bookspec (hard implementation, then the pin moves):
|
|
- `renumber_account` is no step of the model. A `renumber` step: codes
|
|
stay distinct, and every balance is the old one under the new code.
|
|
- Four doors apply a change without a check the model's step requires
|
|
(`create_entry`, `replay_generate_recurring`, `replay_create_period`,
|
|
`replay_reverse_entry`), so books replayed from an old journal can be
|
|
outside `Reachable`. The laws that rest on distinct codes, acceptable
|
|
entries and known accounts still hold, by reading the proofs; a
|
|
`ReplayStep` relation and its theorem would make that proved.
|
|
- The registers (fixed assets, schedules, recurring entries, payroll
|
|
runs) have proved arithmetic and no step model of how they change.
|
|
- Nothing proves a Rust command is its Lean step. Two tests check it:
|
|
bookspec's examples and the differential test (`lean_model.rs`),
|
|
which does not reach a standalone period, a close with explicit
|
|
targets, a draft left unposted or an account added late. Extend it.
|
|
6. **Coverage is measured only for ledger-core and ledger-store.**
|
|
7. **Three allocation preludes are still outside the kernel**
|
|
(`try_allocate`, `allocate_cumulative`, `tax_capital::split`): they
|
|
prepare the remainders the kernel then apportions. Each needs a Kani
|
|
harness, a Lean theorem and a bridge property. Hard implementation.
|
|
|
|
## P3: drift and debt
|
|
|
|
- `plan/roadmap.md` Phase 3 and a few other pages describe an older state.
|
|
- bookspec: 39 CHOICE options and 2 rules (BS-asset-9, BS-partner-16)
|
|
without examples; the second implementation (X-O, hledger), X-K2 and
|
|
L-G4 are not started.
|
|
- `ledger.rs` is past 9,000 lines; `reports.rs`, `parties.rs` and
|
|
`cashflow.rs` are large too. Not a correctness problem.
|
|
|
|
## The owner's alone
|
|
|
|
Mac, Windows and clean-Linux trials; the first `release` run; the icon;
|
|
signing (D-64); the re-audit (P10); Q-6 before P9b.
|
|
|
|
## Order of work
|
|
|
|
1. Land what is in flight: V-D3, K-U9, K-U10a, K-U10b (all four done).
|
|
2. K-U11a on top of them, then K-U12 (both done; the detector is in
|
|
`just check` for every crate).
|
|
3. `overflow-checks`, the CI split, `just prove`'s cap, `cargo-deny`
|
|
(all four done).
|
|
4. One gate at the end (`just check`, `just prove`), one push, four gates
|
|
read.
|
|
5. The steps the inventory found missing (bookspec), the allocation
|
|
preludes, then bookspec's examples and second implementation.
|