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:
1 parent
7a177a3cfc
commit
489360f598
221 files changed
+1706
-1580
No files matched your search
@@ -20,7 +20,7 @@ typst-layout = "0.15.1"
|
||||
qrcode = { version = "0.14.1", default-features = false, features = ["svg"] }
|
||||
# The reader (extract.rs moved out: D-61); re-exported as `extract`.
|
||||
ledger-reader = { path = "../ledger-reader" }
|
||||
# BSD-3-Clause: the IIF's transliteration to ASCII (iif.rs, rules.md B-34).
|
||||
# BSD-3-Clause: the IIF's transliteration to ASCII (iif.rs, BS-format-2).
|
||||
# Pinned exactly: a new table would change what a CPA's file says.
|
||||
deunicode = { version = "=1.6.0", default-features = false }
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
//! the tax table with its note's number.
|
||||
//! ```
|
||||
//!
|
||||
//! SOURCE (7-9): docs/spec/rules.md B-25;
|
||||
//! SOURCE (7-9): BS-asset-4;
|
||||
//! docs/spec/sources/irs-partnership-basis.md.
|
||||
|
||||
use crate::pdf::PdfError;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//! saying so.
|
||||
//! SOURCE: docs/spec/sources/intuit-iif.md (Intuit's IIF Overview, the IIF
|
||||
//! Import Kit's header help and its 2007+ General Journal example);
|
||||
//! rules.md B-34; Intuit's "Character limitations for fields in
|
||||
//! BS-format-2; Intuit's "Character limitations for fields in
|
||||
//! QuickBooks" (account name 31, account number 7, memo 4,095);
|
||||
//! DECISION (owner, 2026-10-20, plan D-36: plain ASCII,
|
||||
//! transliterated and listed; CR LF line endings); the kit's
|
||||
@@ -348,7 +348,7 @@ impl fmt::Display for IifChange {
|
||||
}
|
||||
}
|
||||
|
||||
/// `text` as a warning may show it (rules.md B-26: no full TIN): each run
|
||||
/// `text` as a warning may show it (BS-partner-2: no full TIN): each run
|
||||
/// of nine digits `ledger_core::parties::has_full_tin` finds masked (in
|
||||
/// any script's digits and separators: "123-45-6789"), and if the
|
||||
/// text still holds one once written as a field, every numeral in it
|
||||
|
||||
@@ -183,7 +183,7 @@ fn account_lines(lines: &[StatementLine]) -> impl Iterator<Item = Row> + '_ {
|
||||
///
|
||||
/// ```text
|
||||
/// GOAL: the P&L as printed, footing.
|
||||
/// SOURCE: docs/spec/rules.md B-14; footing (each column adds to its
|
||||
/// SOURCE: BS-statement-3; footing (each column adds to its
|
||||
/// printed totals) is the reader's check on any statement.
|
||||
/// INVARIANTS:
|
||||
/// 1. Revenue lines sum to "Total revenue"; expense lines to "Total
|
||||
@@ -221,7 +221,7 @@ pub struct YearEarnings {
|
||||
///
|
||||
/// ```text
|
||||
/// GOAL: the balance sheet as printed, footing and balancing.
|
||||
/// SOURCE: rules.md B-7 (the accounting equation); footing.
|
||||
/// SOURCE: BS-statement-2 (the accounting equation); footing.
|
||||
/// INVARIANTS:
|
||||
/// 1. Asset lines sum to "Total assets", liability lines to "Total
|
||||
/// liabilities", equity lines (accounts and the earnings lines) to the
|
||||
@@ -317,7 +317,7 @@ pub fn balance_sheet(
|
||||
)
|
||||
}
|
||||
|
||||
/// Lay out a statement of cash flows, direct method (rules.md B-14, D-35):
|
||||
/// Lay out a statement of cash flows, direct method (BS-statement-3, D-35):
|
||||
/// operating cash one row per class ASC 230-10-45-25 requires; investing
|
||||
/// and financing one row per kind ("Contributions from members — Name"),
|
||||
/// each with its total and its transactions listed under it; then the
|
||||
@@ -326,7 +326,7 @@ pub fn balance_sheet(
|
||||
///
|
||||
/// ```text
|
||||
/// GOAL: the statement of cash flows as printed, footing and reconciling.
|
||||
/// SOURCE: rules.md B-14 (ASC 230-10-45-24, -25, -29, -30; 50-3, 50-6:
|
||||
/// SOURCE: BS-statement-3 (ASC 230-10-45-24, -25, -29, -30; 50-3, 50-6:
|
||||
/// the noncash schedule on the same page); D-35 (layout by kind).
|
||||
/// INVARIANTS:
|
||||
/// 1. The operating class rows sum to "Net cash from operating
|
||||
@@ -425,7 +425,7 @@ pub fn cash_flow(cf: &CashFlowStatement) -> Statement {
|
||||
///
|
||||
/// ```text
|
||||
/// GOAL: the trial balance as printed, footing.
|
||||
/// SOURCE: rules.md B-6 (the trial balance balances; B-1); footing.
|
||||
/// SOURCE: BS-statement-1 (the trial balance balances; BS-entry-1); footing.
|
||||
/// INVARIANTS:
|
||||
/// 1. Each column's lines sum to its total; the totals are equal for
|
||||
/// balanced books.
|
||||
@@ -462,7 +462,7 @@ pub fn trial_balance(tb: &TrialBalance, as_of: NaiveDate) -> Statement {
|
||||
///
|
||||
/// ```text
|
||||
/// GOAL: each member's capital roll-forward as printed.
|
||||
/// SOURCE: rules.md B-13 (Form 1065 Schedule K-1, Item L); footing.
|
||||
/// SOURCE: BS-partner-1 (Form 1065 Schedule K-1, Item L); footing.
|
||||
/// INVARIANTS:
|
||||
/// 1. In every column, beginning + contributions + net income +
|
||||
/// distributions (printed negative) + other = ending.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! The audit workpaper as a PDF (plan P8; rules.md B-45).
|
||||
//! The audit workpaper as a PDF (plan P8; BS-ledger-13).
|
||||
//!
|
||||
//! ```text
|
||||
//! GOAL: one document a CPA or the owner can read that says what was
|
||||
|
||||
@@ -554,7 +554,7 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// cash_flow INVARIANTS 1-5 (direct method, rules.md B-14, D-35): the
|
||||
/// cash_flow INVARIANTS 1-5 (direct method, BS-statement-3, D-35): the
|
||||
/// operating class rows foot to "Net cash from operating activities",
|
||||
/// each other section's kind rows to theirs, and each kind's
|
||||
/// transaction details to its kind's row; the three sum to
|
||||
@@ -1637,7 +1637,7 @@ proptest! {
|
||||
let name = if name.trim().is_empty() { "x" } else { name.as_str() };
|
||||
let parent = parent.map(|p| ids[p]);
|
||||
// Replayed, as books written before P3 hold them: a sibling's
|
||||
// name, a tab, nine digits (rules.md B-31 refuses them in a
|
||||
// name, a tab, nine digits (BS-ledger-10 refuses them in a
|
||||
// new name, never in a journaled one).
|
||||
ids.push(l.replay_add_account(&code_of(i), name, AccountType::Expense, parent, false).unwrap());
|
||||
}
|
||||
@@ -2046,8 +2046,8 @@ fn iif_writes_plain_ascii_and_lists_every_change() {
|
||||
("6050", "René 😀"),
|
||||
("6070", "Wide number"),
|
||||
] {
|
||||
// Replayed: a tab in a name is refused in a new one (rules.md
|
||||
// B-31), never in one books written before P3 hold.
|
||||
// Replayed: a tab in a name is refused in a new one (
|
||||
// BS-ledger-10), never in one books written before P3 hold.
|
||||
l.replay_add_account(code, name, AccountType::Expense, None, false)
|
||||
.unwrap();
|
||||
}
|
||||
@@ -2154,7 +2154,7 @@ fn iif_every_line_ends_cr_lf() {
|
||||
fn iif_distinct_accounts_never_share_a_name() {
|
||||
let mut l = Ledger::new(Currency::USD);
|
||||
// Replayed, as books written before P3 hold them: siblings of one
|
||||
// name (rules.md B-31 refuses one in a new name, never in a journaled
|
||||
// name (BS-ledger-10 refuses one in a new name, never in a journaled
|
||||
// one), which the file must still keep apart.
|
||||
let mut add = |code: &str, name: &str, parent: Option<&str>| {
|
||||
let p = parent.map(|c| l.chart().find_by_code(c).unwrap().id);
|
||||
@@ -2546,7 +2546,7 @@ fn iif_warnings_group_the_memos_by_what_is_written_differently() {
|
||||
);
|
||||
}
|
||||
|
||||
/// INVARIANT 7: no warning holds a full TIN (rules.md B-26), though entry
|
||||
/// INVARIANT 7: no warning holds a full TIN (BS-partner-2), though entry
|
||||
/// descriptions and account names aren't checked for one: a memo's TIN
|
||||
/// written with en dashes shows only the dashes; one in fullwidth digits,
|
||||
/// one in Arabic-Indic digits, and an account name holding one, are
|
||||
@@ -2557,7 +2557,7 @@ fn iif_warnings_group_the_memos_by_what_is_written_differently() {
|
||||
fn iif_warnings_never_hold_a_tin() {
|
||||
let (mut l, cash, rev, _) = small_ledger();
|
||||
// Replayed, as books written before P3 hold them: a name holding a
|
||||
// TIN, or a tab, is refused in a new name (rules.md B-31), never in a
|
||||
// TIN, or a tab, is refused in a new name (BS-ledger-10), never in a
|
||||
// journaled one, so the file must still mask it.
|
||||
l.replay_add_account(
|
||||
"6300",
|
||||
@@ -4009,7 +4009,7 @@ fn tax_summary_difference_and_schedule_k() {
|
||||
);
|
||||
}
|
||||
|
||||
/// A gain on business property (rules.md B-32; ledger_core::tax
|
||||
/// A gain on business property (BS-ledger-11; ledger_core::tax
|
||||
/// `TaxSummary::form_4797`): on a Schedule C business's summary it is in
|
||||
/// its own Form 4797 section, at its book amount with no tax amount, and
|
||||
/// outside the net, never Schedule C income.
|
||||
@@ -5077,7 +5077,7 @@ fn iif_writes_each_lines_class_and_declares_the_classes_first() {
|
||||
}
|
||||
|
||||
/// iif INVARIANT 9: a class's NAME is written as an account's own level
|
||||
/// is (B-34 rules 3, 4): plain ASCII, a colon a '-' (a colon starts a
|
||||
/// is (BS-format-2 rules 3, 4): plain ASCII, a colon a '-' (a colon starts a
|
||||
/// subclass, the `!CLASS` header help), trimmed, at most NAME_MAX; names
|
||||
/// alike ignoring case once written get " (id)", round after round, as
|
||||
/// accounts get their codes; and each name written differently is a
|
||||
|
||||
Reference in new issue
Block a user