docs: sub-references name bookspec's statements, invariants and scenarios

Unit S-E rewrote each `B-n` citation to its bookspec id but kept the
sub-reference after it ("item 7", "rule 11", "INVARIANT 2"). Those
numbers counted parts of the retired rules.md text, so `BS-statement-5
item 7` pointed at finished and abandoned projects, not at the snapshot
it meant. Bookspec numbers a record's parts from 1 as `statement`,
`invariant` and `scenario`; every sub-reference now says so.

The map was built by content, not by position: each old item,
INVARIANT or SCENARIO was read in `git show ca8d676d5^:docs/spec/rules.md`
(the last full rule text), found in the pinned records
(bookspec bc92cf3) and in docs/spec/claims/, and each reference was
read in its context before it was mapped. Where the old numbering still
survives as the "Rule n" labels inside bookspec's statements (the cash
flow, party totals) the new number is that statement's position; where
a record carries the whole rule differently (the asset depreciation, the
IIF file, the arap invariants) the reference follows the content. Where
bookspec keeps no counterpart, the product rule that states it is cited
instead: WB-statement-5 (a project's facts and names), -7 (the snapshot),
WB-arap-4 (the document_standing feature), -8 (the issued PDF), -15 (a
payment event names its line), WB-ledger-15 (BS-ledger-12 is retired).
A reference that had pointed at the wrong part is corrected, for example
the discount-reason references that said BS-arap-6 INVARIANT 2 (a
bound) now say invariant 6 (the discount cap and date).

Only the reference tokens and their sentence change; no paragraph is
reflowed. A reference wrapped across a comment prefix keeps its wrap.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-09 03:30:06 -07:00
1 parent 609e4e6b26
commit e41cc3a161
78 files changed
+298 -302

No files matched your search

+14 -14
View File
@@ -110,7 +110,7 @@ impl Books {
}
/// Every control account's tie-out holds: no difference (BS-arap-2
/// INVARIANT 1).
/// invariant 1).
fn ties(&self, on: NaiveDate) {
for c in self.l.control_check(on).unwrap() {
assert_eq!(c.difference, Decimal::ZERO, "{c:?}");
@@ -1067,7 +1067,7 @@ fn out_of_bounds_documents_are_listed_not_aged() {
/// Reversing a legacy hand line takes it off; reversing that reversal
/// would put it back, and is refused: no command adds an untagged control
/// line (BS-arap-2 INVARIANT 1 and item 3; first review of S1).
/// line (BS-arap-2 invariant 2 and statement 11; first review of S1).
#[test]
fn putting_back_a_removed_hand_line_is_refused() {
let mut b = books();
@@ -1204,7 +1204,7 @@ fn a_chain_counts_in_order() {
// Write-offs (plan P4b S7; BS-arap-5)
// ---------------------------------------------------------------------------
/// BS-arap-2 SCENARIO 7 and BS-arap-5 INVARIANT 1: half of an invoice paid, the rest
/// BS-arap-2 scenario 7 and BS-arap-5 invariant 1: half of an invoice paid, the rest
/// written off, reads Written off with 50 paid and 50 written off, and
/// receivables falls by the write-off alone.
#[test]
@@ -1261,7 +1261,7 @@ fn half_paid_rest_written_off_is_written_off() {
assert!(check.iter().all(|c| c.difference.is_zero()));
}
/// BS-arap-5 INVARIANT 3: a cash-basis company never counted the invoice as
/// BS-arap-5 invariant 5: a cash-basis company never counted the invoice as
/// income, so it has no basis to deduct (IRC §166; Treas. Reg.
/// §1.166-1(e)).
#[test]
@@ -1308,7 +1308,7 @@ fn write_off_refused_on_cash_basis() {
);
}
/// BS-arap-5 INVARIANT 1: at most what is owed, a partial write-off allowed
/// BS-arap-5 invariant 2 and statement 3: at most what is owed, a partial write-off allowed
/// (Treas. Reg. §1.166-3(a)); more is refused, naming what is owed, and
/// nothing changes.
#[test]
@@ -1351,7 +1351,7 @@ fn write_off_above_outstanding_refused() {
assert_eq!((st.paid, st.written_off), (cents(4_000), cents(6_000)));
}
/// D-49's same-year recovery, and BS-arap-5 INVARIANT 2: reversing the
/// D-49's same-year recovery, and BS-arap-5 invariant 4: reversing the
/// write-off re-instates the debt (it is not a new movement), and the
/// payment then recorded settles it; a recovery is income, never a
/// payment event.
@@ -1502,7 +1502,7 @@ fn days(b: &Books) -> Vec<NaiveDate> {
proptest! {
#![proptest_config(ProptestConfig::with_cases(256))]
/// BS-arap-2 INVARIANTS 1, 2 and 6 over random histories of creates,
/// BS-arap-2 invariants 1, 6 and 9 over random histories of creates,
/// payments, voids, reversals of any entry and refused hand lines: at
/// every date the control accounts equal their documents (no
/// difference, nothing unattached: no command adds a hand line), each
@@ -1538,9 +1538,9 @@ proptest! {
}
}
/// BS-arap-2 INVARIANT 5: the aging as of a day partitions what the
/// BS-arap-2 invariant 8: the aging as of a day partitions what the
/// documents owe then (in books these commands write, none owes less
/// than nothing). INVARIANT 4 (Store, replay and Snapshot agree) is
/// than nothing). Invariant 7 (Store, replay and Snapshot agree) is
/// ledger-store's `status_is_a_function_of_journal_and_date`.
#[test]
fn aging_partitions_what_documents_owe(ops in prop::collection::vec(arb_op(), 0..30)) {
@@ -1562,7 +1562,7 @@ proptest! {
}
}
/// BS-arap-2 INVARIANT 3: reversing a tagged entry moves its documents by
/// BS-arap-2 invariant 4: reversing a tagged entry moves its documents by
/// exactly the opposite of the entry's own tagged lines from the
/// reversal's day (read from the entry reversed, not from the mirror,
/// so a mirror that lost its tag is caught); reversing that reversal
@@ -1725,7 +1725,7 @@ fn terms_derive_due_dates() {
assert!(Terms::new(TermsKind::NetEom(3_651), None).is_err());
}
/// BS-arap-3 INVARIANT 2: the discount's bound, its date, and the terms that
/// BS-arap-3 invariant 2: the discount's bound, its date, and the terms that
/// cannot carry one.
#[test]
fn discount_bounds_and_late_reason() {
@@ -1795,7 +1795,7 @@ fn discount_bounds_and_late_reason() {
assert_eq!(kernel::discount_max(cents(-1), 200), None);
}
/// BS-arap-3 INVARIANT 3: the canonical spellings read back as they print.
/// BS-arap-3 invariant 3: the canonical spellings read back as they print.
#[test]
fn terms_describe_and_parse_round_trip() {
for text in [
@@ -2286,7 +2286,7 @@ fn bill_on_terms_with_discount() {
}
/// A discount taken after the discount date needs a reason (BS-arap-6
/// INVARIANT 2); a bill with an asset or prepaid line refuses one with the
/// invariant 6); a bill with an asset or prepaid line refuses one with the
/// D-49 remedy, and none of the refusals changes the books.
#[test]
fn late_discount_needs_a_reason() {
@@ -2433,7 +2433,7 @@ fn a_fee_posts_gross_to_receivables_and_net_to_the_bank() {
/// A payment that settles more than one document names its lines in
/// application order, and two applications on one document are refused:
/// each document's bound is one bound (BS-arap-6 INVARIANTS 1 and 2).
/// each document's bound is one bound (BS-arap-6 invariants 4 and 5).
#[test]
fn a_settlement_names_its_lines_and_refuses_a_document_twice() {
use ledger_core::{Application, DocRef, SettleParams};