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

+5 -5
View File
@@ -16,7 +16,7 @@ pub(crate) fn account_type(a: &AccountSpec, id: &str) -> AccountType {
}
/// The period `[from, to]` a period query covers, each date omitted
/// resolved by the one rule (rules.md B-30) on `setup.today`; panics on
/// resolved by the one rule (B-30) on `setup.today`; panics on
/// `as_of`, on an omitted date without `setup.today`, and on a period the
/// rule refuses.
pub(crate) fn period(ex: &Example, x: &Expect) -> (NaiveDate, NaiveDate) {
@@ -55,8 +55,8 @@ pub(crate) fn resolved_q_period(
defaults(ex, &q.name).statement(from, to)
}
/// The day an as-of query is made as of (omitted: `setup.today`, rules.md
/// B-30); panics on `from` or `to`.
/// The day an as-of query is made as of (omitted: `setup.today`,
/// BS-period-3); panics on `from` or `to`.
pub(crate) fn day(ex: &Example, x: &Expect) -> NaiveDate {
let q = x.query();
resolved_q_day(ex, &q).unwrap_or_else(|e| panic!("{}: {}: {e}", ex.id, x.query))
@@ -83,12 +83,12 @@ pub(crate) trait Pipe: Sized {
}
}
impl<T> Pipe for T {}
/// What an omitted date means for `ex` (rules.md B-30): its fiscal year
/// What an omitted date means for `ex` (B-30): its fiscal year
/// on `setup.today`, which `query` needs.
pub(crate) fn defaults(ex: &Example, query: &str) -> PeriodDefaults {
let today = ex.setup.today.as_deref().unwrap_or_else(|| {
panic!(
"{}: {query} omits a date: setup.today says what it means (rules.md B-30)",
"{}: {query} omits a date: setup.today says what it means (B-30)",
ex.id
)
});