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

+8 -8
View File
@@ -42,7 +42,7 @@ fn usd(cents: i64) -> Money {
fn post(l: &mut Ledger, date: NaiveDate, desc: &str, lines: &[(AccountId, Side, i64)]) -> EntryId {
// As replay posts it: these books hold hand lines on receivables or
// payables (1200, 2000), which books an earlier version wrote still
// hold and every report must read; the control guard (rules.md B-38)
// hold and every report must read; the control guard (BS-arap-2)
// refuses them as new work.
ledger_core::parties::replaying(|| {
let e = l.create_entry(date, desc);
@@ -1115,7 +1115,7 @@ fn me_unexplained_equity_change_goes_in_other() {
/// 50.00).
///
/// ASSUMED: a closing entry's credit to a member's capital account is not
/// reported as a contribution (B-11: a close moves earnings), so January's
/// reported as a contribution (BS-period-1: a close moves earnings), so January's
/// statement shows contributions 1000 / 0, income 50.01 / 50.00.
#[test]
fn me_after_members_close_does_not_count_close_as_contribution() {
@@ -1473,7 +1473,7 @@ fn cf_undesignated_liability_is_operating() {
assert_eq!(cf.net_change_in_cash, c(58000));
}
/// Oracle: CF INVARIANT 5 / B-14 — closing entries never counted: after
/// Oracle: CF INVARIANT 5 / BS-statement-3 — closing entries never counted: after
/// closing February into retained earnings the February statement is
/// unchanged (NI still 400, 3999 not in financing).
#[test]
@@ -1792,7 +1792,7 @@ fn build_ordered(gens: &[Gen], scale: i64, order: &[usize], tag: bool) -> Books
let mut entries = Vec::new();
// As replay posts it: these books hold hand lines on receivables or
// payables (1200, 2000), which books an earlier version wrote still
// hold and every report must read; the control guard (rules.md B-38)
// hold and every report must read; the control guard (BS-arap-2)
// refuses them as new work.
ledger_core::parties::replaying(|| {
for g in gens {
@@ -1931,7 +1931,7 @@ fn opt_month() -> impl Strategy<Value = Option<u32>> {
proptest! {
#![proptest_config(ProptestConfig::with_cases(64))]
/// Oracle: TB INVARIANT 1 / B-6 — total debits equal total credits, and
/// Oracle: TB INVARIANT 1 / BS-statement-1 — total debits equal total credits, and
/// each total is its column's sum, for any as-of date, with or without a
/// close.
#[test]
@@ -2005,7 +2005,7 @@ proptest! {
prop_assert_eq!(many.total_debits, one.total_debits * kk);
}
/// Oracle: B-9 metamorphic — adding an entry and its reversal (same
/// Oracle: BS-ledger-5 metamorphic — adding an entry and its reversal (same
/// date) leaves TB and P&L unchanged at every date.
#[test]
fn prop_entry_plus_reversal_leaves_tb_and_pnl_unchanged(gens in arb_books(), extra in arb_gen(), as_of in 0u32..365) {
@@ -2222,7 +2222,7 @@ proptest! {
proptest! {
#![proptest_config(ProptestConfig::with_cases(64))]
/// Oracle: BS INVARIANT 1 / B-7 — assets = liabilities + equity (with
/// Oracle: BS INVARIANT 1 / BS-statement-2 — assets = liabilities + equity (with
/// current earnings), exactly; totals are line sums; never a revenue or
/// expense line; with or without a close (RE or members).
#[test]
@@ -2503,7 +2503,7 @@ proptest! {
/// Oracle: CF INVARIANT 2 against an independent model — financing is
/// the cash part of the equity and designated-debt movements: each
/// entry's cash applied to the sections moving against it, operating,
/// investing, financing, each up to its own movement (rules.md B-14
/// investing, financing, each up to its own movement (BS-statement-3
/// rule 3), then to the kinds within each section in their order;
/// plus what the loan or a member's capital paid or received for the
/// company (rule 11, D-42): the loan pays for operating lines (the