test(core): no retired rule number anywhere, SOURCE clauses checked whole

The retired-reference test now scans the whole text of every tracked file (git ls-files, skipping plan/, docs/spec/rules.md and docs/spec/claims/) for any word-boundary retired number from 1 to 45, wrapped references included, with an exact-count allow-list for the deliberately kept user-visible and golden strings; a count rising or falling fails. The SOURCE test now reads each whole clause with its continuations (crates/*/src, crates/*/tests and fuzz/), checks every bookspec and product-rule id in it, requires every path-like token to exist and every crate code reference to name a real item, counts clauses passing only through the free-text branch against a constant (56; 353 clauses checked), and keeps a floor on the total. The repo_root doc comment became the module header.

Lines the tightened check made fail, fixed in the lines not the test: relative sources/ and claims/ paths in form1099, instruments, kernel entries, money, kernel round and the 1099 tests now give full docs/spec paths; wrapped docs/spec/sources/ and docs/parties-and-attachments.md paths in ledger, store, reconciliation, tins and the GUI books module are joined; settings.rs names the real parser path instead of a runtime filename; the bounds tests name the real kernel and calendar files, and spec_bounds no longer cites rules.md for the line bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-11-08 20:02:08 -07:00
1 parent 9aeee94fd2
commit 8d3cc5056f
16 files changed
+349 -128

No files matched your search

+4 -4
View File
@@ -84,7 +84,7 @@ impl Form1099 {
/// Why a vendor gets no 1099: the kind of payee no return is required
/// for. Each has its authority ([`ExemptReason::citation`],
/// sources/irs-1099-payment-method.md); a decision adds the facts in
/// docs/spec/sources/irs-1099-payment-method.md); a decision adds the facts in
/// words.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
@@ -430,8 +430,8 @@ pub fn check_new_decision(decisions: &[Dated1099], new: &Dated1099) -> Result<Ap
/// GOAL: the dollar amount at which a vendor's payments become reportable.
/// SOURCE: BS-1099-1 (26 U.S.C. §6041(a), (h), §6041A(a)(2),
/// Pub. L. 119-21 §70433(f): payments made after December 31,
/// 2025; sources/irs-1099-thresholds.md,
/// sources/irs-1099-payment-method.md).
/// 2025; docs/spec/sources/irs-1099-thresholds.md,
/// docs/spec/sources/irs-1099-payment-method.md).
/// SCENARIOS:
/// 1. IF `year` <= 2025: SHOULD be $600.
/// 2. IF `year` == 2026: SHOULD be $2,000.
@@ -872,7 +872,7 @@ fn bounds(
/// the year; Treas. Reg. §1.6041-1(a)(1)(iv): card and network
/// payments go on Form 1099-K; §1.6041-1(e)(1): the company is the
/// payor when a member pays its bill; §1.6041-3: payees no return
/// is required for; sources/irs-1099-payment-method.md);
/// is required for; docs/spec/sources/irs-1099-payment-method.md);
/// crate::shares (an entry with several parties, each with their
/// share; DECISION, owner, 2026-10-15); DECISION D-40 (owner,
/// 2026-10-20: dated decisions; a bank payment with no method
+1 -1
View File
@@ -18,7 +18,7 @@
//! SOURCE: BS-1099-1 (Treas. Reg. §1.6041-1(a)(1)(iv),
//! §1.6050W-1(b)(1), (b)(3), (c)(3); Instructions for Form 1099-K:
//! automated clearing houses are not payment networks;
//! sources/irs-1099-payment-method.md); plan/served.md 4.9, 5.2.
//! docs/spec/sources/irs-1099-payment-method.md); plan/served.md 4.9, 5.2.
//! INVARIANTS:
//! 1. A label is one line, at most settings::MAX_TEXT characters, holds
//! no full TIN, and is unique among instruments (ignoring case and
+1 -1
View File
@@ -650,7 +650,7 @@ impl Bucket {
/// transaction reportable under §6050W is not reported under
/// §6041; §1.6041-1(e)(1): a member writing a check at the
/// company's direction doesn't make the member the payor;
/// sources/irs-1099-payment-method.md); DECISION D-40 (owner,
/// docs/spec/sources/irs-1099-payment-method.md); DECISION D-40 (owner,
/// 2026-10-20: a bank payment with no method recorded counts).
/// INVARIANTS (first match wins):
/// 1. The tag names this line's account: Card for a card or network,
+2 -2
View File
@@ -32,9 +32,9 @@ pub enum Rounding {
/// unit, once, with the mode named at the call.
/// SOURCE: docs/spec/claims/ledger.md BS-ledger-1 (a ledger in one money holds no
/// fractions of its smallest unit; FX books the base currency's
/// minor unit, half away from zero), claims/entry.md BS-entry-3 (exact
/// minor unit, half away from zero), docs/spec/claims/entry.md BS-entry-3 (exact
/// amounts in the books; round only where a rule says to), and
/// claims/ledger.md BS-ledger-11; the call sites' own rules (BS-partner-1, BS-statement-3,
/// docs/spec/claims/ledger.md BS-ledger-11; the call sites' own rules (BS-partner-1, BS-statement-3,
/// BS-asset-1, BS-prepaid-1, BS-1099-1, BS-partner-3, BS-partner-4, BS-statement-5); owner decision D-69 (the
/// laws live once, in bookspec's Lean).
/// INVARIANTS:
+2 -2
View File
@@ -2993,8 +2993,8 @@ impl Ledger {
/// GOAL: the register carries the tax figures beside book value, each
/// named for what it is, so book and tax never get confused and
/// the CPA sees both.
/// SOURCE: BS-asset-4; docs/spec/sources/
/// irs-partnership-basis.md; DECISION D-41 (owner, 2026-10-20).
/// SOURCE: BS-asset-4; DECISION D-41 (owner, 2026-10-20);
/// docs/spec/sources/irs-partnership-basis.md.
/// INVARIANTS:
/// 1. The record passes AssetBasis::check: a purchase takes no
/// contribution facts; a contribution needs the adjusted basis and
+1 -1
View File
@@ -214,7 +214,7 @@ impl fmt::Debug for Money {
/// smallest unit (cents, whole yen, thousandths of a dinar), never a
/// fixed two places.
/// SOURCE: BS-ledger-1 (no fraction of the minor unit; ISO 4217,
/// sources/iso-4217.md).
/// docs/spec/sources/iso-4217.md).
/// INVARIANTS:
/// 1. amount = units × 10^-scale exactly; unit = 10^(scale − minor).
/// 2. A currency with no minor unit (gold, SDRs) counts as two places.
+1 -1
View File
@@ -12,7 +12,7 @@
//! sees the same way.
//! SOURCE: plan/served.md I-3 (the journal holds all books state) and 5.3
//! (setting keys); the validators carried over from
//! ledger-config's wanderbooks.toml parser, whose SOURCE lines
//! the `crates/ledger-config/src/lib.rs` parser (`parse`), whose SOURCE lines
//! they keep (IRS Pub. 538, Treas. Reg. §301.7701-3, IRC §704(a)).
//! INVARIANTS:
//! 1. Only keys in KEYS exist; a value is checked by its key's kind