From 7b40d243a66008f06347d2ff2c57b7e53cad9871 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 9 Nov 2026 03:31:29 -0700 Subject: [PATCH] docs(plan): S-C8, bookspec's records cite their own parts by position S-E3 found two records still using the old words inside bookspec: BS-format-2's statements cite each other as items, and BS-statement-3's and BS-partner-3's statements carry Rule n labels that no longer equal their positions. Co-Authored-By: Claude Opus 5.5 --- plan/p14-bookspec.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plan/p14-bookspec.md b/plan/p14-bookspec.md index 8b8975f8..6c88b36b 100644 --- a/plan/p14-bookspec.md +++ b/plan/p14-bookspec.md @@ -84,6 +84,7 @@ workers have been faster). | **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. 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 | | **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 | | **K-U10** | `impl Amount for Decimal`'s `checked_add` and `checked_mul` exact or None (BS-ledger-1: a product the arithmetic can't hold MUST be refused; BS-entry-4): `checked_mul` rounds a product whose mantissa passes 96 bits (K-U1's fix, 2026-11-08: `1050000010.0000000001 × 9.9999999999` books 10500000099.90 for an exact 10500000099.8949…, both inputs within D-75's ten places; pinned by `the_mantissa_edge_is_outside_the_precondition_and_pinned`), and `checked_add`: `rust_decimal` rounds dust away within one unit of `Decimal::MAX` (`MAX + 0.4` gives `Some(MAX)`), breaking the kernel's exact-or-None contract (found by K-U4, 2026-11-08; pinned by the canary `finding_decimal_add_rounds_dust_at_the_edge`): refuse a sum whose result scale fell below the operands'; after the sweep units merge (the file is shared). Also from K-U3's review (2026-11-09): `split_by_weights_into` ranks remainders by Decimal's rounded quotient, so an exact tie is decided by the 28th digit, not given to the earlier part as the docs and the Lean model say (20.00 by 4/1/1 gives 13.33, 3.34, 3.33 where exact ranking gives 13.34, 3.33, 3.33); the pre-U3 sites did the same, and K-U3 kept it and pinned both cases. Ranking by the exact integer remainder (`whole x w - part x total`, as `share_floor_with` does) moves a cent between parties in reports recomputed for past periods: an owner decision, put with the cents it moves before it lands | K-U4 merged | `kernel/entries.rs`, the canary, the bridge | S | | **V-D** | Coverage report and floor; `rust_decimal` checked against exact rationals (task D) | none | in flight 2026-11-08 | S | | **V-D2** | Tests where coverage is thinnest (the V-D findings, `docs/coverage-floor.md`): `ledger-store` `reconcilable.rs` (0% from the store's own suite), `ledger-core` `evidence.rs` (34% lines, 9% branches from the core's suite), `ledger.rs`'s command steps (`mark_sent_steps`, `settle_steps`, `run_payroll_steps`, …) and refusal arms, `conventions.rs` and `settings.rs` validation refusals, `audit.rs` branches; each test encodes the rule it covers; the floor rises with them | V-D | the crates' tests | M |