refactor: rule references cite bookspec ids

Every B-n citation in crates/, docs/, deploy/, scripts/ and .github/ now names its bookspec id BS-<area>-<n> (D-68), via scripts/rewrite-rule-refs.py: the map is parsed from docs/spec/rules.md's index, rules.md-prefixed and bare forms are rewritten, sub-references (rule 11, item 7, INVARIANT 2) survive, and plan/, docs/spec/rules.md and docs/spec/claims/ are untouched. Program-output string literals that cited a rule were reverted by hand so user-visible output and its goldens are unchanged; DatedRule.catalog, metadata no output prints, now holds BS-1099-1. One SOURCE line that cited only 'R-?' now also cites BS-statement-5.

Co-Authored-By: Muse Wonder 1.0
This commit is contained in:
swaitsandMuse Wonder 1.0 committed 2026-11-08 19:40:22 -07:00
1 parent 7a177a3cfc
commit 489360f598
221 files changed
+1706 -1580

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
//! The viewer's figures at the edges P0 review round 4 checked (rules.md
//! B-28): the party period of a year chrono can't hold, the party chart's
//! The viewer's figures at the edges P0 review round 4 checked (
//! BS-entry-4): the party period of a year chrono can't hold, the party chart's
//! last months, one party's part of a split entry, an amortization
//! schedule due, and the page state tests set.
//!
+2 -2
View File
@@ -4,7 +4,7 @@
//! ```text
//! GOAL: Tobin, Mo or the CPA, on an older viewer, learn to update it,
//! not that the books are damaged.
//! SOURCE: rules.md B-27; plan/served.md 5.1 (the viewer reads the journal
//! SOURCE: BS-format-1; plan/served.md 5.1 (the viewer reads the journal
//! directly, so it meets the same gate).
//! ```
@@ -66,7 +66,7 @@ fn rate() -> serde_json::Value {
}
/// The last line can't be checked: the viewer says so, and never that the
/// books are not damaged (rules.md B-27).
/// books are not damaged (BS-format-1).
fn says_newer_or_damaged(text: &str) {
assert!(text.starts_with("Journal line"), "{text}");
assert!(text.contains("or the line is damaged"), "{text}");
+1 -1
View File
@@ -141,7 +141,7 @@ fn a_members_page_shows_the_same_capital_before_and_after_a_close() {
assert_eq!(closing, [Decimal::new(3, 2), Decimal::new(3, 2)]);
}
/// A member's page in a yen book splits in whole yen (B-3, B-13), as the
/// A member's page in a yen book splits in whole yen (BS-ledger-1, BS-partner-1), as the
/// closes and the statement do. Ann and Bo at 50% each. "Owed to them"
/// (CapitalStatement INVARIANT 5): 101 yen due to the members, 50.5 each
/// exactly, the tied yen to Ann, listed first: Ann 51, Bo 50. Property
+3 -3
View File
@@ -1,11 +1,11 @@
//! Books an earlier wanderbooks wrote open in the viewer, and every page
//! renders over them, never a panic (rules.md B-28: posted is forever; a
//! renders over them, never a panic (BS-entry-4: posted is forever; a
//! figure the books can't compute is said, never guessed).
//!
//! ```text
//! GOAL: the viewer shows books written under older rules, whatever they
//! hold that the commands now refuse.
//! SOURCE: rules.md B-28; DECISION (P0 review round 4: replay accepts what
//! SOURCE: BS-entry-4; DECISION (P0 review round 4: replay accepts what
//! main 188c90ea accepted, and derived figures refuse rather than
//! panic).
//! INVARIANTS:
@@ -508,7 +508,7 @@ fn books_that_keep_no_settings_read_no_file_beside_them() {
}
}
/// rules.md B-37: the classes an earlier version wrote read as projects
/// BS-statement-5: the classes an earlier version wrote read as projects
/// with the default facts (active, kind not recorded), listed by name,
/// their figures ledger-core's.
#[test]
+8 -8
View File
@@ -282,7 +282,7 @@ fn fixture(tag: &str) -> Fixture {
let e = pay(&mut s, d(2026, 1, 20), "Old Co", cash, 12_300);
s.set_entry_party(e, Some(old)).unwrap();
s.update_party(old, PartyField::Archived(true)).unwrap();
// What the members advanced is money (rules.md B-35 item 5): Due to
// What the members advanced is money (BS-partner-3 item 5): Due to
// Shareholders is a financing account; the cash account stays the
// books' (the settings file names both).
journal_settings(
@@ -353,10 +353,10 @@ fn each_partys_totals_are_the_books_numbers() {
assert_eq!(sam.threshold_1099, Some(r.threshold));
// Cash counts (1,000 + the bill's 500); what the owner paid for the
// company through the financing account waits on how they paid
// (rules.md B-19); the card's charge is no payment out of cash.
// (BS-1099-1); the card's charge is no payment out of cash.
assert_eq!(line.paid, cents(150_000));
assert_eq!(line.undetermined, cents(30_000));
// Party totals count all of it as paid to Sam (B-35 item 9): the
// Party totals count all of it as paid to Sam (BS-partner-3 item 9): the
// 1099's buckets, and the card's 200 (no business card is recorded,
// so the worksheet lists it nowhere).
assert_eq!(
@@ -935,7 +935,7 @@ fn party_money_by_period_and_what_for() {
assert_eq!(line.paid, cents(50_000));
// 2026: the cash 1,000 and the bill's 500 paid count; the owner's
// 300 through the financing account waits on how it was paid
// (rules.md B-19); the card's 200 is no payment out of cash.
// (BS-1099-1); the card's 200 is no payment out of cash.
let (line, _) = b.party_1099(f.sam, 2026).unwrap();
assert_eq!(line.paid, cents(150_000));
assert_eq!(line.undetermined, cents(30_000));
@@ -1270,7 +1270,7 @@ fn entries_list_every_party_with_its_resolved_share() {
vec![(m.tobin, Some(cents(5_000))), (m.mo, Some(cents(5_000)))]
);
assert_eq!(e.party.as_deref(), Some("Tobin Harlow & Morgan Ellis"));
// Property (rules.md B-35): what moved each member's capital, signed
// Property (BS-partner-3): what moved each member's capital, signed
// as their own account shows it: received, in kind (before P3 it read
// +600.00, the sign of a payment).
let e = b.entry(m.property).unwrap();
@@ -1423,7 +1423,7 @@ fn show(dir: &Path, route: Route) -> Harness<'static, App> {
h
}
/// The viewer shows the tools' numbers (rules.md B-35): a member's party
/// The viewer shows the tools' numbers (BS-partner-3): a member's party
/// flow is books.party's activity on both bases, labelled cash basis, with
/// the in-kind line under it; the entry page says each part in words, a
/// property contribution "received $600.00, in kind" and its reversal
@@ -1490,7 +1490,7 @@ fn the_party_page_shows_the_basis_and_in_kind() {
}
/// The viewer's what-for reads a reversal as parties::flow does, the
/// opposite of its original (rules.md B-35 item 3; design §1.4): a member
/// opposite of its original (BS-partner-3 item 3; design §1.4): a member
/// paying the card from their own funds (Dr card / Cr 2100), tagged with
/// the issuer, then reversed, is nothing on the issuer's page, paid or
/// what for. Its lines alone read as a second payment.
@@ -1534,7 +1534,7 @@ fn a_reversed_member_card_payment_is_nothing_on_the_issuers_page() {
assert_eq!(flow.what_for, vec![], "the breakdown nets to nothing");
}
/// Screenshots of the party pages and the entry pages B-35 changed, for
/// Screenshots of the party pages and the entry pages BS-partner-3 changed, for
/// eyes: set `SHOT_DIR`.
#[test]
fn party_basis_screenshots() {
+6 -6
View File
@@ -1,4 +1,4 @@
//! Projects in the viewer (rules.md B-37): the list and a project's page
//! Projects in the viewer (BS-statement-5): the list and a project's page
//! show ledger-core's figures; rows, links and bars open what they name;
//! the journal, books.show and the party page know projects.
@@ -603,7 +603,7 @@ fn a_long_party_name_keeps_to_its_card() {
}
}
// ------------------------------------------------- the snapshot (B-37 item 7)
// ------------------------------------------------- the snapshot (BS-statement-5 item 7)
/// Books holding one project of `kind`, started `started_on`, with
/// `posts`: (date, debit code, credit code, cents), the line that isn't
@@ -991,7 +991,7 @@ fn the_chart_runs_from_the_start_or_first_entry_and_caps() {
);
}
/// The fiscal year switch shows books.project's default period (B-30's
/// The fiscal year switch shows books.project's default period (BS-period-3's
/// omitted dates: the fiscal year to date), and switching writes nothing.
#[test]
fn the_fiscal_year_switch_shows_the_default_period() {
@@ -1253,7 +1253,7 @@ proptest::proptest! {
}
}
/// rules.md B-37 item 8: an invoice's or bill's page (its entry's) lists
/// BS-statement-5 item 8: an invoice's or bill's page (its entry's) lists
/// the document's lines, each project a link that opens it; an untagged
/// line has none. The entry's own lines show the tagged revenue or cost
/// line too.
@@ -1372,8 +1372,8 @@ fn an_invoice_and_a_bill_show_each_lines_project() {
}
}
/// The demo's "Client work" project carries every client invoice (rules.md
/// B-37 item 8): its revenue to date is the invoices' total, its direct
/// The demo's "Client work" project carries every client invoice (
/// BS-statement-5 item 8): its revenue to date is the invoices' total, its direct
/// costs the contractors tagged to it.
#[test]
fn the_demos_client_work_counts_every_client_invoice() {
+2 -2
View File
@@ -154,7 +154,7 @@ fn day(y: i32, m: u32, d: u32) -> chrono::NaiveDate {
chrono::NaiveDate::from_ymd_opt(y, m, d).unwrap()
}
/// Defect 15, repros 1.1.1-1.1.2 (rules.md B-30): a target the viewer
/// Defect 15, repros 1.1.1-1.1.2 (BS-period-3): a target the viewer
/// can't honour is ignored whole, never swapped or guessed: a start after
/// the end (an earlier writer's, or a hand-edited ops/show.jsonl), text
/// that isn't a date, an unknown split or comparison. The page, the
@@ -206,7 +206,7 @@ fn show_never_swaps_an_inverted_target_defect_15() {
}
}
/// Defect 16, repro 1.1.4 (rules.md B-30): a report target with only an
/// Defect 16, repro 1.1.4 (BS-period-3): a report target with only an
/// end covers that end's fiscal year to it (2025-01-01 to 2025-06-30, not
/// the swapped 2025-06-30 to 2026-01-01); with no dates, the default (the
/// fiscal year to date, named "Year to date"); dates that are a preset's
+1 -1
View File
@@ -1065,7 +1065,7 @@ fn small_books(tag: &str) -> Small {
.add_account("1000", "Checking", AccountType::Asset, None, false)
.unwrap();
// Mapped to the return, so books with nothing else to do have
// nothing in Needs attention (rules.md B-32 lists every expense
// nothing in Needs attention (BS-ledger-11 lists every expense
// account without a category, used or not).
let rent = store
.add_account_with_tax(
+4 -4
View File
@@ -84,7 +84,7 @@ fn build(plan: &Plan, tag: &str) -> (TestDir, Source, ledger_core::Ledger) {
.collect();
// As replay posts them: random lines land on receivables and payables
// by hand, as books an earlier version wrote can hold them (the
// control guard, rules.md B-38, refuses them as new work), and the
// control guard, BS-arap-2, refuses them as new work), and the
// overview must still read them.
ledger_core::parties::replaying(|| {
for &(back, dr, cr, cents) in &plan.entries {
@@ -169,7 +169,7 @@ proptest! {
fy = fy - Months::new(12);
}
prop_assert_eq!(b.fiscal_ytd(), (fy, t));
// One default period everywhere (rules.md B-30): what a report or
// One default period everywhere (BS-period-3): what a report or
// register opens on is the fiscal year to date, the server's
// resolver's own answer for no dates, and party totals count this
// calendar year.
@@ -700,7 +700,7 @@ fn more_origins_and_parties() {
assert!(!r.missing_receipt, "a remittance isn't a hand-made entry");
}
/// Defect 8, repros 1.4.2 and 1.4.3 (rules.md B-32): Needs attention lists
/// Defect 8, repros 1.4.2 and 1.4.3 (BS-ledger-11): Needs attention lists
/// every revenue and expense account without a tax category, with
/// activity or not: one never used, one used only last fiscal year; never
/// a header, an account with a category, or an asset. Info under warn,
@@ -791,7 +791,7 @@ fn needs_attention_flags_every_uncategorized_pl_account_defect_8() {
assert!(item(&b).is_none());
}
/// "Show all dates" is every date (P3 settled in design, rules.md B-30):
/// "Show all dates" is every date (P3 settled in design, BS-period-3):
/// the register's and the reports' all-dates range runs from the first
/// posted entry through the later of today and the last, so an entry
/// dated after today is never left out of it (as party totals' "All time"