docs: sub-references name bookspec's statements, invariants and scenarios

Unit S-E rewrote each `B-n` citation to its bookspec id but kept the
sub-reference after it ("item 7", "rule 11", "INVARIANT 2"). Those
numbers counted parts of the retired rules.md text, so `BS-statement-5
item 7` pointed at finished and abandoned projects, not at the snapshot
it meant. Bookspec numbers a record's parts from 1 as `statement`,
`invariant` and `scenario`; every sub-reference now says so.

The map was built by content, not by position: each old item,
INVARIANT or SCENARIO was read in `git show ca8d676d5^:docs/spec/rules.md`
(the last full rule text), found in the pinned records
(bookspec bc92cf3) and in docs/spec/claims/, and each reference was
read in its context before it was mapped. Where the old numbering still
survives as the "Rule n" labels inside bookspec's statements (the cash
flow, party totals) the new number is that statement's position; where
a record carries the whole rule differently (the asset depreciation, the
IIF file, the arap invariants) the reference follows the content. Where
bookspec keeps no counterpart, the product rule that states it is cited
instead: WB-statement-5 (a project's facts and names), -7 (the snapshot),
WB-arap-4 (the document_standing feature), -8 (the issued PDF), -15 (a
payment event names its line), WB-ledger-15 (BS-ledger-12 is retired).
A reference that had pointed at the wrong part is corrected, for example
the discount-reason references that said BS-arap-6 INVARIANT 2 (a
bound) now say invariant 6 (the discount cap and date).

Only the reference tokens and their sentence change; no paragraph is
reflowed. A reference wrapped across a comment prefix keeps its wrap.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-09 03:30:06 -07:00
1 parent 609e4e6b26
commit e41cc3a161
78 files changed
+298 -302

No files matched your search

+1 -1
View File
@@ -152,7 +152,7 @@ pub enum StoreError {
#[error("store not found at {0}")]
NotFound(String),
/// A write-off with no evidence (BS-arap-5 INVARIANT 1): a bad
/// A write-off with no evidence (BS-arap-5 statement 10): a bad
/// debt is deducted on evidence that it is worthless (Treas. Reg.
/// §1.166-2), so the books take the write-off only with its file.
#[error(
+1 -1
View File
@@ -179,7 +179,7 @@ pub const ASSET_BASIS: &str = "asset_basis";
pub const PROJECTS: &str = "projects";
/// Feature: an `invoice.created` or `bill.created` line naming its project
/// (`class_id`, BS-statement-5 item 8). An older version would restore the
/// (`class_id`, BS-statement-5 statement 6). An older version would restore the
/// document without its lines' projects, silently. Its own feature, not
/// `projects`': books that consented to projects before it existed must
/// consent again before a document names one.
+6 -6
View File
@@ -507,7 +507,7 @@ struct AttachRequest<'a> {
}
/// The evidence a bad-debt write-off files (plan P4b S7; BS-arap-5
/// INVARIANT 1): the file that shows the debt is worthless — collection
/// statement 9): the file that shows the debt is worthless — collection
/// correspondence, a bankruptcy notice (Treas. Reg. §1.166-2). Given as
/// bytes to file in the same call, or as an attachment already in the
/// books that is linked to the write-off's entry and its invoice.
@@ -3446,7 +3446,7 @@ impl Store {
}
/// The issued copy of an invoice, filed in the call that issues it
/// (plan P4b S4.3 item 11, A-7; BS-arap-4 item 3): the entry, then
/// (plan P4b S4.3 item 11, A-7; BS-arap-4 invariant 3 and WB-arap-8): the entry, then
/// `invoice.created`, then `receipt.attached` on the entry
/// (`INV-0007.pdf`, `application/pdf`, "Issued invoice"), then
/// `attachment.linked` to the invoice. The server renders the PDF
@@ -3462,7 +3462,7 @@ impl Store {
/// GOAL: the copy sent is kept with the invoice, or nothing is.
/// SOURCE: IRS Pub. 583 (keep invoices); Rev. Proc. 98-25 (the audit
/// trail keeps the record as issued); plan P4b S4.3, 8.3.11;
/// BS-arap-4 item 3.
/// BS-arap-4 invariant 3 and WB-arap-8.
/// INVARIANTS:
/// 1. Every refusal (an unknown customer, an invalid line or due
/// date, a duplicate number, a closed period, a feature the books
@@ -4534,7 +4534,7 @@ impl Store {
/// ```text
/// GOAL: a project in one command, journaled as two events only when
/// it has facts, so a name-only project is a plain class.
/// SOURCE: BS-statement-5 item 1; BS-format-1 (journal feature
/// SOURCE: WB-statement-5; BS-format-1 (journal feature
/// `projects`).
/// INVARIANTS:
/// 1. A refusal journals nothing: the whole record is rehearsed, and
@@ -6848,7 +6848,7 @@ fn document_line_json(l: &DocumentLine) -> Value {
"amount": l.amount.to_string(),
});
// Its project, behind the feature document_line_projects (
// BS-format-1, BS-statement-5 item 8); a line naming none is written as before it.
// BS-format-1, BS-statement-5 statement 6); a line naming none is written as before it.
if let Some(c) = l.class_id {
v["class_id"] = json!(c);
}
@@ -6927,7 +6927,7 @@ fn invoice_fields_json(payload: &mut Value, fields: &arap::InvoiceFields) {
}
/// Add a bill's new fields to its `bill.created` payload, each key only when
/// set. A duplicate's reason is journaled for the record (BS-arap-4 item
/// set. A duplicate's reason is journaled for the record (BS-arap-4 invariant
/// 4); the bill itself keeps none.
fn bill_fields_json(payload: &mut Value, fields: &arap::BillFields) {
if let Some(r) = &fields.vendor_ref {