diff --git a/plan/HANDOFF.md b/plan/HANDOFF.md index acad134e..104ffce6 100644 --- a/plan/HANDOFF.md +++ b/plan/HANDOFF.md @@ -30,8 +30,8 @@ Nothing is left to resume. The merges went in the 8.0.2 order with the conflicts ### How to run things - `mise install` once (Rust 1.99 with clippy and rustfmt, just, Kani, Lean, sccache, all pinned in `mise.toml`). Then `just` lists the recipes. -- `just check` is the exhaustive gate: `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`, rustdoc with `-D warnings`, `cargo test --workspace`, the server-only build. It takes over an hour and the EM runs it once per wave (D-60); a worker runs the crate's own tests (`cargo test -p ledger-core`, `cargo test -p ledger-store`, `cargo test -p ledger-cli --test documents`), fmt, and clippy on the crates touched. `CARGO_PROFILE_DEV_DEBUG=line-tables-only` in the shell keeps a worktree's `target/` to a fraction of its size. -- `just prove` runs the Kani harnesses and the Lean proofs (about five minutes on a quiet machine; the slow harnesses are `just prove-slow`). Required for any unit that touches `crates/ledger-core/src/kernel.rs`, `crates/ledger-core/src/proofs.rs`, `verify/lean/`, or adds a `Ledger` command. +- `just check` is the exhaustive gate, in five parts (`just check-shard `; CI runs each on its own runner): the lint part (`cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`, rustdoc with `-D warnings`, the server-only build, `just kernel-only`, `just deny`, `just notices-check`) and four parts of `cargo test --workspace`. It takes over an hour and the EM runs it once per wave (D-60); a worker runs the crate's own tests (`cargo test -p ledger-core`, `cargo test -p ledger-store`, `cargo test -p ledger-cli --test documents`), fmt, and clippy on the crates touched. `CARGO_PROFILE_DEV_DEBUG=line-tables-only` in the shell keeps a worktree's `target/` to a fraction of its size. +- `just prove` runs the Kani harnesses and the Lean proofs (about ten minutes on a quiet machine; on a loaded one `KANI_FAST_CAP=7200 just prove`, and a run that does not verify everything lists what failed and what never finished; the slow harnesses are `just prove-slow`). Required for any unit that touches `crates/ledger-core/src/kernel/`, `crates/ledger-core/src/proofs/`, `verify/lean/`, or adds a `Ledger` command. - Over-the-wire tests (`crates/ledger-cli/tests/*.rs`) start a real books server in a temp root through `crates/ledger-cli/tests/common/mod.rs`; see recipe R-C step 6. ### Assigning work diff --git a/plan/STATUS.md b/plan/STATUS.md index 5f963205..fd0232bd 100644 --- a/plan/STATUS.md +++ b/plan/STATUS.md @@ -1,4 +1,58 @@ -# STATUS — 2026-11-09: P14 most of the way: every rule cited by its bookspec id, a traceability gate, three quarters of the rules with examples, the kernel sweep through U5 +# STATUS — 2026-11-10: the evaluation batch: no money arithmetic outside the kernel in any crate, exact Decimal sums, four gates the build did not have + +## 2026-11-10: the evaluation batch (plan/2026-11-09_TRIAGE.md) + +A full evaluation of the project on 2026-11-09 found nothing wrong in the +live books and a list of things the gates did not see. The triage has +each item, how it was known and what closed it. What landed, on `main` +and not yet pushed (one gate and one push at the end, D-60): + +- **The kernel rule is kept, and the compiler checks it** (K-U11a, + K-U12): 210 places in ledger-core and 183 in the crates around it did + `Decimal` arithmetic outside `kernel/`. All go through the kernel, and + `just kernel-only` (the lint part of `just check`) fails on a new one + in any crate, or on a crate it does not list. `docs/proofs/k-u11.md`, + `k-u12.md`. +- **Decimal sums and products are exact or refused** (K-U10a): they + rounded silently past 28 digits. One figure a new line can book moves + by a cent; no posted line is recomputed and no golden moved. Three + operations round, each by name. `docs/proofs/k-u10.md`. +- **A tie between shares goes to the earlier part, exactly** (K-U10b, + D-76, the owner's decision): 20.00 by 4/1/1 is 13.34 / 3.33 / 3.33. +- **Display rounding in one place, percentages in Decimal** (K-U9); the + audit checks a close at the allocation's unit and a legacy close by + its member count (V-D3). +- **Gates that did not exist**: a supply-chain gate (`just deny`; its + first run found 23 known vulnerabilities, closed by upgrades, and the + upgrade found the XLSX reader dropping every `&` in a cell); + third-party licence notices generated, checked and printed by + `wanderbooks licenses`; every font the viewer ships named with a + permissive licence (Inter, Hack, Noto); `overflow-checks` on in the + shipped program; recorded regression seeds replayed again; CI's + `check` as five parts; `just prove` with a cap per harness and a list + of what did not finish. +- **Every `Ledger` command mapped to its step of the Lean model** + (`docs/command-steps.md`, kept whole by a test): 119 commands, 14 + steps, and the four gaps it found are written down for bookspec. +- **Routing**: delegated work goes by tier (`docs/routing.md`), one line + per task in `docs/delegation-log.md`. + +Kani 107 harnesses (97 in `just prove`, 10 slow); bookspec's Lean 212 +audited theorems at the pin (79cb439). Parity floor 36. + +**Not verified yet**: the batch's one `just check` and `just prove`, and +CI on the push (the five-part `check`, `deny`, `notices-check` and +`kernel-only` have never run there). No Linux package has been built +since the notices file joined them. + +**Next**: the gate and the push; then the triage's P2.5 (a `renumber` +step, a `ReplayStep` relation, the registers' steps, a wider +differential test: Lean in bookspec), P2.7 (the three allocation +preludes into the kernel, with Kani, Lean and bridge coverage), Kani for +the 256-bit helpers, coverage beyond core and store, then X-K2, X-O and +L-G4. The owner's: `just p12-night`, the two format upgrades on the live +books, the trials, the first `release` run and `just package-linux`, +Q-6. ## 2026-11-09: P14 continued (plan/p14-bookspec.md) diff --git a/plan/p14-bookspec.md b/plan/p14-bookspec.md index 8739f9fe..39a6d2de 100644 --- a/plan/p14-bookspec.md +++ b/plan/p14-bookspec.md @@ -81,7 +81,7 @@ workers have been faster). | **X-K2** | Profiles (core, documents, partners, us-tax, formats) and an engine builder's guide; the hard-coded accounts become setup keys | S-A, X-H1 | bookspec `checker/src/{engine,schema}.rs`, `spec/00-model.md` | M | | **X-O** | hledger as a second oracle: a pinned container (official static 1.52.4, sha256 in the Dockerfile), a bookspec engine adapter, and wanderbooks' random-book differential beside GnuCash's (task C; `plan/kernel-sweep-audit.md` section 4) | S-K1 | bookspec `hledger/**`; wanderbooks `tests/oracle_hledger.rs`, `justfile` | M | | **K-U0** | Kernel and proofs into modules (`kernel/`, `proofs/`, `tests/kernel_bridge/`), `_kani` updated, `just prove` unchanged | none | `crates/ledger-core/src/{kernel,proofs}/**`, `tests/kernel_bridge/**`, `justfile` | S | -| **K-U1..U9** | The sweep (`plan/kernel-sweep-audit.md` section 3), in value order: U1 FX, U3 shares (six copies to one; legacy replay policies only named, never changed), U2 rounding, U5 schedules (D-72), U4 totals (the raw-operator panic class), U6 ratios, U7 payroll, U8 control and aging, U9 display rounding (and the viewer's f64 percentages: `ledger-gui` `fmt::pct_change` divides money amounts in f64 and prints the result, a money path by AGENTS.md's first non-negotiable; K-U6's review, 2026-11-09: U9 does not close until it is a `Decimal` computation, with `profit::pct`, the reports' change and share columns and `capital::percent` decided alongside). Each: kernel functions, Kani, bridge, its law in bookspec's Lean, its rule cited by BS id | K-U0; Lean laws after L-F2 | its own `kernel/.rs`, `proofs/.rs`, bridge module, call sites | S-M each | +| **K-U1..U9** | The sweep (`plan/kernel-sweep-audit.md` section 3), in value order: U1 FX, U3 shares (six copies to one; legacy replay policies only named, never changed), U2 rounding, U5 schedules (D-72), U4 totals (the raw-operator panic class), U6 ratios, U7 payroll, U8 control and aging, U9 display rounding (and the viewer's f64 percentages: `ledger-gui` `fmt::pct_change` divides money amounts in f64 and prints the result, a money path by AGENTS.md's first non-negotiable; K-U6's review, 2026-11-09: U9 does not close until it is a `Decimal` computation, with `profit::pct`, the reports' change and share columns and `capital::percent` decided alongside). Each: kernel functions, Kani, bridge, its law in bookspec's Lean, its rule cited by BS id. All nine landed by 2026-11-09; K-U10 (exact sums and products, the exact tie, D-76), K-U11 (ledger-core through the kernel, the detector in `just check`) and K-U12 (every other crate) followed from the 2026-11-09 triage: `docs/proofs/k-u10.md` to `k-u12.md` | K-U0; Lean laws after L-F2 | its own `kernel/.rs`, `proofs/.rs`, bridge module, call sites | S-M each | | **S-E2** | The 13 rule citations S-E kept in program output move to BS ids together: the eight B-43 evidence-source strings in `ledger.rs`, the two lines recording them in `ledger-store/tests/golden/draft_states_and_evidence_gate.json` (a string-only golden edit, verified by hand and explained in the commit), `ledger-package/src/package.rs` (CPA package text), `ledger-mcp/src/tools/settlements.rs` (a tool description), and the GUI `CONTRIBUTION_NOTE` (`rules.md B-37 item 7`). First establish whether any of these strings is stored in a journal or the store (then old books must still read: replay keeps the old text, new writes the new); then shrink `source_refs.rs`'s kept-string allow-list to zero (S-E review, 2026-11-08) | S-E merged | those six files, the golden, `tests/bookspec/source_refs.rs` | S | | **S-E3** | The sub-references S-E carried over move to bookspec's numbering: S-E rewrote `B-37 item 7` as `BS-statement-5 item 7`, but the old items were the rules.md text's and bookspec's records number their statements, invariants and scenarios their own way (S-E2 found `BS-statement-5 item 7` now means finished or abandoned projects; the document lines are item 6). 261 such references outside `plan/` (`BS-statement-3 rule n` 67+, `BS-statement-5 item n` 57, `BS-partner-3 item n` 44, `BS-arap-2 INVARIANT n` 17, and others). Build the map from the last rules.md that held the text (before S-D0) to each record's statements, rewrite each reference, and add a test that every `BS-- k` names one the pinned record has (S-E2, 2026-11-09) | S-E2 merged | the files that cite them, `tests/bookspec/source_refs.rs` | M | | **S-C8** | bookspec's records cite their own parts by position: BS-format-2's statements cite each other as "(item 22)", "(item 18)", "(item 24)" (the old word, though the number is the position), and BS-statement-3's and BS-partner-3's statements open with "Rule n" labels that no longer equal their positions (BS-statement-3 statement 16 is "Rule 11"). Rewrite the cross-references as "statement k", and drop the labels or keep them only where an outside text cites them (then say so); extend the checker so a record's internal "statement k" names a part it has (found by S-E3, 2026-11-09) | S-E3 merged | bookspec `rules/format/BS-format-2.toml`, `rules/statement/BS-statement-3.toml`, `rules/partner/BS-partner-3.toml`, the checker | S | diff --git a/plan/roadmap.md b/plan/roadmap.md index 4ffa5572..1774402c 100644 --- a/plan/roadmap.md +++ b/plan/roadmap.md @@ -3,7 +3,7 @@ Where wanderbooks has been, where it is, and where it is going. The detailed plan for the remaining work is `plan/served.md` (section 8.0: status, order, hand-off); `plan/STATUS.md` says where things stand this -week. Revised 2026-10-28. +week. Revised 2026-11-10. ## Done @@ -33,10 +33,10 @@ historical now). Done: the GnuCash differential (`just oracle`: 200 random books, 15,800 exact comparisons, adjudicated from principles; `docs/oracle.md` Layer -5), the mutation, fuzz and proof layers. Open: fixture books diffed as -`snapshot()` output automatically, and the machine-readable parity -catalog with CI enforcing the non-regression floor (the floor is 21 -`done` rows, enforced by review until then). +5), the mutation, fuzz and proof layers, and the parity catalog with its +floor enforced (36 `done` rows; `parity_floor.rs` in `just check`, and +CI's `scripts/parity-floor.sh` against the base commit). Open: fixture +books diffed as `snapshot()` output automatically. ### "Served" P0 to P3, Projects, P4b S1 to S4.3 (2026-10-16 to 2026-10-27) @@ -59,9 +59,26 @@ nothing. Next: S4.5 (the PDF, viewer and handbook of `documents_v2`), P11a step 0 beside it, and after P4 the owner's one upgrade of the live books (D-57). -## Next +## Since (2026-10-29 to 2026-11-10) -The order is `plan/served.md` 8.0.2. Two tracks run beside each other: +The build units of `plan/served.md` 8.2 have landed; `plan/STATUS.md` +has each, by date. Then P14 (`plan/p14-bookspec.md`): bookspec became +the definitive accounting specification, its rules cited by id, its Lean +the one copy of the laws, and the kernel sweep moved every piece of +money arithmetic behind proofs. The 2026-11-09 evaluation +(`plan/2026-11-09_TRIAGE.md`) then closed what the gates did not see. + +What is left is the triage's order of work (the Lean steps the command +inventory found missing, the allocation preludes, bookspec's examples +and second implementation) and the owner's own: the overnight P12 run, +the trials on a Mac, on Windows and on a clean Linux, the first release, +signing, the re-audit (P10), and Q-6 before P9b. + +## The plan as it stood on 2026-10-28 + +Kept for the record; both tracks below have landed except where the +paragraph above says otherwise. The order was `plan/served.md` 8.0.2. +Two tracks ran beside each other: 1. **The installed app: the destination (D-56, owner 2026-10-28).** P11a: the platform groundwork first (the macOS and Windows keyring