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

+2 -2
View File
@@ -1,10 +1,10 @@
//! Audits and attestations over the wire (plan P8; rules.md B-45, D-9):
//! Audits and attestations over the wire (plan P8; BS-ledger-13, D-9):
//! a deterministic run and workpaper, claims weighed against the bar when
//! asked, the CPA package that waits for a counted audit, and books that
//! have not declared `audits`.
//!
//! Expected behavior comes from `docs/mcp-interface.md` ("Tools — audit
//! and attestations") and rules.md B-45. Every call goes through a real
//! and attestations") and BS-ledger-13. Every call goes through a real
//! books server as an agent reaches it (`common.rs`).
mod common;
+10 -10
View File
@@ -2,7 +2,7 @@
//! (common.rs): the preview that writes nothing, the confirm that posts,
//! numbers, terms, line accounts, party snapshots and the issued copy filed
//! with the invoice (plan/served.md 8.2 P4b S4 item 17; docs/mcp-interface.md
//! "Tools — A/R and A/P"; rules.md B-39, B-40; D-55).
//! "Tools — A/R and A/P"; BS-arap-3, BS-arap-4; D-55).
//!
//! Every refusal is checked to leave the journal byte for byte as it was.
@@ -218,7 +218,7 @@ fn an_invoice_from_issue_to_paid() {
}
/// A bill keeps the vendor's invoice, names its own accounts, and carries
/// its terms' discount dates (A-10, A-13; B-39).
/// its terms' discount dates (A-10, A-13; BS-arap-3).
#[test]
fn a_bill_with_its_vendor_invoice_and_terms() {
let books = Books::new("documents-bill");
@@ -304,7 +304,7 @@ fn a_bill_with_its_vendor_invoice_and_terms() {
}
/// One vendor's invoice number, entered twice: refused unless a reason is
/// given, which is journaled with the second bill (B-40).
/// given, which is journaled with the second bill (BS-arap-4).
#[test]
fn duplicate_vendor_invoice_refused() {
let books = Books::new("documents-duplicate");
@@ -347,7 +347,7 @@ fn duplicate_vendor_invoice_refused() {
/// A line's account obeys the document's kind: revenue or a role-free
/// liability on an invoice, an expense or a non-cash role-free asset on a
/// bill; a role account, cash, a placeholder or none at all is refused
/// (A-10, A-11; rules.md B-39).
/// (A-10, A-11; BS-arap-3).
#[test]
fn a_line_account_must_be_allowed() {
let books = Books::new("documents-accounts");
@@ -927,7 +927,7 @@ mod paying_on_terms {
/// One deposit settles two invoices of one customer: one entry, one
/// receivable line per invoice, each tagged with its own invoice, and the
/// output names both documents (B-42 INVARIANTS 1 and 3).
/// output names both documents (BS-arap-6 INVARIANTS 1 and 3).
#[test]
fn one_payment_settles_two_invoices() {
let mut s = setup("settle-two");
@@ -984,7 +984,7 @@ mod paying_on_terms {
}
/// A discount outside the document's terms needs a reason; with one the
/// payment is taken and recorded (B-42 INVARIANT 2; the terms are S4.3's
/// payment is taken and recorded (BS-arap-6 INVARIANT 2; the terms are S4.3's
/// to journal, so this bill states none).
#[test]
fn late_discount_needs_a_reason() {
@@ -1013,7 +1013,7 @@ mod paying_on_terms {
}
/// A fee posts gross (A-4): the deposit gets the net, the fee its expense,
/// and A/R is credited the gross (B-42 INVARIANT 1).
/// and A/R is credited the gross (BS-arap-6 INVARIANT 1).
#[test]
fn a_fee_posts_gross_to_receivables_and_net_to_the_bank() {
let mut s = setup("fee-gross");
@@ -1075,7 +1075,7 @@ mod paying_on_terms {
}
/// Two bills paid in one entry count once toward 1099s and the party's
/// totals (B-42; 8.3.16's multi-document risk).
/// totals (BS-arap-6; 8.3.16's multi-document risk).
#[test]
fn multi_document_payment_counts_once_for_1099_and_party_totals() {
let mut s = setup("multi-1099");
@@ -1131,7 +1131,7 @@ mod paying_on_terms {
/// The bills-due list orders by due date and gives the running total
/// through each date; the agings' detail rows and their tie-out agree with
/// the control check (8.3.10; B-42).
/// the control check (8.3.10; BS-arap-6).
#[test]
fn bills_due_orders_by_due_and_discount() {
let mut s = setup("bills-due");
@@ -1383,7 +1383,7 @@ mod bad_debts {
assert_eq!(check["agrees"], json!(true), "{check}");
}
/// P4b S7: no evidence, no write-off (B-41 INVARIANT 1): the tool refuses
/// P4b S7: no evidence, no write-off (BS-arap-5 INVARIANT 1): the tool refuses
/// with neither or both, and an attachment already filed is linked
/// instead of a new file.
#[test]
+3 -3
View File
@@ -1,12 +1,12 @@
//! Drafts, the evidence gate and the preview digest over the wire (plan
//! P4; rules.md B-43, D-47, D-50): a draft waits for its receipt and
//! P4; BS-entry-5, D-47, D-50): a draft waits for its receipt and
//! posts when it arrives, a discard unblocks a close, a report and the CPA
//! package say when drafts are open, a reversal needs no receipt of its
//! own, and every tool with `confirmed` takes the `preview` it returned
//! and refuses a stale one.
//!
//! Expected behavior comes from `docs/mcp-interface.md` ("Tools — drafts",
//! "The preview digest") and rules.md B-43. Every call goes through a real
//! "The preview digest") and BS-entry-5. Every call goes through a real
//! books server as an agent reaches it (`common.rs`).
mod common;
@@ -129,7 +129,7 @@ fn a_draft_waits_for_its_receipt_and_posts() {
assert!(listed["drafts"].as_array().unwrap().is_empty());
}
/// B-43: the structured `receipt_required` error is the one the MCP built
/// BS-entry-5: the structured `receipt_required` error is the one the MCP built
/// before the gate moved into the store.
#[test]
fn the_gate_moved_and_the_mcp_error_is_unchanged() {
+2 -2
View File
@@ -3,7 +3,7 @@
//! backfill command.
//!
//! Expected behavior comes from `docs/mcp-interface.md` ("Tools —
//! evidence", "Tools — receipts & documents") and rules.md B-44. Every
//! evidence", "Tools — receipts & documents") and BS-ledger-12. Every
//! call goes through a real books server as an agent reaches it
//! (`common.rs`).
@@ -318,7 +318,7 @@ fn annotations_and_searches() {
assert_eq!(answer_of(&r).unwrap()["status"], "ok");
}
/// Plan P6 step 4 and rules.md B-44 item 5: consolidation never leaves an
/// Plan P6 step 4 and BS-ledger-12 item 5: consolidation never leaves an
/// entry the receipt policy covers with no evidence.
#[test]
fn consolidation_never_removes_an_entrys_only_evidence() {
+2 -2
View File
@@ -844,8 +844,8 @@ fn books_p2_served_cut_over_whole() {
"confirmed": true}),
),
// An invoice carrying documents_v2's fields (terms: P4b S4.4) and
// its line naming its project (document_line_projects, rules.md
// B-37 item 8).
// its line naming its project (document_line_projects,
// BS-statement-5 item 8).
(
"books.create_invoice",
json!({"customer": "1", "date": "2026-02-10", "terms": "Net 30",
+4 -4
View File
@@ -109,12 +109,12 @@ impl Mcp {
/// Start (or restart) the server on books an earlier version wrote,
/// with the fixture company's settings set as an agent sets them, one
/// at a time. Books in a journal format before 2 keep no settings
/// until the owner's format upgrade (rules.md B-27, D-39): each change
/// until the owner's format upgrade (BS-format-1, D-39): each change
/// is refused as `format_upgrade_pending`, and those books are served
/// on the defaults (no members, no 1065, no cash accounts), as they
/// would be in a data root. Books with periods closed under the
/// calendar year keep it (a changed tax year needs the IRS's consent,
/// rules.md B-29), whatever their format. Any other answer fails the
/// BS-ledger-9), whatever their format. Any other answer fails the
/// test when the books are first served (`first`); on a restart,
/// after hostile calls that may have changed a setting and closed
/// periods under it, the books may refuse a change for what they now
@@ -898,7 +898,7 @@ fn hostile_tool_arguments_never_stop_the_server() {
/// INVARIANT 4: whatever the calls journaled, the books open again. A
/// hostile call a command accepts but replay refuses would leave books
/// that never reopen (rules.md B-28): the server is restarted on them and
/// that never reopen (BS-entry-4): the server is restarted on them and
/// must answer books.chart and books.verify.
fn reopens(m: Mcp, p: &Places, after: &str) {
drop(m);
@@ -1449,7 +1449,7 @@ fn reads_of_old_books() -> Vec<(&'static str, Value)> {
}
/// Books an earlier version wrote open, and every tool answers over them
/// (rules.md B-28: posted is forever; a figure the books can't compute is
/// (BS-entry-4: posted is forever; a figure the books can't compute is
/// refused, never a panic). Against each fixture: the reads above, then
/// OLD_BOOKS_CASES (default 3) generated calls of every tool; after them
/// the server restarts and must open the books again (a call a command
+12 -12
View File
@@ -1081,7 +1081,7 @@ fn mcp_import_export() {
// The IIF is plain ASCII text with CR LF line endings, handed over
// (D-46); what it writes differently from the books is in warnings
// (rules.md B-34).
// (BS-format-2).
let iif = mcp.call(
"books.export",
json!({"format": "iif", "report": "journal"}),
@@ -1344,7 +1344,7 @@ fn mcp_period_statements() {
assert_eq!(feb["net_income"], "-0.50");
assert_eq!(feb["expense_accounts"][0]["code"], "6000");
assert_eq!(feb["expense_accounts"][0]["amount"], "3.00");
// No start (rules.md B-30): the fiscal year that holds the end, to
// No start (BS-period-3): the fiscal year that holds the end, to
// it. The fiscal year starts 02-01, so January's 4.00 of sales is
// last year's, and February's 2.50 is this one's.
let ytd = mcp.call("books.profit_and_loss", json!({"end": "2026-02-28"}));
@@ -1616,7 +1616,7 @@ fn mcp_partnership_from_template() {
);
}
/// Contract (rules.md B-13, D-10; docs/mcp-interface.md close_period and
/// Contract (BS-partner-1, D-10; docs/mcp-interface.md close_period and
/// list_periods): a close to the members shows each member's running
/// split, the same in the preview as once confirmed, and the periods say
/// which rule they closed under. Two members at 50% each, hand-computed:
@@ -1748,7 +1748,7 @@ fn close_period_shows_each_members_running_split() {
assert_eq!(me["members"][1]["ending"], "0.01");
}
/// Contract (rules.md B-13, D-10; docs/mcp-interface.md list_periods and
/// Contract (BS-partner-1, D-10; docs/mcp-interface.md list_periods and
/// close_period) on books an earlier version wrote: ledger-store's
/// old-books fixture x_member_closes (two members at 50%, A with a
/// distributions account; three closes untagged, three
@@ -2214,7 +2214,7 @@ fn mcp_vendor_1099() {
let r = mcp.call("books.vendor_1099", json!({"year": 2026}));
assert_eq!(r["vendors"][0]["paid"], "0.00");
// A year whose threshold isn't known yet: refused, with what to do
// (rules.md B-19). An explicit threshold works.
// (BS-1099-1). An explicit threshold works.
let why = mcp.call_err("books.vendor_1099", json!({"year": 2027}));
for needle in [
"only through 2026",
@@ -2311,7 +2311,7 @@ fn mcp_receipts_always_required_when_threshold_is_zero() {
}
/// `books.cash_flow` with no accounts passed reads the roles from
/// `[books]` in wanderbooks.toml (rules.md B-14): the expense the owners
/// `[books]` in wanderbooks.toml (BS-statement-3): the expense the owners
/// paid through 2100 is borrowed from them and spent on its date, each
/// line with `on_behalf` (D-42, rule 11); repaying the advance is
/// financing; a loan to a member is investing; the statement is the direct
@@ -2419,7 +2419,7 @@ fn cash_flow_reads_its_account_roles_from_the_books_settings() {
}
}
/// rules.md B-14 rule 2: roles that contradict the chart are refused,
/// BS-statement-3 rule 2: roles that contradict the chart are refused,
/// naming the setting and the fix, never a statement on a wrong partition.
#[test]
fn cash_flow_refuses_contradictory_roles() {
@@ -2727,7 +2727,7 @@ fn post_pair(mcp: &mut Mcp, date: &str, dr: &str, cr: &str, amount: &str) -> u64
id
}
/// Defect 16 (rules.md B-30): one default period everywhere. On books with
/// Defect 16 (BS-period-3): one default period everywhere. On books with
/// a July fiscal year and a first entry in the fiscal year before, every
/// period report given only an end covers the fiscal year that holds it
/// (2025-07-01 through 2026-03-31, never the first entry's day, never
@@ -2858,8 +2858,8 @@ fn iif_docnums(iif: &str) -> Vec<u64> {
ids
}
/// The default period (rules.md B-30) against the IIF (B-34, D-36) and
/// the CPA package (B-33): a general journal asked for without dates is
/// The default period (BS-period-3) against the IIF (BS-format-2, D-36) and
/// the CPA package (BS-statement-4): a general journal asked for without dates is
/// the fiscal year to date, but the IIF is never a period. Without dates
/// it holds every posted entry from the first through today, under
/// either name of the report, and a start or end is refused; the
@@ -2956,7 +2956,7 @@ fn the_default_period_never_shortens_the_iif_or_the_package() {
assert_eq!(iif_docnums(&read("general-journal.iif")), every[..3]);
}
/// Defect 15 (rules.md B-31) over the real binary: books.rename_account
/// Defect 15 (BS-ledger-10) over the real binary: books.rename_account
/// gives an account a new name and nothing else. The chart shows it; a
/// past period's P&L export prints it; the general journal's IIF declares
/// the account by it; the books verify, the journal grew by the rename
@@ -3082,7 +3082,7 @@ fn rename_account_end_to_end_defect_15() {
);
}
/// Review R10 (rules.md B-31): on books that name no cash accounts
/// Review R10 (BS-ledger-10): on books that name no cash accounts
/// (books.cash_accounts unset, so they are picked by name), a rename that
/// moves an account into or out of the cash or card accounts says so; one
/// that moves nothing says nothing of them. A convention naming the old
+5 -5
View File
@@ -737,7 +737,7 @@ fn pnl_and_balance_sheet_exports_equal_the_core_statements() {
}
/// Cash flow CSV and JSON equal `ledger_core::cash_flow` for the same
/// account roles and members, field for field (rules.md B-14; the JSON is
/// account roles and members, field for field (BS-statement-3; the JSON is
/// the tool's own answer). Kills: export_cash_flow stubs and its json/csv
/// switch, and any field the mapping drops.
#[test]
@@ -1070,7 +1070,7 @@ fn journal_exports_hold_every_posted_line() {
let mut m = Mcp::start(&dir, "1000000.00");
for report in ["journal", "general_journal"] {
// Every date: the journal covers a period (rules.md B-30).
// Every date: the journal covers a period (BS-period-3).
let csv = m.export_text(
json!({"format": "csv", "report": report, "start": "0001-01-01", "end": "9999-12-31"}),
);
@@ -1419,7 +1419,7 @@ fn xlsx_and_pdf_exports_are_real_files_with_the_books_in_them() {
/// (cash accounts BANK, 1200 AR, 2000 AP, a registered asset's accounts
/// FIXASSET, the rest by type), then one balanced TRNS/SPL/ENDTRNS block
/// per posted entry dated on or before as_of, numbered (DOCNUM) with its
/// entry id (rules.md B-33, B-34); plain ASCII text with CR LF, what it
/// entry id (BS-statement-4, BS-format-2); plain ASCII text with CR LF, what it
/// writes differently (a line break and double quotes, the engine's own em
/// dashes) in warnings, grouped. Kills: export_iif's AR and AP comparisons.
#[test]
@@ -2505,7 +2505,7 @@ fn show_refuses_a_derived_inverted_range_defect_15() {
}
/// Defect 16, repro 1.1.4: books.show sends the dates it names, resolved
/// by the one default (rules.md B-30): only an end covers that end's
/// by the one default (BS-period-3): only an end covers that end's
/// fiscal year to it (2025-01-01 to 2025-06-30, never today's year's
/// start); no dates cover today's fiscal year to date (checked against
/// the clock read before and after, R14); a report as of a day says "as
@@ -3631,7 +3631,7 @@ fn cpa_package_holds_the_year_and_its_evidence() {
"tin_last4",
],
);
// Through as_of (rules.md B-33), out of the package's cash account
// Through as_of (BS-statement-4), out of the package's cash account
// and the settings' financing account (one list each per package).
let want = core_1099_through(&ledger, 2025, None, Some(d(END)));
assert_eq!(w.len(), want.vendors.len());
+1 -1
View File
@@ -60,7 +60,7 @@ struct Expected {
}
/// Every figure the tools report on the seam review's books is the
/// engine's for the same accounts and dates, on every date (B-33's "the
/// engine's for the same accounts and dates, on every date (BS-statement-4's "the
/// tool's for the same accounts and through"), and party totals for the
/// year are the engine's on both bases.
#[test]
+2 -2
View File
@@ -1,4 +1,4 @@
//! A project's snapshot (rules.md B-37 item 7) in the viewer and from the
//! A project's snapshot (BS-statement-5 item 7) in the viewer and from the
//! books server, on the same books: `books.project`'s strings are the
//! figures the viewer's page draws (its `PageFigures` and `Snap`), to the
//! cent, to date, by account, by month with the running net, and for the
@@ -208,7 +208,7 @@ fn a_projects_snapshot_is_the_same_in_the_viewer_and_from_the_server() {
assert_eq!(period["net"], "-722.22", "a refund and costs, no sale");
}
/// rules.md B-37 item 8: a project's invoiced revenue and billed costs,
/// BS-statement-5 item 8: a project's invoiced revenue and billed costs,
/// made through the books server's own tools, read the same in the viewer
/// (its snapshot, and the invoice's and bill's pages: each line's
/// project) and from the server (books.project, books.get_entry).
+2 -2
View File
@@ -285,7 +285,7 @@ fn books(name: &str) -> Mcp {
/// [`books`], as P2 left them when `p2`: journal format 2 with none of
/// P3's features, books an older version wrote, waiting for their format
/// upgrade (rules.md B-27).
/// upgrade (BS-format-1).
fn books_in(name: &str, p2: bool) -> Mcp {
let dir = test_dir(name);
if p2 {
@@ -610,7 +610,7 @@ fn a_members_method_off_the_financing_accounts_warns() {
assert!(out["warnings"].as_array().unwrap().is_empty(), "{out}");
}
/// B-27 and the format-upgrade gate (D-39): books.set_w9 journals the W-9
/// BS-format-1 and the format-upgrade gate (D-39): books.set_w9 journals the W-9
/// and then the vendor's W-9 flag, a line of the vendor_1099_decisions
/// feature, so it asks for the feature before the command's first line,
/// never between its lines. In books waiting for their format upgrade
+7 -7
View File
@@ -5,7 +5,7 @@
//! Expected behavior comes only from the tool descriptions and parameter /
//! result doc comments in `src/server.rs` and `src/types.rs` (the declared
//! interface, as `tools/list` serves it), `docs/mcp-interface.md` ("Tools —
//! fixed assets"), and `docs/spec/rules.md` B-24. The harness is the
//! fixed assets"), and BS-asset-3. The harness is the
//! minimal subset of `tests/spec_mcp.rs`: every success validates against
//! the tool's `outputSchema`, and every refusal leaves `journal.jsonl`
//! byte-identical (server invariant 2: a refused call changes nothing).
@@ -441,7 +441,7 @@ fn register_with_a_bad_tag_or_serial_registers_nothing() {
assert_eq!(t, "FL-0002");
}
/// A generated tag is never one any asset held (B-24).
/// A generated tag is never one any asset held (BS-asset-3).
#[test]
fn register_never_generates_a_released_tag() {
let mut m = books("released");
@@ -624,7 +624,7 @@ fn dispose_asset_takes_the_tag_and_the_tag_stays_reserved() {
confirm["receipt_attachment_ids"] = json!([doc]);
m.ok("books.dispose_asset", confirm);
assert_eq!(m.asset(a)["status"], "disposed");
// B-24: a disposed asset's tag is never reused.
// BS-asset-3: a disposed asset's tag is never reused.
m.refuse(
"books.label_asset",
json!({"asset": b.to_string(), "tag": t}),
@@ -815,7 +815,7 @@ fn export_fixed_asset_register_as_of_leaves_out_later_assets() {
assert!(!text.contains("LATE-1"), "{text}");
}
// ------------------------------------------------- tax basis (rules.md B-25)
// ------------------------------------------------- tax basis (BS-asset-4)
//
// From the `books.set_asset_tax_basis` and `books.register_asset`
// descriptions, `SetAssetTaxBasisParams` / `AssetBasisOut` /
@@ -1116,7 +1116,7 @@ fn register_asset_refuses_a_bad_basis_and_registers_nothing() {
assert_eq!(m.assets().len(), 1, "nothing registered");
}
// ------------------------------------------- the dates (rules.md B-15)
// ------------------------------------------- the dates (BS-asset-1)
/// purchase_date is an alias for in_service_date for one release, noted.
#[test]
@@ -1199,7 +1199,7 @@ fn acquired_date_comes_from_the_acquisition_entry() {
);
}
// ------------------------------- posted and scheduled (rules.md B-15 rule 8)
// ------------------------------- posted and scheduled (BS-asset-1 rule 8)
/// Named regression 1 (the brief's reproduction 1, its figures made up): a
/// $1,440.00 laptop, 36 months, in service 2026-05-15, nothing run. As of
@@ -1501,7 +1501,7 @@ fn dispose_args(x: u64, date: &str, proceeds: &str) -> Value {
/// days, 500.00 (the final depreciation); accumulated 5,500.00, book value
/// 6,500.00, gain 500.00. Afterwards books.asset_schedule ends there, and
/// books.list_assets lists it as gone: not held, every figure 0.00 (it
/// left the books with its disposal; rules.md B-15 rule 8). Before P3 the
/// left the books with its disposal; BS-asset-1 rule 8). Before P3 the
/// schedule showed June 7,000.00, accumulated 12,000.00, book value 0.00.
#[test]
fn a_disposed_asset_lists_what_it_depreciated_through_its_disposal() {
+2 -2
View File
@@ -1490,7 +1490,7 @@ enum Op {
party: Pick,
amount: String,
/// The vendor's own invoice number: two bills by one vendor with
/// the same number are refused (B-40).
/// the same number are refused (BS-arap-4).
vendor_ref: String,
},
PayBill {
@@ -2703,7 +2703,7 @@ fn db_digest(path: &Path) -> String {
ledger_store::journal::sha256_hex(dump.as_bytes())
}
/// P4b S1 over the real server (rules.md B-38, D-45): a payment carries
/// P4b S1 over the real server (BS-arap-2, D-45): a payment carries
/// its method and reference and answers with the invoice's derived
/// figures; an invoice with a payment standing can't be voided (the
/// refusal names the payment); one entered twice is voided and shows as
+1 -1
View File
@@ -963,7 +963,7 @@ fn party_totals_for_a_customer_a_member_and_a_prepaid() {
// A prepaid bought with a member's card: an asset, paid through what
// the members advanced. That is money when it is a financing account
// (rules.md B-35 item 5, P3 defect 24); unlisted, Due to Members is a
// (BS-partner-3 item 5, P3 defect 24); unlisted, Due to Members is a
// promise like any other liability, counted when the member is paid
// back.
let prepaid = |m: &mut Mcp| {
+4 -4
View File
@@ -7,7 +7,7 @@
//!
//! Expected behavior comes only from the tool descriptions and parameter /
//! result doc comments in `src/server.rs` and `src/types.rs` (as
//! `tools/list` serves them) and rules.md B-35. The harness is the minimal
//! `tools/list` serves them) and BS-partner-3. The harness is the minimal
//! subset of `tests/spec_mcp.rs` (copied from `tests/spec_parties.rs`):
//! every success validates against the tool's `outputSchema`, and every
//! refusal leaves `journal.jsonl` byte-identical.
@@ -291,7 +291,7 @@ fn books(name: &str) -> Mcp {
/// [`books`], as P2 left them when `p2`: journal format 2 with none of
/// P3's features, books an older version wrote, waiting for their format
/// upgrade (rules.md B-27).
/// upgrade (BS-format-1).
fn books_in(name: &str, p2: bool) -> Mcp {
let dir = test_dir(name);
if p2 {
@@ -380,7 +380,7 @@ fn reverse(m: &mut Mcp, entry: u64, date: &str) -> u64 {
.unwrap_or_else(|| panic!("a reversal of {entry}"))
}
/// Defect 14 over the MCP (rules.md B-35): `resolved` is signed as a line
/// Defect 14 over the MCP (BS-partner-3): `resolved` is signed as a line
/// on the party's own account, with its direction and its money and
/// property; a reversal is the exact opposite; party totals take a basis,
/// cash by default and echoed, all adding property in kind, so that a
@@ -603,7 +603,7 @@ fn defect24_creditor_of_round_trips_and_a_card_fee_is_not_a_payment() {
assert_eq!(m.ok("books.verify", json!({}))["status"], "ok");
}
/// rules.md B-27: `books.update_party` asks for the `party_creditors`
/// BS-format-1: `books.update_party` asks for the `party_creditors`
/// feature before the first line it writes, never between them. In books
/// waiting for their format upgrade (P2's), a name change with the first
/// creditor is refused whole, journaling nothing (never the notes changed
+5 -5
View File
@@ -1,5 +1,5 @@
//! Spec-blind tests for the project tools of the books server (rules.md
//! B-37), driven through a real `wanderbooks server` as an agent reaches
//! Spec-blind tests for the project tools of the books server (
//! BS-statement-5), driven through a real `wanderbooks server` as an agent reaches
//! it (common.rs).
//!
//! Expected behavior comes only from the tool descriptions and parameter /
@@ -585,7 +585,7 @@ fn project_to_date_counts_lines_before_the_period() {
assert_eq!(zeta["to_date"]["net"], "3200.00");
}
/// The snapshot's figures (rules.md B-37 item 7), as the viewer shows
/// The snapshot's figures (BS-statement-5 item 7), as the viewer shows
/// them: net is the contribution before overhead, margin_pct its share
/// of revenue, to_date.by_account the direct costs by category, and each
/// month's net_to_date the running net, the last being to_date's.
@@ -1202,7 +1202,7 @@ fn l4(
)
}
/// rules.md B-37 item 8: each invoice and bill line takes a project (by
/// BS-statement-5 item 8: each invoice and bill line takes a project (by
/// name or id); the entry's revenue or expense side is one line per
/// project, the untagged lines' as one, the receivable or payable line
/// and the payments untagged; books.project, profit_and_loss_by_class,
@@ -1408,7 +1408,7 @@ fn a_document_for_a_finished_project_says_so() {
);
}
/// B-37 items 4 and 8: an invoice line naming an on-spec project is taken
/// BS-statement-5 items 4 and 8: an invoice line naming an on-spec project is taken
/// and its result asks whether there is now an agreement (a hoped-for
/// payment is no receivable); a bill's cost for one is an expense like any
/// other, so a bill gets no such note.
+4 -4
View File
@@ -1,5 +1,5 @@
//! Tax categories at account creation, and `policy.require_tax_category`
//! (P3, defect 8; rules.md B-32), through a real books server as an
//! (P3, defect 8; BS-ledger-11), through a real books server as an
//! agent reaches it (common.rs).
//!
//! ```text
@@ -7,7 +7,7 @@
//! or the human hears that it doesn't; a company that refuses
//! uncategorized accounts gets exactly that, never a refused
//! invoice.
//! SOURCE: rules.md B-32; plan/served.md P3 defect 8 and "Settled in
//! SOURCE: BS-ledger-11; plan/served.md P3 defect 8 and "Settled in
//! design" (warn by default, headers exempt).
//! ```
//!
@@ -322,7 +322,7 @@ fn require_tax_category_refuses_defect_8() {
assert_eq!(out["warnings"].as_array().unwrap().len(), 2, "{out}");
}
/// rules.md B-31 for new accounts: a name another account under the same
/// BS-ledger-10 for new accounts: a name another account under the same
/// parent has, ignoring capitals (top-level accounts are siblings too),
/// or one holding nine digits in a row, is refused, for books.add_account
/// and books.import_chart_csv alike; under another parent the name is
@@ -369,7 +369,7 @@ fn a_new_account_named_like_a_sibling_is_refused() {
);
}
/// rules.md B-32: a gain on business property (`form_4797_gain_loss`, the
/// BS-ledger-11: a gain on business property (`form_4797_gain_loss`, the
/// disposal account a refusing company must categorize) is exported apart
/// in the tax summary, JSON and CSV alike: at its book amount, with no tax
/// amount, and outside income and both nets (Form 4797 figures it from
+2 -2
View File
@@ -1799,7 +1799,7 @@ fn a_locked_vault_still_builds_the_package() {
assert!(w.iter().all(|r| r["tin"].is_empty()));
}
/// B-26 ("No tool output, error, or log holds a full TIN"): a TIN put in
/// BS-partner-2 ("No tool output, error, or log holds a full TIN"): a TIN put in
/// the wrong field is refused, and the refusal never repeats it, however
/// it was written: as a party name, a bare number where a string goes, or
/// a share's percent.
@@ -1841,7 +1841,7 @@ fn refusals_never_echo_a_tin() {
}
}
/// B-26 for resource reads: a refused `resources/read` quotes the URI it
/// BS-partner-2 for resource reads: a refused `resources/read` quotes the URI it
/// was given, in its message and its data, and never repeats a TIN in it,
/// however the URI carries one (a receipt id, a handbook section, an
/// unknown path, a digest's `since`).
+3 -3
View File
@@ -2,7 +2,7 @@
//! program holds, and books a newer wanderbooks wrote. Oracle: ledger-mcp
//! local.rs INVARIANT 3 (every book is tried before the server says it is
//! ready; one that won't open is reported with why, on its route and in
//! the list, and the others are served) and rules.md B-27 (newer books
//! the list, and the others are served) and BS-format-1 (newer books
//! are refused as newer, never as corrupt, and left as they are).
use common::{Home, Server, Wire};
@@ -80,7 +80,7 @@ fn a_held_lock_is_refused_not_waited_on_forever() {
}
/// Books written by a newer wanderbooks: the server won't open them, and
/// says to update it, not that the books are corrupt (rules.md B-27); it
/// says to update it, not that the books are corrupt (BS-format-1); it
/// leaves them as they are.
#[test]
fn newer_books_are_refused_as_newer_not_corrupt() {
@@ -90,7 +90,7 @@ fn newer_books_are_refused_as_newer_not_corrupt() {
let mut w = ledger_store::JournalWriter::open(&dir.join(ledger_store::JOURNAL_FILE)).unwrap();
w.append("journal.format_set", json!({"format": 3, "features": []}))
.unwrap();
// The next line chains onto it, so its bytes are checked (B-27).
// The next line chains onto it, so its bytes are checked (BS-format-1).
w.append(
"fx.rate_set",
json!({"currency": "EUR", "date": "2026-10-01", "rate": "1.10"}),
+2 -2
View File
@@ -1,4 +1,4 @@
//! Files that carry full TINs never enter the books (rules.md B-26;
//! Files that carry full TINs never enter the books (BS-partner-2;
//! tin_files.rs).
//!
//! ```text
@@ -6,7 +6,7 @@
//! (books.get_receipt would hand its bytes to any agent), however it
//! comes back: the W-9 books.set_w9 read, books.get_w9's copy, a CPA
//! package or a file from one, or text with a TIN in it.
//! SOURCE: rules.md B-26; DECISION (P0 review round 2, 2026-10-16).
//! SOURCE: BS-partner-2; DECISION (P0 review round 2, 2026-10-16).
//! INVARIANTS (oracle):
//! 1. Every file the server read or wrote with full TINs is refused by
//! every way a file enters the books (books.attach_receipt and