From e41cc3a1610c93083d8db2858d51def456733042 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 9 Nov 2026 03:30:06 -0700 Subject: [PATCH] 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 --- crates/ledger-cli/tests/documents.rs | 8 ++-- crates/ledger-cli/tests/evidence.rs | 2 +- crates/ledger-cli/tests/format_upgrade.rs | 2 +- crates/ledger-cli/tests/mcp_journeys.rs | 2 +- crates/ledger-cli/tests/oracle_mcp.rs | 2 +- crates/ledger-cli/tests/projects_parity.rs | 4 +- crates/ledger-cli/tests/spec_assets.rs | 4 +- crates/ledger-cli/tests/spec_parties.rs | 2 +- crates/ledger-cli/tests/spec_projects.rs | 6 +-- crates/ledger-core/src/arap.rs | 8 ++-- crates/ledger-core/src/assets.rs | 4 +- crates/ledger-core/src/cashflow.rs | 18 ++++---- crates/ledger-core/src/error.rs | 16 +++---- crates/ledger-core/src/kernel/allocate.rs | 4 +- crates/ledger-core/src/kernel/entries.rs | 40 ++++++++--------- crates/ledger-core/src/kernel/mod.rs | 2 +- crates/ledger-core/src/ledger.rs | 45 +++++++++---------- crates/ledger-core/src/parties.rs | 6 +-- crates/ledger-core/src/proofs/allocate.rs | 2 +- crates/ledger-core/src/proofs/mod.rs | 18 ++++---- crates/ledger-core/src/reports.rs | 12 ++--- crates/ledger-core/src/shares.rs | 4 +- crates/ledger-core/src/tax_capital.rs | 4 +- .../tests/bookspec/queries/assets.rs | 2 +- .../tests/bookspec/queries/parties.rs | 4 +- crates/ledger-core/tests/form1099.rs | 2 +- crates/ledger-core/tests/invariants.rs | 2 +- .../ledger-core/tests/kernel_bridge/main.rs | 4 +- crates/ledger-core/tests/properties.rs | 10 ++--- crates/ledger-core/tests/spec_asset_tags.rs | 4 +- crates/ledger-core/tests/spec_cash_flow.rs | 45 +++++++++---------- .../tests/spec_document_projects.rs | 10 ++--- crates/ledger-core/tests/spec_documents.rs | 28 ++++++------ crates/ledger-core/tests/spec_parties.rs | 2 +- crates/ledger-core/tests/spec_party_totals.rs | 20 ++++----- crates/ledger-core/tests/spec_projects.rs | 6 +-- crates/ledger-core/tests/spec_reports.rs | 4 +- crates/ledger-core/tests/statements.rs | 4 +- crates/ledger-gui/src/attention.rs | 2 +- crates/ledger-gui/src/demo.rs | 4 +- crates/ledger-gui/src/pages/entry.rs | 4 +- crates/ledger-gui/src/pages/parties.rs | 4 +- crates/ledger-gui/src/pages/projects.rs | 4 +- crates/ledger-gui/src/pages/reports.rs | 2 +- crates/ledger-gui/tests/parties.rs | 6 +-- crates/ledger-gui/tests/projects.rs | 6 +-- crates/ledger-import/tests/spec_import.rs | 8 ++-- crates/ledger-mcp/src/handbook.rs | 8 ++-- crates/ledger-mcp/src/tools/documents.rs | 2 +- crates/ledger-mcp/src/tools/helpers.rs | 2 +- crates/ledger-mcp/src/tools/parties.rs | 2 +- crates/ledger-mcp/src/tools/projects.rs | 4 +- crates/ledger-mcp/src/tools/reports.rs | 2 +- crates/ledger-mcp/src/tools/write_offs.rs | 2 +- crates/ledger-mcp/src/types.rs | 2 +- crates/ledger-package/src/attention.rs | 4 +- crates/ledger-package/src/iif.rs | 2 +- crates/ledger-package/src/reports.rs | 2 +- crates/ledger-package/tests/p3_seams.rs | 18 ++++---- crates/ledger-package/tests/package.rs | 10 ++--- crates/ledger-store/src/error.rs | 2 +- crates/ledger-store/src/format.rs | 2 +- crates/ledger-store/src/store.rs | 12 ++--- crates/ledger-store/tests/arap_props.rs | 7 ++- crates/ledger-store/tests/arap_standing.rs | 15 +++---- crates/ledger-store/tests/asset_tags.rs | 2 +- .../ledger-store/tests/document_projects.rs | 4 +- crates/ledger-store/tests/store.rs | 2 +- docs/mcp-interface.md | 22 ++++----- docs/parity.md | 2 +- docs/parties-and-attachments.md | 2 +- docs/spec/README.md | 4 +- docs/spec/claims/partner.md | 2 +- docs/spec/claims/statement.md | 2 +- docs/spec/sources/fasb-asc.md | 10 ++--- docs/spec/sources/intuit-iif.md | 6 +-- docs/testing.md | 38 ++++++++-------- docs/verification.md | 4 +- 78 files changed, 298 insertions(+), 302 deletions(-) diff --git a/crates/ledger-cli/tests/documents.rs b/crates/ledger-cli/tests/documents.rs index 83f450b3..8daa8312 100644 --- a/crates/ledger-cli/tests/documents.rs +++ b/crates/ledger-cli/tests/documents.rs @@ -989,7 +989,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 (BS-arap-6 INVARIANTS 1 and 3). + /// output names both documents (BS-arap-6 invariant 3 and WB-arap-15). #[test] fn one_payment_settles_two_invoices() { let mut s = setup("settle-two"); @@ -1046,7 +1046,7 @@ mod paying_on_terms { } /// A discount outside the document's terms needs a reason; with one the - /// payment is taken and recorded (BS-arap-6 INVARIANT 2; the terms are S4.3's + /// payment is taken and recorded (BS-arap-6 invariant 6; the terms are S4.3's /// to journal, so this bill states none). #[test] fn late_discount_needs_a_reason() { @@ -1075,7 +1075,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 (BS-arap-6 INVARIANT 1). + /// and A/R is credited the gross (BS-arap-6 invariant 3). #[test] fn a_fee_posts_gross_to_receivables_and_net_to_the_bank() { let mut s = setup("fee-gross"); @@ -1445,7 +1445,7 @@ mod bad_debts { assert_eq!(check["agrees"], json!(true), "{check}"); } - /// P4b S7: no evidence, no write-off (BS-arap-5 INVARIANT 1): the tool refuses + /// P4b S7: no evidence, no write-off (BS-arap-5 statement 10): the tool refuses /// with neither or both, and an attachment already filed is linked /// instead of a new file. #[test] diff --git a/crates/ledger-cli/tests/evidence.rs b/crates/ledger-cli/tests/evidence.rs index 96d43735..56df3b61 100644 --- a/crates/ledger-cli/tests/evidence.rs +++ b/crates/ledger-cli/tests/evidence.rs @@ -318,7 +318,7 @@ fn annotations_and_searches() { assert_eq!(answer_of(&r).unwrap()["status"], "ok"); } -/// Plan P6 step 4 and BS-ledger-12 item 5: consolidation never leaves an +/// Plan P6 step 4 and WB-ledger-15 INVARIANT 3: consolidation never leaves an /// entry the receipt policy covers with no evidence. #[test] fn consolidation_never_removes_an_entrys_only_evidence() { diff --git a/crates/ledger-cli/tests/format_upgrade.rs b/crates/ledger-cli/tests/format_upgrade.rs index 6e339317..1ade8a9c 100644 --- a/crates/ledger-cli/tests/format_upgrade.rs +++ b/crates/ledger-cli/tests/format_upgrade.rs @@ -845,7 +845,7 @@ fn books_p2_served_cut_over_whole() { ), // An invoice carrying documents_v2's fields (terms: P4b S4.4) and // its line naming its project (document_line_projects, - // BS-statement-5 item 8). + // BS-statement-5 statement 6). ( "books.create_invoice", json!({"customer": "1", "date": "2026-02-10", "terms": "Net 30", diff --git a/crates/ledger-cli/tests/mcp_journeys.rs b/crates/ledger-cli/tests/mcp_journeys.rs index be51718a..353feb0e 100644 --- a/crates/ledger-cli/tests/mcp_journeys.rs +++ b/crates/ledger-cli/tests/mcp_journeys.rs @@ -2419,7 +2419,7 @@ fn cash_flow_reads_its_account_roles_from_the_books_settings() { } } -/// BS-statement-3 rule 2: roles that contradict the chart are refused, +/// BS-statement-3 statement 3: 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() { diff --git a/crates/ledger-cli/tests/oracle_mcp.rs b/crates/ledger-cli/tests/oracle_mcp.rs index a21503a5..fe8d4bf2 100644 --- a/crates/ledger-cli/tests/oracle_mcp.rs +++ b/crates/ledger-cli/tests/oracle_mcp.rs @@ -1546,7 +1546,7 @@ fn iif_declares_accounts_by_role_and_balances_every_transaction() { ); } -/// BS-format-2 item 7 through the server: an entry with lines on both the +/// BS-format-2 statement 7 through the server: an entry with lines on both the /// receivables and payables control accounts makes `books.export` iif and /// `books.export_cpa_package` refuse, naming the entry, rather than hand /// over a file QuickBooks Desktop will not import. diff --git a/crates/ledger-cli/tests/projects_parity.rs b/crates/ledger-cli/tests/projects_parity.rs index d94c686b..355492d0 100644 --- a/crates/ledger-cli/tests/projects_parity.rs +++ b/crates/ledger-cli/tests/projects_parity.rs @@ -1,4 +1,4 @@ -//! A project's snapshot (BS-statement-5 item 7) in the viewer and from the +//! A project's snapshot (WB-statement-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"); } -/// BS-statement-5 item 8: a project's invoiced revenue and billed costs, +/// BS-statement-5 statement 6: 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). diff --git a/crates/ledger-cli/tests/spec_assets.rs b/crates/ledger-cli/tests/spec_assets.rs index 6c378ebb..685cd384 100644 --- a/crates/ledger-cli/tests/spec_assets.rs +++ b/crates/ledger-cli/tests/spec_assets.rs @@ -1199,7 +1199,7 @@ fn acquired_date_comes_from_the_acquisition_entry() { ); } -// ------------------------------- posted and scheduled (BS-asset-1 rule 8) +// ------------------------------- posted and scheduled (BS-asset-1 statement 28) /// 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; BS-asset-1 rule 8). Before P3 the +/// left the books with its disposal; BS-asset-1 statement 28). 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() { diff --git a/crates/ledger-cli/tests/spec_parties.rs b/crates/ledger-cli/tests/spec_parties.rs index c753af0c..6b54728d 100644 --- a/crates/ledger-cli/tests/spec_parties.rs +++ b/crates/ledger-cli/tests/spec_parties.rs @@ -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 - // (BS-partner-3 item 5, P3 defect 24); unlisted, Due to Members is a + // (BS-partner-3 statement 7, 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| { diff --git a/crates/ledger-cli/tests/spec_projects.rs b/crates/ledger-cli/tests/spec_projects.rs index 9633291a..e25e5f32 100644 --- a/crates/ledger-cli/tests/spec_projects.rs +++ b/crates/ledger-cli/tests/spec_projects.rs @@ -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 (BS-statement-5 item 7), as the viewer shows +/// The snapshot's figures (WB-statement-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( ) } -/// BS-statement-5 item 8: each invoice and bill line takes a project (by +/// BS-statement-5 statement 6: 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() { ); } -/// BS-statement-5 items 4 and 8: an invoice line naming an on-spec project is taken +/// BS-statement-5 statements 5 and 6: 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. diff --git a/crates/ledger-core/src/arap.rs b/crates/ledger-core/src/arap.rs index 5f92f1ae..e054aac0 100644 --- a/crates/ledger-core/src/arap.rs +++ b/crates/ledger-core/src/arap.rs @@ -203,7 +203,7 @@ pub enum DocStatus { /// Less than nothing owed: more paid against it than it is for, a /// credit balance owed back (to the customer on an invoice, by the /// vendor on a bill). Only in books an earlier version left out of - /// bounds (BS-arap-2 INVARIANT 2); never a receivable or a payable, so + /// bounds (BS-arap-2 invariant 6); never a receivable or a payable, so /// never aged. Overpaid, /// Its own entry stands but carries no line tagged with it (an older @@ -263,7 +263,7 @@ pub struct DocState { impl DocState { /// It owes less than nothing or more than its total: books an earlier - /// version left out of bounds (BS-arap-2 INVARIANT 2; plan P4b.14 item 3), + /// version left out of bounds (BS-arap-2 invariant 6; plan P4b.14 item 3), /// which the control check lists for attention. pub fn out_of_bounds(&self) -> bool { self.outstanding < Decimal::ZERO || self.outstanding > self.total @@ -1144,8 +1144,8 @@ pub type DocumentPartKey = (Option, Option); /// GOAL: a document's lines post to their accounts and count toward their /// projects, and a document whose lines name neither posts exactly /// as before. -/// SOURCE: BS-statement-5 item 3 (job costing: the revenue and -/// direct costs identified with one job) and item 8 (an +/// SOURCE: BS-statement-5 statement 2 (job costing: the revenue and +/// direct costs identified with one job) and statement 4 (an /// invoice's or bill's line names its project); BS-arap-3 and plan /// P4b S4.1 A-10 (every bill line names its account). /// INVARIANTS: diff --git a/crates/ledger-core/src/assets.rs b/crates/ledger-core/src/assets.rs index a11a7968..97961fa1 100644 --- a/crates/ledger-core/src/assets.rs +++ b/crates/ledger-core/src/assets.rs @@ -11,7 +11,7 @@ //! — and postings go through the normal entry machinery, so every //! accounting invariant holds. //! -//! Two figures of accumulated depreciation, never confused (BS-asset-1 rule 8): +//! Two figures of accumulated depreciation, never confused (BS-asset-1 statement 28): //! what the schedule says is due through a date //! ([`accumulated_scheduled_through`]) and what the books carry, the runs //! posted and not reversed ([`crate::Ledger::accumulated_posted`]). Book @@ -743,7 +743,7 @@ fn schedule_months(asset: &Asset, through: NaiveDate) -> Result, /// (inclusive), exact to the minor unit ([`depreciation_schedule`]): the /// tools' `accumulated_scheduled_through`. What the books carry is /// [`crate::Ledger::accumulated_posted`]; the two agree once every month -/// due is posted (BS-asset-1 rule 8). +/// due is posted (BS-asset-1 statement 28). pub fn accumulated_scheduled_through( asset: &Asset, as_of: NaiveDate, diff --git a/crates/ledger-core/src/cashflow.rs b/crates/ledger-core/src/cashflow.rs index 3ca95f19..da271eb3 100644 --- a/crates/ledger-core/src/cashflow.rs +++ b/crates/ledger-core/src/cashflow.rs @@ -77,7 +77,7 @@ pub enum OperatingClass { /// (e) Interest paid. InterestPaid, /// (f) Income taxes paid. No tax category marks an entity-level income - /// tax yet, so nothing is filed here (BS-statement-3 rule 5). + /// tax yet, so nothing is filed here (BS-statement-3 statement 7). IncomeTaxesPaid, /// (g) Other operating cash payments. OtherPayments, @@ -178,7 +178,7 @@ pub struct CashFlowLine { /// The cash, + in. pub amount: Decimal, /// Of `amount`, what a member or a lender paid or received for the - /// company with no cash account moving (BS-statement-3 rule 11, D-42): + /// company with no cash account moving (BS-statement-3 statement 16, D-42): /// a constructive receipt or payment. Zero for most lines. pub on_behalf: Decimal, /// Codes of this kind's accounts the entry moved, sorted. @@ -295,7 +295,7 @@ pub struct OperatingReconciliation { pub net_cash_from_operating: Decimal, } -/// The footing check (BS-statement-3 rule 9). +/// The footing check (BS-statement-3 statement 14). #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CashFlowFooting { /// Operating + investing + financing. @@ -440,8 +440,8 @@ pub enum RoleList { Investing, } -/// A contradiction among the cash flow account roles (BS-statement-3 rule -/// 2): the statement refuses rather than guess. +/// A contradiction among the cash flow account roles (BS-statement-3 statement +/// 3): the statement refuses rather than guess. #[derive(Clone, Debug, PartialEq, Eq)] pub enum RoleProblem { /// An account of the wrong type in a list. @@ -547,14 +547,14 @@ impl RoleProblem { } /// Every contradiction among the cash flow account roles (BS-statement-3 -/// rule 2), in a fixed order. Codes the chart lacks are the caller's to +/// statement 3), in a fixed order. Codes the chart lacks are the caller's to /// report. The one check behind both the statement's refusal and the /// settings' problems, so the two never drift apart. /// /// ```text /// GOAL: the statement's account roles partition the chart, so every /// account is in exactly one section. -/// SOURCE: BS-statement-3 rule 2 (ASC 230-10-45-10: every cash receipt and +/// SOURCE: BS-statement-3 statement 3 (ASC 230-10-45-10: every cash receipt and /// payment is investing, financing or operating). /// INVARIANTS: /// 1. Cash and investing accounts MUST be assets; financing accounts @@ -639,7 +639,7 @@ pub fn role_problems( out } -/// BS-statement-3 rule 9, on its own so the check is tested directly (it +/// BS-statement-3 statement 14, on its own so the check is tested directly (it /// cannot fail on posted entries): the sections sum to the change in /// cash, or nothing is produced. pub fn foot(sections_sum: Decimal, net_change: Decimal) -> Result { @@ -978,7 +978,7 @@ impl<'a> Roles<'a> { } /// The liabilities that hold distributions declared by `end` ( -/// BS-statement-3 rule 2), among the accounts `open` leaves to be placed: each +/// BS-statement-3 statement 3), among the accounts `open` leaves to be placed: each /// credited, in the posted entries dated on or before `end` (closes and /// reversals aside), only by entries whose debits are all to equity (Dr /// Distributions / Cr Distributions Payable; a corporation's Dr Retained diff --git a/crates/ledger-core/src/error.rs b/crates/ledger-core/src/error.rs index 72d434a5..ab09ed05 100644 --- a/crates/ledger-core/src/error.rs +++ b/crates/ledger-core/src/error.rs @@ -505,7 +505,7 @@ pub enum LedgerError { end: String, }, - /// The statement of cash flows would not foot (BS-statement-3 rule 9): + /// The statement of cash flows would not foot (BS-statement-3 statement 14): /// an engine error, never output. It cannot happen on balanced books /// (Lean `cashflow_sections_sum_to_cash_change`); if it does, the /// engine is wrong, and nothing is shown rather than a wrong figure. @@ -523,7 +523,7 @@ pub enum LedgerError { }, /// The cash flow statement's account roles (cash, financing, investing) - /// contradict each other or the chart (BS-statement-3 rule 2). The text + /// contradict each other or the chart (BS-statement-3 statement 3). The text /// names the setting and says what to change. #[error("cash flow account roles: {0}")] CashFlowRoles(String), @@ -695,13 +695,13 @@ pub enum LedgerError { SettlementMixedKinds(String), /// A settlement's documents don't all belong to the one party it - /// names (BS-arap-6 INVARIANT 1). + /// names (BS-arap-6 invariant 4). #[error("{0} is not {1}'s: a settlement covers one party only")] SettlementPartiesDiffer(String, u64), /// A discount needs a reason: none is stated in the document's terms, /// or it is larger than its terms allow, or it is taken after the - /// discount date (BS-arap-6 INVARIANT 2). + /// discount date (BS-arap-6 invariant 6). #[error( "{doc}: the discount of {discount} needs a reason ({because}); pass discount_reason with the payment" )] @@ -763,7 +763,7 @@ pub enum LedgerError { cash: Decimal, }, - /// A settlement's figures can't be exact (BS-arap-6 INVARIANT 1): an + /// A settlement's figures can't be exact (BS-arap-6 invariant 3): an /// amount too large to add, a negative fee, or a fee that leaves /// nothing to deposit; a fee above the cash is /// [`LedgerError::FeeAboveCash`]. @@ -796,7 +796,7 @@ pub enum LedgerError { }, /// Receivables or payables can't move to an account holding lines - /// that are no document's (BS-arap-2 INVARIANT 1): they would + /// that are no document's (BS-arap-2 statement 12): they would /// become hand lines on a control account. #[error( "account {code} \"{name}\" holds lines no invoice or bill carries (entry {entry} first), \ @@ -843,7 +843,7 @@ pub enum LedgerError { }, /// A reversal or payment would leave a document owing less than nothing - /// or more than its total at some date (BS-arap-2 INVARIANT 2): the + /// or more than its total at some date (BS-arap-2 invariant 6): the /// message says which document, when, and what to reverse first. #[error("{0}")] DocumentBounds(String), @@ -882,7 +882,7 @@ pub enum LedgerError { #[error("{0}")] InvalidSend(String), /// A bad debt can't be written off on cash-basis books ( - /// BS-arap-5 INVARIANT 3; IRC §166(a); Treas. Reg. §1.166-1(e)): the + /// BS-arap-5 statement 6; IRC §166(a); Treas. Reg. §1.166-1(e)): the /// invoice was never counted as income, so there is no basis to /// deduct. #[error( diff --git a/crates/ledger-core/src/kernel/allocate.rs b/crates/ledger-core/src/kernel/allocate.rs index ece8d6ba..74573c07 100644 --- a/crates/ledger-core/src/kernel/allocate.rs +++ b/crates/ledger-core/src/kernel/allocate.rs @@ -43,7 +43,7 @@ pub enum Leftover { /// SOURCE: BS-partner-1 (partners share by the agreement; capital accounts /// carry the allocations), BS-partner-3 (a party's part of an /// entry), BS-partner-4 (the K-1 worksheet), BS-1099-1 (a payment -/// split by the parties' shares), BS-statement-3 rule 5 (the +/// split by the parties' shares), BS-statement-3 statement 8 (the /// government's part of a payment), BS-arap-3 (a document line's /// exact amount). /// INVARIANTS: @@ -173,7 +173,7 @@ const MAX_CORRECTION_STEPS: usize = 4096; /// SOURCE: BS-partner-1 (partners share by the agreement; the largest /// remainder is the owner's choice, 2026-10-13), BS-partner-3 (a /// party's part of an entry), BS-partner-4 (the K-1 worksheet's -/// shares), BS-1099-1 (a payment's buckets), BS-statement-3 rule 5 +/// shares), BS-1099-1 (a payment's buckets), BS-statement-3 statement 8 /// (the government's part), BS-arap-3 (a document line's exact /// amount), BS-ledger-1 (a whole number of smallest units). /// INVARIANTS: diff --git a/crates/ledger-core/src/kernel/entries.rs b/crates/ledger-core/src/kernel/entries.rs index 1f6288f8..9bee0a70 100644 --- a/crates/ledger-core/src/kernel/entries.rs +++ b/crates/ledger-core/src/kernel/entries.rs @@ -391,7 +391,7 @@ pub fn net(lines: impl IntoIterator) -> Option { /// ```text /// GOAL: an early-payment discount never takes more than its percentage /// says, in exact money. -/// SOURCE: BS-arap-3 INVARIANT 2, BS-arap-6; plan/served.md +/// SOURCE: BS-arap-3 invariant 2, BS-arap-6; plan/served.md /// 8.3.13; CHOICE: the gross method, A-8 (the discount is /// booked when taken, never estimated). /// INVARIANTS: @@ -1047,8 +1047,8 @@ pub fn apportion_cumulative( Some(()) } -/// Where a line falls on the statement of cash flows (BS-statement-3 rule -/// 2): a cash account, or one of the three sections. +/// Where a line falls on the statement of cash flows (BS-statement-3 statement +/// 3): a cash account, or one of the three sections. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum Flow { /// A cash account: what the statement explains the change in. @@ -1063,7 +1063,7 @@ pub enum Flow { impl Flow { /// The three sections, in the order cash is applied to them ( - /// BS-statement-3 rule 3): operating, investing, financing. + /// BS-statement-3 statement 4): operating, investing, financing. pub const SECTIONS: [Flow; 3] = [Flow::Operating, Flow::Investing, Flow::Financing]; } @@ -1116,7 +1116,7 @@ pub fn take(remaining: T, movement: T) -> Option { /// ```text /// GOAL: split an entry's cash among the parts it settled, without /// inventing or losing any. -/// SOURCE: BS-statement-3 rule 3 (ASC 230-10-50-5: only the cash portion +/// SOURCE: BS-statement-3 statement 4 (ASC 230-10-50-5: only the cash portion /// of a part-cash transaction is a cash flow; the order is a /// CONVENTION, the ASC is silent). /// INVARIANTS: @@ -1143,7 +1143,7 @@ pub fn apply_cash(cash: T, movements: &[T], applied: &mut [T]) -> Opt (remaining == T::ZERO).then_some(()) } -/// An entry's cash flows (BS-statement-3 rule 3): the net movement of its +/// An entry's cash flows (BS-statement-3 statement 4): the net movement of its /// cash lines, applied to the sections moving against it in the order /// operating, investing, financing, each up to its own movement; what is /// left of a section's movement is the part no cash settled. `None` when @@ -1244,7 +1244,7 @@ fn credits_and_debits(movements: &[T]) -> Option<(T, T)> { } /// Which way money a member or a lender handled for the company went -/// (BS-statement-3 rule 11, D-42). +/// (BS-statement-3 statement 16, D-42). #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum OnBehalf { /// Paid for the company: sources credited (borrowed, contributed) @@ -1258,7 +1258,7 @@ pub enum OnBehalf { impl OnBehalf { /// The other way: what an entry's reversal does. /// - /// SOURCE: BS-statement-3 rule 11 (what a member or lender paid or + /// SOURCE: BS-statement-3 statement 16 (what a member or lender paid or /// received for the company is mirrored by its reversal). /// /// INVARIANTS: @@ -1273,7 +1273,7 @@ impl OnBehalf { /// What a member or a lender paid, or received, for the company with no /// cash account moving: a constructive receipt and disbursement ( -/// BS-statement-3 rule 11, D-42). `sources` are what is left unsettled of the +/// BS-statement-3 statement 16, D-42). `sources` are what is left unsettled of the /// entry's kinds that can pay or receive for the company (a financing /// liability, a member's equity), `uses` of the kinds they can pay or /// receive for, each debit-positive. [`OnBehalf::Paid`]: `amount = @@ -1289,7 +1289,7 @@ impl OnBehalf { /// GOAL: show money a member or lender handled for the company as the /// company's own, borrowed (or contributed) and spent, without /// inventing or losing a cent. -/// SOURCE: BS-statement-3 rule 11 (D-42; ASC 230 is silent, PwC Viewpoint +/// SOURCE: BS-statement-3 statement 16 (D-42; ASC 230 is silent, PwC Viewpoint /// FSP 6.9.3.1, Deloitte DART Roadmap 7.2, BDO Blueprint 3.4). /// INVARIANTS: /// 1. The parts net to zero: Σ from + Σ to = 0, so the entry's cash @@ -1322,7 +1322,7 @@ pub fn constructive( } /// How much of an entry is an exchange inside investing and financing -/// that no cash settled (BS-statement-3 rule 7, ASC 230-10-50-4: debt +/// that no cash settled (BS-statement-3 statement 12, ASC 230-10-50-4: debt /// converted to equity, one asset traded for another). `debits` and /// `credits` are the net debits and net credits of the entry's investing /// and financing balance-sheet accounts (each account netted first; both @@ -1449,7 +1449,7 @@ fn least(a: T, b: T) -> T { } /// What an entry's parties split and what of it counts (BS-partner-3 -/// item 3, every case but a close and a reversal, which the caller +/// statement 3, every case but a close and a reversal, which the caller /// handles: a close is its parties' own-account movement with direction /// neither, a reversal is [`reverse_target`] of its original's). /// @@ -1553,7 +1553,7 @@ pub fn party_target( }) } -/// A reversal's target from its original's (BS-partner-3 item 3; BS-ledger-5: a +/// A reversal's target from its original's (BS-partner-3 statement 3; BS-ledger-5: a /// correction is the opposite entry): every amount negated (never to a /// negative zero), paid and received swapped. An involution. `None` past /// the type's range. @@ -2043,12 +2043,12 @@ pub fn basis_figures( } /// A project's unrecovered cost from its tagged revenue and expenses to -/// date: what it would take to be repaid in full (BS-statement-5 item 4). +/// date: what it would take to be repaid in full (BS-statement-5 statement 5). /// /// ```text /// GOAL: the "if repaid" figure of work done on spec, from one function /// the tools, the viewer and bookspec share. -/// SOURCE: BS-statement-5 item 4 (ASC 450-30-25-1: a hoped-for +/// SOURCE: BS-statement-5 statement 5 (ASC 450-30-25-1: a hoped-for /// payment is a gain contingency, never recorded before it is /// received; so this is a figure, never a receivable). /// INVARIANTS: @@ -2087,7 +2087,7 @@ pub enum Bounds { /// ```text /// GOAL: one definition of "a document is never overpaid and never owes /// more than it is for", at every date, not only at the end. -/// SOURCE: BS-arap-2 INVARIANT 2 (0 <= outstanding(d, D) +/// SOURCE: BS-arap-2 invariant 6 (0 <= outstanding(d, D) /// <= total(d) at every D); plan/served.md P4b.3 (Bounds). /// INVARIANTS: /// 1. Within exactly when every prefix sum of `deltas` is within @@ -2134,7 +2134,7 @@ fn out_of_bounds(total: T, running: T) -> Option<(T, bool)> { /// GOAL: a command never puts a document out of bounds, yet books an /// earlier version left out of bounds (a void under a payment that /// stands) take the step that mends them. -/// SOURCE: BS-arap-2 INVARIANT 2, BS-entry-4 (replay accepts what +/// SOURCE: BS-arap-2 invariant 6, BS-entry-4 (replay accepts what /// was written; the bound is the commands'); plan/served.md /// P4b.14 item 3 (the remedy: reverse the payment). /// INVARIANTS: @@ -2179,7 +2179,7 @@ pub fn bounds_kept(total: T, before: &[T], after: &[T]) -> Bounds { mod tests { use super::*; - /// BS-statement-3 rule 3, by hand. Equipment 1,000 for 300 cash and a + /// BS-statement-3 statement 4, by hand. Equipment 1,000 for 300 cash and a /// 700 note: investing takes the 300, the note's 700 and the rest of /// the equipment's are the noncash part. #[test] @@ -2225,7 +2225,7 @@ mod tests { assert_eq!(apply_cash(10, &[-3], &mut out), None); } - /// The exchange measure (BS-statement-3 rule 7) on the review's + /// The exchange measure (BS-statement-3 statement 12) on the review's /// hand-checked cases. #[test] fn exchanged_matches_the_hand_checked_cases() { @@ -2247,7 +2247,7 @@ mod tests { assert_eq!(exchanged(1000i64, 1000, 1000, 1000), Some(0)); } - /// BS-statement-3 rule 11 (D-42), by hand. + /// BS-statement-3 statement 16 (D-42), by hand. #[test] fn constructive_pays_and_receives_for_the_company() { use OnBehalf::{Paid, Received}; diff --git a/crates/ledger-core/src/kernel/mod.rs b/crates/ledger-core/src/kernel/mod.rs index c392f9b8..bbb4eaac 100644 --- a/crates/ledger-core/src/kernel/mod.rs +++ b/crates/ledger-core/src/kernel/mod.rs @@ -42,7 +42,7 @@ //! to zero, and a reversal's parts are the original's negated (BS-statement-3); //! * what a member or lender paid or received for the company, with no //! cash account moving, is split among the kinds it settled, netting to -//! zero, and mirrored by a reversal (BS-statement-3 rule 11); +//! zero, and mirrored by a reversal (BS-statement-3 statement 16); //! * a party's part of an entry is signed as a line on the party's own //! account would be, a reversal's is its original's negated, and what of //! it counts as money or as property never exceeds it (BS-partner-3); diff --git a/crates/ledger-core/src/ledger.rs b/crates/ledger-core/src/ledger.rs index 4b565462..027a52b2 100644 --- a/crates/ledger-core/src/ledger.rs +++ b/crates/ledger-core/src/ledger.rs @@ -1368,7 +1368,7 @@ impl Ledger { /// - SHOULD refuse (RoleAccountHasHandLines), naming the entry /// - NEVER make a hand line a control account's /// BECAUSE no command adds an untagged control line (BS-arap-2 - /// INVARIANT 1). Replay never refuses (BS-entry-4). + /// invariant 2). Replay never refuses (BS-entry-4). /// An account the role moves off keeps its documents' lines, and /// stays guarded while it holds them (Self::control_role_of). /// ``` @@ -1632,7 +1632,7 @@ impl Ledger { /// no other: a chart's own account at a role's default code /// (1200 Equipment, a card at 2000) is anyone's until a document /// posts there. - /// SOURCE: BS-ledger-8, BS-arap-2 INVARIANT 1. + /// SOURCE: BS-ledger-8, BS-arap-2 statement 9. /// INVARIANTS: /// 1. Some(role) when the role is assigned to the account, or the /// account holds a line tagged with one of the role's documents @@ -1735,7 +1735,7 @@ impl Ledger { /// ```text /// GOAL: no command adds a line on a control account that is no /// document's; one only takes a legacy one away. - /// SOURCE: BS-arap-2 INVARIANT 1 and item 3 (the + /// SOURCE: BS-arap-2 invariant 2 and statement 11 (the /// exemption). /// INVARIANTS: /// 1. A tagged line passes. @@ -2284,7 +2284,7 @@ impl Ledger { /// - NEVER refuse reversing a payment, which only reopens its /// document /// BECAUSE 0 <= outstanding <= total at every date (BS-arap-2 - /// INVARIANT 2). Replay never refuses (BS-entry-4). + /// invariant 6). Replay never refuses (BS-entry-4). /// ``` pub fn check_reversal(&self, entry: EntryId, date: NaiveDate) -> Result<(), LedgerError> { let original = self @@ -2489,7 +2489,7 @@ impl Ledger { self.replay_add_line(id, line.account, kernel::flip(line.side), line.amount)?; // The reversal offsets the original line for line: carry the // class so divisional P&L nets correctly, and the document so - // it moves by exactly the opposite (BS-arap-2 INVARIANT 3). + // it moves by exactly the opposite (BS-arap-2 invariant 4). if line.class_id.is_some() { self.set_line_class(id, idx, line.class_id)?; } @@ -3214,7 +3214,7 @@ impl Ledger { /// ```text /// GOAL: a run the books record is the entry that posted it, no more /// and no less, so accumulated_posted is what the books carry. - /// SOURCE: BS-asset-1 rules 6 and 8, BS-asset-3; BS-entry-4 (new commands are bounded; replay checks + /// SOURCE: BS-asset-1 statements 14 and 28, BS-asset-3; BS-entry-4 (new commands are bounded; replay checks /// only what every journaled run passed: /// record_depreciation_run). /// ``` @@ -5771,7 +5771,7 @@ impl Ledger { /// line per (account, project) part the lines name, the parts /// naming neither as one (arap::document_parts), each revenue line /// tagged with its project; the receivable line never ( - /// BS-statement-5 item 8). + /// BS-statement-5 statement 6). /// 2. The receivable line MUST carry the invoice (Origin), in the /// step that posts it: the invoice starts Open, owing its total. /// 3. A refusal MUST leave the books unchanged. @@ -5906,7 +5906,7 @@ impl Ledger { /// with the vendor (1099s): one line per (account, project) part /// the lines name, the parts naming neither as one /// (arap::document_parts), each tagged with its project; the - /// payable line never (BS-statement-5 item 8). + /// payable line never (BS-statement-5 statement 6). /// 2. The payable line MUST carry the bill (Origin), in the step that /// posts it. /// 3. A refusal MUST leave the books unchanged. @@ -6267,7 +6267,7 @@ impl Ledger { /// GOAL: every figure about a document (paid, outstanding, status, /// overdue) is read from its tagged lines, so a reversal, a void /// or a bounced payment is right by construction. - /// SOURCE: BS-arap-2 (INVARIANTS 1-4), BS-ledger-5, BS-ledger-6, BS-arap-1; + /// SOURCE: BS-arap-2 (invariants 1, 4, 6 and 7), BS-ledger-5, BS-ledger-6, BS-arap-1; /// ASC 310-10 (receivables), ASC 405-20-40-1 (payables). /// INVARIANTS: /// 1. outstanding = the signed sum of every posted line tagged with @@ -6417,7 +6417,7 @@ impl Ledger { /// Refuse a step that would move `doc` by `extra` (dated movements) /// if, at some date, it would then owe less than nothing or more than /// its total where it didn't before ([`kernel::bounds_kept`]; - /// BS-arap-2 INVARIANT 2). Books an earlier version left out of bounds + /// BS-arap-2 invariant 6). Books an earlier version left out of bounds /// (a void under a payment that stands) take any step that makes no /// date worse, so the remedy (reversing the payment) is accepted. fn check_item_bounds( @@ -6478,7 +6478,7 @@ impl Ledger { /// The least `doc` owes on any day from `date` on (from its own date, /// for a date before it): what a payment may be, and what a write-off /// may be, so no later day ends out of bounds (BS-arap-2 - /// INVARIANT 2, BS-arap-5 INVARIANT 1). + /// invariant 6, BS-arap-5 invariant 3). fn least_owed_from(&self, doc: arap::DocRef, date: NaiveDate) -> Result { let (doc_date, ..) = self.doc_header(doc)?; let from = date.max(doc_date); @@ -7138,7 +7138,7 @@ impl Ledger { /// 3. 0 < amount <= the least the invoice owes on any day from /// `date` on (on the day, when nothing later lowers it): a /// partial write-off is allowed (§1.166-3(a)), and no day may - /// owe less than nothing (BS-arap-2 INVARIANT 2). + /// owe less than nothing (BS-arap-2 invariant 6). /// 4. The day MUST be in the calendar, in an open period, and not /// before the invoice. /// 5. A refusal MUST leave the books unchanged. @@ -7152,7 +7152,7 @@ impl Ledger { /// 4. IF it is dated before the invoice or in a closed period: /// SHOULD refuse. /// 5. Half paid, the rest written off: Written off, with 50 paid and - /// 50 written off (BS-arap-2 SCENARIO 7). + /// 50 written off (BS-arap-2 scenario 7). /// ``` pub fn write_off( &mut self, @@ -7257,7 +7257,7 @@ impl Ledger { /// ```text /// GOAL: a document that should never have existed (a duplicate, the /// wrong customer) is undone by an opposite entry, never erased. - /// SOURCE: BS-ledger-5, BS-ledger-6, BS-period-2, BS-arap-2 (scenarios 2, 3); + /// SOURCE: BS-ledger-5, BS-ledger-6, BS-period-2, BS-arap-2 (scenarios 2 and 3); /// plan/served.md P4b.5, P4b.6; ASC 250 (an immaterial error is /// corrected in the period found). /// INVARIANTS: @@ -7325,7 +7325,7 @@ impl Ledger { /// ```text /// GOAL: show that receivables and payables equal their documents, and /// list every line that is no document's. - /// SOURCE: BS-ledger-8, BS-arap-2 INVARIANT 1: + /// SOURCE: BS-ledger-8, BS-arap-2 invariant 1: /// GL(A, D) = Σ_docs outstanding(d, D) + unattached(A, D). /// INVARIANTS: /// 1. balance sums every posted line on the account dated on or @@ -7561,8 +7561,7 @@ impl Ledger { } } - /// Tag the line a new payment event names (plan P4b S6; BS-arap-6 - /// INVARIANT 3): line `index` of `entry`, when it is on the role's + /// Tag the line a new payment event names (plan P4b S6; WB-arap-15): line `index` of `entry`, when it is on the role's /// account, on the side the movement posts, untagged, and for `amount`. /// Otherwise it stays untagged and the control check lists it; replay /// never refuses (BS-entry-4). @@ -7771,7 +7770,7 @@ impl Ledger { } /// [`Self::replay_invoice_payment`] with the line a new event names and - /// the discount it took (plan P4b S6; BS-arap-6 INVARIANT 3). A + /// the discount it took (plan P4b S6; WB-arap-15). A /// line the event names but that can't be matched (no such line, the /// wrong account or side, or already tagged) stays untagged, and the /// control check lists it: replay never refuses (BS-entry-4). @@ -7922,7 +7921,7 @@ impl Ledger { /// /// ```text /// GOAL: what each customer owes as of a day, by how overdue. - /// SOURCE: BS-arap-1, BS-arap-2 INVARIANT 5. + /// SOURCE: BS-arap-1, BS-arap-2 invariant 8. /// INVARIANTS: /// 1. Each invoice issued by `as_of` that owes something then /// (Self::doc_state's outstanding) is in exactly one bucket, at @@ -9311,7 +9310,7 @@ impl Ledger { /// /// ```text /// GOAL: a new class under a name no other class has. - /// SOURCE: BS-statement-5 item 1. + /// SOURCE: WB-statement-5. /// SCENARIOS: /// 1. IF the name is blank: SHOULD refuse (EmptyClassName). /// 2. IF it is longer than a line, holds a control character or a @@ -9333,7 +9332,7 @@ impl Ledger { /// /// ```text /// GOAL: one rule for every name a command gives a class. - /// SOURCE: BS-statement-5 item 1; BS-partner-2 (no full TIN). + /// SOURCE: WB-statement-5; BS-partner-2 (no full TIN). /// SCENARIOS: /// 1. IF `except` is a class and the name is its own, exactly: SHOULD /// keep it as stored, unchecked, so a fact-only change never @@ -9482,7 +9481,7 @@ impl Ledger { /// ```text /// GOAL: refuse any project record the books can't take, before a /// line is written. - /// SOURCE: BS-statement-5 item 1 (and BS-partner-2: no full TIN). + /// SOURCE: WB-statement-5 (and BS-partner-2: no full TIN). /// SCENARIOS: /// 1. IF the class doesn't exist: SHOULD refuse (UnknownClass). /// 2. IF the name is blank, too long, or another class has it @@ -9561,7 +9560,7 @@ impl Ledger { } } -/// A class name as names compare (BS-statement-5 item 1): trimmed, in +/// A class name as names compare (WB-statement-5): trimmed, in /// lower case (Unicode's, so `Éclair` and `éCLAIR` are one name). fn fold_class_name(name: &str) -> String { name.trim().to_lowercase() diff --git a/crates/ledger-core/src/parties.rs b/crates/ledger-core/src/parties.rs index dbb6fb40..7cb0db7f 100644 --- a/crates/ledger-core/src/parties.rs +++ b/crates/ledger-core/src/parties.rs @@ -850,7 +850,7 @@ impl PartyField { } } -/// Which of a party's totals to report (BS-partner-3 item 4). Not the +/// Which of a party's totals to report (BS-partner-3 statement 5). Not the /// books' accounting method (`books.accounting_basis`): party totals count /// what moved, whichever method the books keep. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] @@ -981,7 +981,7 @@ impl MoneyAccounts { /// ```text /// GOAL: a card is known from what the books record, and a promise (a /// gift card sold) or a member's own card is never the company's. -/// SOURCE: BS-partner-3 item 5 (DECISION, owner, 2026-10-20: money is +/// SOURCE: BS-partner-3 statement 7 (DECISION, owner, 2026-10-20: money is /// cash, cards, the members' financing and loans), BS-1099-1 (payment /// methods, plan P3 defect 12). /// INVARIANTS: @@ -1376,7 +1376,7 @@ pub fn activity_with( } let shares = ledger.entry_parties(id); // The target first: an entry that counts nothing is never - // unresolved for shares that don't fit it (BS-partner-3 item 4). + // unresolved for shares that don't fit it (BS-partner-3 statement 5). let Ok(t) = crate::shares::target(ledger, id, shares, money) else { a.unresolved.insert(id); continue; diff --git a/crates/ledger-core/src/proofs/allocate.rs b/crates/ledger-core/src/proofs/allocate.rs index 25fea242..7785a9c1 100644 --- a/crates/ledger-core/src/proofs/allocate.rs +++ b/crates/ledger-core/src/proofs/allocate.rs @@ -17,7 +17,7 @@ //! is the callers' answer rather than a division by zero. //! SOURCE: BS-partner-1 (partners share by the agreement; largest //! remainder), BS-1099-1 (a payment's buckets), BS-statement-3 -//! rule 5 (the government's part), BS-arap-3 (a document line's +//! statement 8 (the government's part), BS-arap-3 (a document line's //! exact amount), BS-ledger-1 (whole smallest units). //! INVARIANTS: //! 1. The parts sum to the whole, for every policy. diff --git a/crates/ledger-core/src/proofs/mod.rs b/crates/ledger-core/src/proofs/mod.rs index 52e4caae..4a4d7ad4 100644 --- a/crates/ledger-core/src/proofs/mod.rs +++ b/crates/ledger-core/src/proofs/mod.rs @@ -968,7 +968,7 @@ fn apply_cash_mirrors() { /// An accepted entry always has cash flows, and they explain its cash /// exactly: the sections' cash sums to the entry's cash, and what no cash /// settled (each section's movement plus its cash) sums to zero -/// (BS-statement-3 rules 3 and 9: the statement foots, entry by entry). +/// (BS-statement-3 statements 4 and 14: the statement foots, entry by entry). #[kani::proof] #[kani::unwind(5)] fn entry_flows_sum_to_cash() { @@ -1043,7 +1043,7 @@ fn entry_flows_are_bounded() { /// A reversal's cash flows are its original's, negated, part by part: /// what lets an entry and its reversal in one period drop out of the -/// statement together (BS-statement-3 rule 6). End to end, on entries of +/// statement together (BS-statement-3 statement 11). End to end, on entries of /// up to two lines: at three (`NF`) one run went past half an hour at /// four jobs on a busy machine (2026-10-21), so three lines are proved in /// two halves, `entry_movements_of_a_reversal_mirror` and @@ -1228,7 +1228,7 @@ fn any_way() -> kernel::OnBehalf { } /// What a member or a lender paid or received for the company ( -/// BS-statement-3 rule 11, D-42) invents and loses nothing: the parts net to zero, +/// BS-statement-3 statement 16, D-42) invents and loses nothing: the parts net to zero, /// so an entry's flows still sum to its cash; each part settles its own /// movement toward zero, never past it; and as much is settled as can be. #[kani::proof] @@ -1276,7 +1276,7 @@ fn constructive_nets_to_zero() { /// The other way, minus the sources and minus the uses give minus the /// parts: a reversal of a payment made on the company's behalf mirrors it -/// (BS-statement-3 rule 6), so the two drop out together. +/// (BS-statement-3 statement 11), so the two drop out together. #[kani::proof] #[kani::unwind(4)] fn constructive_mirrors() { @@ -1320,7 +1320,7 @@ fn any_party_inputs() -> (Option<(i64, i64)>, i64, i64, i64) { (capital, any_amount(), any_amount(), debits) } -/// BS-partner-3 items 1-4: the direction is the sign of what counts (paid above +/// BS-partner-3 statements 1-5: the direction is the sign of what counts (paid above /// zero, received below), neither exactly when nothing counts; cash and /// in kind each carry the whole's sign and together never exceed it; a /// money target is all cash; a contribution counts all of itself; a @@ -1393,7 +1393,7 @@ fn direction_of_is_the_sign() { kani::cover!(amount == 0, "nothing moved"); } -/// BS-partner-3 item 3 and BS-ledger-5: the target is odd. Negating the lines negates the +/// BS-partner-3 statement 3 and BS-ledger-5: the target is odd. Negating the lines negates the /// capital movement, the money net and the own-account movement, and the /// property comes from the other side, so it keeps its size: the result /// is the original's reverse_target, whenever it isn't the debits fallback @@ -1837,7 +1837,7 @@ fn basis_figures_laws() { ); } -/// `kernel::unrecovered_cost` (BS-statement-5 item 4), for every revenue +/// `kernel::unrecovered_cost` (BS-statement-5 statement 5), for every revenue /// and expense a line could carry: never below zero; the shortfall when /// expenses exceed revenue, else zero; never above max(expenses, 0) when /// revenue isn't negative (expenses may be negative: a reimbursement @@ -1859,7 +1859,7 @@ fn unrecovered_cost_laws() { kani::cover!(u == 0 && revenue > expenses, "repaid, and more"); } -/// `kernel::running_bounds` (BS-arap-2 INVARIANT 2; the bounds every +/// `kernel::running_bounds` (BS-arap-2 invariant 6; the bounds every /// document command and reversal checks), for every total and every /// sequence of up to `N` dated movements a line could carry: it says /// Within exactly when every running balance is in `0 ..= total`, and @@ -1899,7 +1899,7 @@ fn bounds_check_matches_definition() { } /// `kernel::bounds_kept` (the check every document command and reversal -/// runs, BS-arap-2 INVARIANT 2): on books in bounds at every date it +/// runs, BS-arap-2 invariant 6): on books in bounds at every date it /// is the definition (`running_bounds` of the books after the step); and /// whenever it says Within, no running balance after the step is further /// outside `0 ..= total` than before it, so a step that mends books an diff --git a/crates/ledger-core/src/reports.rs b/crates/ledger-core/src/reports.rs index dc4062c4..b3769f90 100644 --- a/crates/ledger-core/src/reports.rs +++ b/crates/ledger-core/src/reports.rs @@ -533,7 +533,7 @@ fn profit_and_loss_counted( )) } -/// A project's figures (BS-statement-5 item 3): the period's statement and +/// A project's figures (BS-statement-5 statement 2): the period's statement and /// months, and its figures to date. #[derive(Clone, Debug)] pub struct ProjectFigures { @@ -592,7 +592,7 @@ pub struct ProjectToDate { impl ProjectToDate { /// Revenue less expenses: the project's contribution before overhead - /// (BS-statement-5 item 7), since only its own tagged lines count. + /// (WB-statement-7), since only its own tagged lines count. pub fn net(&self) -> Decimal { self.revenue - self.expenses } @@ -611,11 +611,11 @@ impl ProjectToDate { } /// Contribution as a percent of revenue, to one place (half to even), or -/// `None` without revenue to divide by (BS-statement-5 item 7). +/// `None` without revenue to divide by (WB-statement-7). /// /// ```text /// GOAL: one margin the tools and the viewer print alike. -/// SOURCE: BS-statement-5 item 7 (revenue less the costs traced +/// SOURCE: WB-statement-7 (revenue less the costs traced /// to the project, fixed and variable alike: Garrison's segment /// margin, as a ratio; not Horngren's variable-cost contribution /// margin; a presentation choice, not GAAP). @@ -650,7 +650,7 @@ pub const PROJECT_MONTHS: u32 = 240; /// ```text /// GOAL: what a project earned and cost, from one function the tools, the /// viewer and bookspec share, so their figures never drift. -/// SOURCE: BS-statement-5 item 3 (job costing), BS-period-1, BS-statement-3. +/// SOURCE: BS-statement-5 statement 2 (job costing), BS-period-1, BS-statement-3. /// INVARIANTS: /// 1. MUST be profit_and_loss_for_period with the project's class: only /// revenue and expense lines tagged to it, closing entries left out. @@ -748,7 +748,7 @@ pub fn project_to_date( /// Every entry with a line tagged to the project (drafts included), /// newest first (by date, then id), with its project amount: its tagged /// revenue lines less its tagged expense lines, each on its normal side. -/// A tagged balance-sheet line counts zero (BS-statement-5 item 3). +/// A tagged balance-sheet line counts zero (BS-statement-5 statement 2). pub fn project_entries(ledger: &Ledger, id: ClassId) -> Vec<(crate::EntryId, Decimal)> { let mut out: Vec<(NaiveDate, crate::EntryId, Decimal)> = Vec::new(); for eid in 1..ledger.next_entry_id() { diff --git a/crates/ledger-core/src/shares.rs b/crates/ledger-core/src/shares.rs index 269d1ed7..a304ffc6 100644 --- a/crates/ledger-core/src/shares.rs +++ b/crates/ledger-core/src/shares.rs @@ -22,7 +22,7 @@ //! part; DECISION, owner, 2026-10-20: a member's entry counts what //! moved their capital). //! DEFINITIONS: -//! target (target(), BS-partner-3 item 3): what the shares split, +//! target (target(), BS-partner-3 statement 3): what the shares split, //! signed debit-positive as a line on the parties' own account would //! be (positive: the company paid or gave; negative: it received), //! with its direction (paid, received, neither) and what of it moved @@ -317,7 +317,7 @@ pub struct Target { pub in_kind: Decimal, /// Which side the parts count on in a party's totals: the direction /// of the entry's root original (itself, unless it is a reversal), so - /// a reversal nets what it reverses (BS-partner-3 item 4). + /// a reversal nets what it reverses (BS-partner-3 statement 5). pub counts_as: Direction, } diff --git a/crates/ledger-core/src/tax_capital.rs b/crates/ledger-core/src/tax_capital.rs index ab417ab8..e36cbceb 100644 --- a/crates/ledger-core/src/tax_capital.rs +++ b/crates/ledger-core/src/tax_capital.rs @@ -89,9 +89,9 @@ use rust_decimal::Decimal; /// `[start, end]`: its lines on the asset's depreciation expense account, /// debit-positive (the depreciation still due through the disposal day, /// or, negative, what the month's run posted past it, credited back: -/// BS-asset-1 rule 5). With the runs +/// BS-asset-1 statement 9). With the runs /// (`Ledger::depreciation_posted_between`) it is the asset's depreciation -/// expense in the span, the P&L's and the cash flow's (BS-statement-3 rule 8). +/// expense in the span, the P&L's and the cash flow's (BS-statement-3 statement 13). /// The disposal entry is the posted entry dated the disposal day that /// credits the asset's cost account by its cost (`Store::dispose_asset` /// posts it so). diff --git a/crates/ledger-core/tests/bookspec/queries/assets.rs b/crates/ledger-core/tests/bookspec/queries/assets.rs index 2f4f0baf..55734397 100644 --- a/crates/ledger-core/tests/bookspec/queries/assets.rs +++ b/crates/ledger-core/tests/bookspec/queries/assets.rs @@ -364,7 +364,7 @@ pub(crate) fn check_schedule_plan(b: &Books<'_>, x: &Expect) { } /// Check one `register_row` expectation: the asset's row of the fixed -/// asset register as of `as_of` (BS-asset-1 rules 7 and 8, BS-asset-3): +/// asset register as of `as_of` (BS-asset-1 statements 23, 24 and 28, BS-asset-3): /// `acquired` and `in_service` (`YYYY-MM-DD`), `cost`, /// `accumulated_scheduled` (the schedule's), `accumulated_posted` (what /// the books carry), `unposted` (the one less the other), `book_value` diff --git a/crates/ledger-core/tests/bookspec/queries/parties.rs b/crates/ledger-core/tests/bookspec/queries/parties.rs index a8089a6f..fb33da31 100644 --- a/crates/ledger-core/tests/bookspec/queries/parties.rs +++ b/crates/ledger-core/tests/bookspec/queries/parties.rs @@ -299,7 +299,7 @@ pub(crate) fn check_vendor_1099(b: &Books<'_>, x: &Expect) { /// The money party shares resolve against: the cash accounts (every /// asset account but receivables when none are named), the cards and the -/// financing accounts (BS-partner-3 item 5). +/// financing accounts (BS-partner-3 statement 7). pub(crate) fn party_money(ex: &Example, l: &Ledger) -> MoneyAccounts { ledger_core::parties::money_accounts( l, @@ -368,7 +368,7 @@ pub(crate) fn check_party_part(b: &Books<'_>, x: &Expect) { /// Check one `party_totals` expectation: what was `paid` to and /// `received` from the party from `from` through `to` on `basis` (`cash`: /// money; `all`: money and property in kind), each entry's part on its -/// root original's side (BS-partner-3 item 4); both given. +/// root original's side (BS-partner-3 statement 5); both given. pub(crate) fn check_party_totals(b: &Books<'_>, x: &Expect) { let (ex, l) = (b.ex, b.l()); assert!( diff --git a/crates/ledger-core/tests/form1099.rs b/crates/ledger-core/tests/form1099.rs index 27f1ef33..479e372c 100644 --- a/crates/ledger-core/tests/form1099.rs +++ b/crates/ledger-core/tests/form1099.rs @@ -2317,7 +2317,7 @@ proptest! { } } - /// BS-partner-3 item 9: party totals and the 1099 worksheet never + /// BS-partner-3 statement 11: party totals and the 1099 worksheet never /// contradict. For books whose cash accounts are named, whose company /// card is recorded as a business-card payment method (or that have /// no card at all: without the method, 2050's name says nothing, so diff --git a/crates/ledger-core/tests/invariants.rs b/crates/ledger-core/tests/invariants.rs index dbcd1203..23aece74 100644 --- a/crates/ledger-core/tests/invariants.rs +++ b/crates/ledger-core/tests/invariants.rs @@ -798,7 +798,7 @@ fn cash_flow_reconciles_to_change_in_cash() { // Operating, by the direct method: collected 1,500 (class (a)); paid // 2,500 for equipment (not a registered asset: operating, - // BS-statement-3 rule 12's limits) and 800 rent (class (d)) = -1,800. Reconciled: + // BS-statement-3 statement 17's limits) and 800 rent (class (d)) = -1,800. Reconciled: // 3,200 net income - 2,500 increase in AR (4,000 billed - 1,500 // collected) - 2,500 increase in equipment = -1,800. // Financing: +10,000 owner contribution. Sum = 8,200. Reconciles. diff --git a/crates/ledger-core/tests/kernel_bridge/main.rs b/crates/ledger-core/tests/kernel_bridge/main.rs index e91c8b54..31e1090e 100644 --- a/crates/ledger-core/tests/kernel_bridge/main.rs +++ b/crates/ledger-core/tests/kernel_bridge/main.rs @@ -278,7 +278,7 @@ proptest! { } } - /// BS-statement-3 rule 3: the statement of cash flows' per-entry split + /// BS-statement-3 statement 4: the statement of cash flows' per-entry split /// (`kernel::entry_flows`, Kani `entry_flows_*`) is the same at both /// instantiations, on balanced and unbalanced lines alike. #[test] @@ -325,7 +325,7 @@ proptest! { ); } - /// BS-statement-3 rule 11: `kernel::constructive` (what a member or + /// BS-statement-3 statement 16: `kernel::constructive` (what a member or /// lender paid or received for the company; Kani /// `constructive_nets_to_zero`, `constructive_mirrors`) agrees at both /// instantiations. diff --git a/crates/ledger-core/tests/properties.rs b/crates/ledger-core/tests/properties.rs index 900b4fab..cb1140eb 100644 --- a/crates/ledger-core/tests/properties.rs +++ b/crates/ledger-core/tests/properties.rs @@ -680,7 +680,7 @@ proptest! { prop_assert_eq!(scheduled_book_value(a, on).unwrap(), want.book_value); } - /// BS-asset-1 rule 3 (defect 22), against arithmetic written here: through + /// BS-asset-1 statement 4 (defect 22), against arithmetic written here: through /// any day k of the life's final month (its d days), accumulated is C + /// (D − C) × k / d rounded half up to the cent, C the exact charge of /// the months before (D × each month's days held over its days, over @@ -719,7 +719,7 @@ proptest! { } } - /// BS-asset-1 rule 4 (depreciation_schedule INVARIANT 6; P3 depreciation brief 2.3, R1, R8): through every + /// BS-asset-1 statement 6 (depreciation_schedule INVARIANT 6; P3 depreciation brief 2.3, R1, R8): through every /// month end of the life, the schedule is the pre-P3 running total /// (USD, a two-place currency), except where the exact cumulative is a /// half-cent tie, which the old 28-digit Decimal quotients could round @@ -937,7 +937,7 @@ proptest! { proptest! { #![proptest_config(ProptestConfig::with_cases(256))] - /// BS-statement-5 item 3: for any tags and any period, the projects' + /// BS-statement-5 statement 2: for any tags and any period, the projects' /// figures plus the untagged lines' are the period's profit and loss /// (no line counted twice or lost), each through /// ledger_core::project_figures. @@ -1002,7 +1002,7 @@ proptest! { prop_assert_eq!(exp_sum + untagged_exp, all.total_expenses); } - /// BS-statement-5 item 7: the snapshot's contribution is + /// WB-statement-7: the snapshot's contribution is /// project_to_date's net, revenue less direct costs, whatever the /// tags and sides (a refund debits revenue, a reimbursement credits an /// expense below zero): the accounts sum to the totals, each month's @@ -1091,7 +1091,7 @@ proptest! { } } - /// BS-statement-5 item 3: project_entries codes its own signs, so the + /// BS-statement-5 statement 2: project_entries codes its own signs, so the /// posted entries' project amounts must sum to project_to_date's net /// (with no entry dated after the day), whatever the tags, the sides, /// a tagged balance-sheet line, or drafts beside them. diff --git a/crates/ledger-core/tests/spec_asset_tags.rs b/crates/ledger-core/tests/spec_asset_tags.rs index 8f4e3307..a5ac5189 100644 --- a/crates/ledger-core/tests/spec_asset_tags.rs +++ b/crates/ledger-core/tests/spec_asset_tags.rs @@ -1088,8 +1088,8 @@ fn register_of_no_assets_is_empty() { /// 1,000.00 and June's 10/30: 5,333.33 scheduled. Before P3 the disposed /// schedule ended in a plug, so the register showed 12,000.00 and 0.00. /// The same in the life's final month: on 2026-12-15, 11,483.87. Book -/// value is cost less what the books carry (defect 13, BS-asset-1 rule -/// 8): the fixture's runs, January to March, 3,000.00, so 9,000.00. +/// value is cost less what the books carry (defect 13, BS-asset-1 statement +/// 28): the fixture's runs, January to March, 3,000.00, so 9,000.00. #[test] fn register_as_of_a_day_before_a_same_month_disposal_is_prorated() { let (mut l, _, laptop, _) = register_fixture(); diff --git a/crates/ledger-core/tests/spec_cash_flow.rs b/crates/ledger-core/tests/spec_cash_flow.rs index f7b9f476..9fd04052 100644 --- a/crates/ledger-core/tests/spec_cash_flow.rs +++ b/crates/ledger-core/tests/spec_cash_flow.rs @@ -168,7 +168,7 @@ fn s(t: &str) -> String { t.to_string() } -/// The laws every statement keeps (BS-statement-3 rules 8 and 9): each +/// The laws every statement keeps (BS-statement-3 statements 13 and 14): each /// section is its lines, and its kinds; the sections are the change in /// cash; net income and the reconciling items are operating. fn foots(cf: &CashFlowStatement) { @@ -205,7 +205,7 @@ fn no_distribution(cf: &CashFlowStatement) { /// The minimal reproduction of defect 1. Property contributed (Dr /// Equipment 2,340 / Cr Capital), the asset registered, the entry reversed /// the same day. No cash moved, and the entry and its reversal cancel -/// (BS-statement-3 rules 1, 6): every section 0.00, no lines, no +/// (BS-statement-3 statements 2 and 11): every section 0.00, no lines, no /// disclosures, footing 0 / 0 / 0. Before the fix: investing −2,340.00 /// against a change in cash of 0.00 (the reversal's credit to the /// equipment account belonged to no section). @@ -876,7 +876,7 @@ fn a_property_contribution_is_a_noncash_disclosure() { assert_eq!(n.label, format!("Laptop contributed (#{e})")); } -/// D-42, BS-statement-3 rule 11 (ASC 230 is silent on a payment a third +/// D-42, BS-statement-3 statement 16 (ASC 230 is silent on a payment a third /// party makes on the entity's behalf; PwC FSP 6.9.3.1, DART Roadmap 7.2 /// and BDO Blueprint 3.4 present it by substance, as constructive receipt /// and disbursement). An expense a member pays personally (Dr Supplies @@ -1011,7 +1011,7 @@ fn equipment_a_lender_paid_for_is_borrowed_and_invested() { assert_eq!(cf.net_change_in_cash, x("-500.00")); } -/// The expense-to-capital case (BS-statement-3 rule 11): a member pays a +/// The expense-to-capital case (BS-statement-3 statement 16): a member pays a /// vendor for the company and the books credit the member's capital (Dr /// Supplies 80 / Cr Capital — Member A), no cash. The member paid cash to /// a third party on the company's behalf, as through 2100; only the form @@ -1150,7 +1150,7 @@ fn equipment_on_the_sellers_credit_stays_noncash_and_flagged() { assert!(w.message.contains("borrowed and spent"), "{}", w.message); } -/// BS-statement-3 rule 6 with rule 11: a payment a member made for the +/// BS-statement-3 statement 11 with statement 16: a payment a member made for the /// company and its reversal, both in February, drop out together (their /// flows, constructive cash included, are exact negatives: Kani /// `constructive_mirrors`); no line, no disclosure, no total moves. The @@ -1351,7 +1351,7 @@ fn interest_and_guaranteed_payments_charged_to_a_creditor_stay_noncash() { ); } -/// BS-statement-3 rule 6 (BS-ledger-5: a correction undoes what it corrects): an +/// BS-statement-3 statement 11 (BS-ledger-5: a correction undoes what it corrects): an /// entry and its reversal both in the period drop out of every line and /// disclosure, and no total moves (their flows are exact negatives, Kani /// `entry_flows_of_a_reversal_mirror`). @@ -1390,7 +1390,7 @@ fn an_entry_and_its_reversal_in_the_period_drop_out() { assert_eq!(cf.net_change_in_cash, before.net_change_in_cash); } -/// BS-statement-3 rule 6: a reversal shown alone (its original in an +/// BS-statement-3 statement 11: a reversal shown alone (its original in an /// earlier period) is labelled "Reversal of #N — " and /// listed under its original's kind, never as a distribution (D1-c). #[test] @@ -1414,7 +1414,7 @@ fn a_reversal_alone_is_labelled_reversal_of() { no_distribution(&cf); } -/// BS-statement-3 rules 4 and 6: a reversal takes its chain root's +/// BS-statement-3 statements 5 and 11: a reversal takes its chain root's /// sections, class and kind, with its own sign. Reversing January's cash /// sale at a 300 gain in February: investing −500 under "Proceeds from /// sales of property and equipment", G +300 (the gain, reversed, is still @@ -1766,7 +1766,7 @@ fn operating_classes_follow_asc_230_10_45_25() { /// ASC 230-10-45-28(b): depreciation is an item of net income with no /// cash effect, a reconciling item; it is not an investing or financing -/// activity, so nothing is disclosed (BS-statement-3 rule 7). +/// activity, so nothing is disclosed (BS-statement-3 statement 12). #[test] fn depreciation_is_reconciling_not_disclosed() { let mut b = funded(); @@ -1862,7 +1862,7 @@ fn operating_reconciliation_ties_to_operating_cash() { ); } -/// BS-period-1 and BS-statement-3 rule 10: a period close moves earnings into +/// BS-period-1 and BS-statement-3 statement 15: a period close moves earnings into /// equity; it earns and spends nothing, so it is never in the statement. #[test] fn closing_entries_never_appear() { @@ -1881,7 +1881,7 @@ fn closing_entries_never_appear() { assert!(!text.contains(&format!("entry: {close},"))); } -/// The period is [start, end] inclusive (BS-statement-3 rule 1): a +/// The period is [start, end] inclusive (BS-statement-3 statement 2): a /// contribution on the start date is a flow, not opening cash. #[test] fn cash_flow_starts_counting_on_the_start_date() { @@ -1921,8 +1921,7 @@ fn a_transfer_between_cash_accounts_is_not_a_flow() { assert!(cf.noncash_disclosures.is_empty()); } -/// Review round 2, footing in odd shapes (BS-statement-3 rules 1, 6, 9, -/// 11), by hand: +/// Review round 2, footing in odd shapes (BS-statement-3 statements 2, 11, 14 and 16), by hand: /// - two cash accounts in one entry, a transfer less its fee (Dr Savings /// 99, Dr Supplies 1 / Cr Cash 100): only the net, −1, moves cash, /// operating (d); no investing or financing; @@ -2217,7 +2216,7 @@ fn financing_lists_each_members_contributions_and_distributions() { /// "at a minimum" apart from the other classes, so an entry's operating /// cash is classed kind by kind: its interest lines are (b) or (e) /// whatever else it settles, the rest by its structure (BS-statement-3 -/// rule 5). By hand: +/// statement 7). By hand: /// - a payment of 900 on a loan the settings leave operating, with 100 /// interest (Dr 2500 900, Dr 6200 100 / Cr cash 1,000): (d) −900 and /// (e) −100, not (e) −1,000; @@ -2547,7 +2546,7 @@ fn a_reversed_bill_payment_leaves_the_purchase_unpaid() { } // --------------------------------------------------------------------------- -// Role refusals (BS-statement-3 rule 2) and the footing check (rule 9). +// Role refusals (BS-statement-3 statement 3) and the footing check (statement 14). // --------------------------------------------------------------------------- fn refused(b: &Books, cash: &[&str], financing: &[&str], investing: &[&str]) -> String { @@ -2617,7 +2616,7 @@ fn a_registered_asset_account_cannot_be_cash() { assert!(m.contains("a registered fixed asset's account"), "{m}"); } -/// BS-statement-3 rule 9: any difference between the sections and the +/// BS-statement-3 statement 14: any difference between the sections and the /// change in cash is an engine error, never a statement. #[test] fn foot_refuses_any_difference() { @@ -3244,7 +3243,7 @@ fn a_disposals_depreciation_credit_back_is_depreciation() { assert_eq!(cf.cash_from_investing, x("975.00")); } -/// BS-statement-3 rule 5 (the P3 cutover review's open point 2): ASC +/// BS-statement-3 statement 8 (the P3 cutover review's open point 2): ASC /// 230-10-45-17(c), "Cash payments to governments for taxes, duties, /// fines, and other fees or penalties", is not 45-17(b)'s "Cash payments /// to other suppliers and employees": a state's filing fee booked to an @@ -3316,7 +3315,7 @@ fn a_payment_to_a_government_is_other_operating() { assert_eq!((line.class, line.amount), (Some(OtherPayments), x("75.00"))); } -/// BS-statement-3 rule 5: the payee decides on any account, and the tax +/// BS-statement-3 statement 8: the payee decides on any account, and the tax /// category still does without one: a license on `taxes_licenses` with no /// party is (g). An entry naming a government and a supplier together /// (half each) is split by their shares, as ASC 230-10-45-22 has each @@ -3371,7 +3370,7 @@ fn a_government_payee_moves_a_fee_on_any_account() { assert_eq!(classes(&cf, shared), [(OtherPayments, x("-100.00"))]); } -/// BS-statement-3 rule 5: a split by shares that leaves an odd cent rounds +/// BS-statement-3 statement 8: a split by shares that leaves an odd cent rounds /// the government's part half to even, the supplier's the rest, so the /// line still sums to the payment; its reversal next month mirrors it to /// the cent. Fixed amounts split as given. @@ -3450,7 +3449,7 @@ fn a_shared_government_payment_splits_to_the_cent() { ); } -/// BS-statement-3 rule 5: a reversal takes its original's payee, so the +/// BS-statement-3 statement 8: a reversal takes its original's payee, so the /// pair always lands in one class and nets. A state's fee paid in /// February and reversed in March: (g) both. The books keep a reversal /// chain's parties one (Ledger::set_entry_parties INVARIANT 5): tagging @@ -3500,7 +3499,7 @@ fn a_reversal_takes_its_originals_payee() { assert_eq!(classes(&b), both(ToSuppliersAndEmployees)); } -/// BS-statement-3 rules 5 and 11: a payment shared between a state and an +/// BS-statement-3 statements 8 and 16: a payment shared between a state and an /// agent that a member paid personally (Dr 6000 137.00 / Cr 2100, the /// members' financing account) is borrowed and spent, and its spending is /// split by the parties' shares as a bank payment's is, the part no bank @@ -3577,7 +3576,7 @@ fn a_shared_government_payment_a_member_paid_splits_both_ways() { assert_eq!(cf.net_change_in_cash, Decimal::ZERO); } -/// BS-statement-3 rule 5 (CONVENTION): payroll keeps its structure. Taxes +/// BS-statement-3 statement 9 (CONVENTION): payroll keeps its structure. Taxes /// withheld from employees and remitted to the tax agency are the /// employees' pay (45-17(b), "Cash payments to other suppliers and /// employees"), and the payroll payables mix them with the employer's @@ -3636,7 +3635,7 @@ fn a_payroll_remittance_to_a_tax_agency_stays_pay() { assert_eq!(class(employer), Some(OtherPayments)); } -/// BS-statement-3 rule 5: a government selling goods or services is a +/// BS-statement-3 statement 8: a government selling goods or services is a /// supplier (45-17(b), "for other goods or services"), not 45-17(c)'s /// taxes, fees or penalties: the post office named with the `vendor` /// role, postage stays (d). The roles decide, so a post office given the diff --git a/crates/ledger-core/tests/spec_document_projects.rs b/crates/ledger-core/tests/spec_document_projects.rs index 0e2089b3..01c823c0 100644 --- a/crates/ledger-core/tests/spec_document_projects.rs +++ b/crates/ledger-core/tests/spec_document_projects.rs @@ -1,12 +1,12 @@ -//! An invoice's or bill's lines name their projects (BS-statement-5 item -//! 8): the posted entry's revenue or expense side is one line per project, +//! An invoice's or bill's lines name their projects (BS-statement-5 statement +//! 6): the posted entry's revenue or expense side is one line per project, //! the untagged lines' as one; the receivable or payable line, and the //! payments, never take one. //! //! ```text //! GOAL: a client project's invoiced revenue and a contractor's billed //! cost count toward the project, every other figure as before. -//! SOURCE: BS-statement-5 items 3 and 8 (job costing), BS-statement-3 (the +//! SOURCE: BS-statement-5 statements 2 and 6 (job costing), BS-statement-3 (the //! projects with the untagged lines partition the P&L), BS-1099-1 and //! BS-partner-3 (1099 and party figures follow the money, not the tags). //! ``` @@ -170,7 +170,7 @@ fn a_bills_cost_is_one_line_per_project_and_the_payable_none() { } /// Reversing a tagged invoice's or bill's entry carries each line's -/// project to the reversal (BS-statement-5 item 3: each line on its normal side), so +/// project to the reversal (BS-statement-5 statement 2: each line on its normal side), so /// every project nets back to zero; a partial payment, cash against the /// receivable, moves no project figure. #[test] @@ -295,7 +295,7 @@ fn a_line_naming_an_unknown_project_is_refused_whole() { } /// Finished and abandoned projects still take a document's lines (BS-statement-5 -/// item 5: a late cost, a final invoice). +/// statement 7: a late cost, a final invoice). #[test] fn a_finished_project_still_takes_an_invoice() { let mut b = books(); diff --git a/crates/ledger-core/tests/spec_documents.rs b/crates/ledger-core/tests/spec_documents.rs index 66d5bf46..cf3e8879 100644 --- a/crates/ledger-core/tests/spec_documents.rs +++ b/crates/ledger-core/tests/spec_documents.rs @@ -110,7 +110,7 @@ impl Books { } /// Every control account's tie-out holds: no difference (BS-arap-2 - /// INVARIANT 1). + /// invariant 1). fn ties(&self, on: NaiveDate) { for c in self.l.control_check(on).unwrap() { assert_eq!(c.difference, Decimal::ZERO, "{c:?}"); @@ -1067,7 +1067,7 @@ fn out_of_bounds_documents_are_listed_not_aged() { /// Reversing a legacy hand line takes it off; reversing that reversal /// would put it back, and is refused: no command adds an untagged control -/// line (BS-arap-2 INVARIANT 1 and item 3; first review of S1). +/// line (BS-arap-2 invariant 2 and statement 11; first review of S1). #[test] fn putting_back_a_removed_hand_line_is_refused() { let mut b = books(); @@ -1204,7 +1204,7 @@ fn a_chain_counts_in_order() { // Write-offs (plan P4b S7; BS-arap-5) // --------------------------------------------------------------------------- -/// BS-arap-2 SCENARIO 7 and BS-arap-5 INVARIANT 1: half of an invoice paid, the rest +/// BS-arap-2 scenario 7 and BS-arap-5 invariant 1: half of an invoice paid, the rest /// written off, reads Written off with 50 paid and 50 written off, and /// receivables falls by the write-off alone. #[test] @@ -1261,7 +1261,7 @@ fn half_paid_rest_written_off_is_written_off() { assert!(check.iter().all(|c| c.difference.is_zero())); } -/// BS-arap-5 INVARIANT 3: a cash-basis company never counted the invoice as +/// BS-arap-5 invariant 5: a cash-basis company never counted the invoice as /// income, so it has no basis to deduct (IRC §166; Treas. Reg. /// §1.166-1(e)). #[test] @@ -1308,7 +1308,7 @@ fn write_off_refused_on_cash_basis() { ); } -/// BS-arap-5 INVARIANT 1: at most what is owed, a partial write-off allowed +/// BS-arap-5 invariant 2 and statement 3: at most what is owed, a partial write-off allowed /// (Treas. Reg. §1.166-3(a)); more is refused, naming what is owed, and /// nothing changes. #[test] @@ -1351,7 +1351,7 @@ fn write_off_above_outstanding_refused() { assert_eq!((st.paid, st.written_off), (cents(4_000), cents(6_000))); } -/// D-49's same-year recovery, and BS-arap-5 INVARIANT 2: reversing the +/// D-49's same-year recovery, and BS-arap-5 invariant 4: reversing the /// write-off re-instates the debt (it is not a new movement), and the /// payment then recorded settles it; a recovery is income, never a /// payment event. @@ -1502,7 +1502,7 @@ fn days(b: &Books) -> Vec { proptest! { #![proptest_config(ProptestConfig::with_cases(256))] - /// BS-arap-2 INVARIANTS 1, 2 and 6 over random histories of creates, + /// BS-arap-2 invariants 1, 6 and 9 over random histories of creates, /// payments, voids, reversals of any entry and refused hand lines: at /// every date the control accounts equal their documents (no /// difference, nothing unattached: no command adds a hand line), each @@ -1538,9 +1538,9 @@ proptest! { } } - /// BS-arap-2 INVARIANT 5: the aging as of a day partitions what the + /// BS-arap-2 invariant 8: the aging as of a day partitions what the /// documents owe then (in books these commands write, none owes less - /// than nothing). INVARIANT 4 (Store, replay and Snapshot agree) is + /// than nothing). Invariant 7 (Store, replay and Snapshot agree) is /// ledger-store's `status_is_a_function_of_journal_and_date`. #[test] fn aging_partitions_what_documents_owe(ops in prop::collection::vec(arb_op(), 0..30)) { @@ -1562,7 +1562,7 @@ proptest! { } } - /// BS-arap-2 INVARIANT 3: reversing a tagged entry moves its documents by + /// BS-arap-2 invariant 4: reversing a tagged entry moves its documents by /// exactly the opposite of the entry's own tagged lines from the /// reversal's day (read from the entry reversed, not from the mirror, /// so a mirror that lost its tag is caught); reversing that reversal @@ -1725,7 +1725,7 @@ fn terms_derive_due_dates() { assert!(Terms::new(TermsKind::NetEom(3_651), None).is_err()); } -/// BS-arap-3 INVARIANT 2: the discount's bound, its date, and the terms that +/// BS-arap-3 invariant 2: the discount's bound, its date, and the terms that /// cannot carry one. #[test] fn discount_bounds_and_late_reason() { @@ -1795,7 +1795,7 @@ fn discount_bounds_and_late_reason() { assert_eq!(kernel::discount_max(cents(-1), 200), None); } -/// BS-arap-3 INVARIANT 3: the canonical spellings read back as they print. +/// BS-arap-3 invariant 3: the canonical spellings read back as they print. #[test] fn terms_describe_and_parse_round_trip() { for text in [ @@ -2286,7 +2286,7 @@ fn bill_on_terms_with_discount() { } /// A discount taken after the discount date needs a reason (BS-arap-6 -/// INVARIANT 2); a bill with an asset or prepaid line refuses one with the +/// invariant 6); a bill with an asset or prepaid line refuses one with the /// D-49 remedy, and none of the refusals changes the books. #[test] fn late_discount_needs_a_reason() { @@ -2433,7 +2433,7 @@ fn a_fee_posts_gross_to_receivables_and_net_to_the_bank() { /// A payment that settles more than one document names its lines in /// application order, and two applications on one document are refused: -/// each document's bound is one bound (BS-arap-6 INVARIANTS 1 and 2). +/// each document's bound is one bound (BS-arap-6 invariants 4 and 5). #[test] fn a_settlement_names_its_lines_and_refuses_a_document_twice() { use ledger_core::{Application, DocRef, SettleParams}; diff --git a/crates/ledger-core/tests/spec_parties.rs b/crates/ledger-core/tests/spec_parties.rs index 3d0897de..4f0cb729 100644 --- a/crates/ledger-core/tests/spec_parties.rs +++ b/crates/ledger-core/tests/spec_parties.rs @@ -1919,7 +1919,7 @@ mod shares { assert_eq!((a.paid, a.received), (Decimal::ZERO, Decimal::ZERO)); } - /// BS-partner-3 item 3 (capital first): a members' entry counts what + /// BS-partner-3 statement 3 (capital first): a members' entry counts what /// moved their capital, not other money on it: 300.00 in, 200.00 of it /// Tobin's capital and 100.00 an expense refunded, is Tobin's 200.00 /// received (cash) and nothing of Morgan's. (Before P3 the 300.00 net diff --git a/crates/ledger-core/tests/spec_party_totals.rs b/crates/ledger-core/tests/spec_party_totals.rs index a90cd3f0..bd7bf69a 100644 --- a/crates/ledger-core/tests/spec_party_totals.rs +++ b/crates/ledger-core/tests/spec_party_totals.rs @@ -550,7 +550,7 @@ fn defect14_shares_take_the_partys_side_and_reversals_flip() { ); } -/// BS-partner-3 item 4: on the member-only entries, basis all is the statement of +/// BS-partner-3 statement 6: on the member-only entries, basis all is the statement of /// members' equity (contributions and distributions, the same dates), and /// basis cash is the K-1 worksheet's cash contributions. #[test] @@ -655,7 +655,7 @@ fn defect24_an_accrual_through_another_liability_counts_once() { assert_eq!(b.totals(c, Basis::All), (Decimal::ZERO, d("1200.00"))); } -/// Defect 24 and BS-partner-3 item 6: a credit to what the company owes a party +/// Defect 24 and BS-partner-3 statement 8: a credit to what the company owes a party /// itself never counts as paying it. A fee on the issuer's own card is a /// bill from the issuer (counted when the card is paid); a distribution /// still owed to a member counts when it is paid; equipment bought on the @@ -778,7 +778,7 @@ fn a_distribution_owed_counts_twice_until_the_members_are_named_its_creditors() /// again when paid (400.00); now it counts nothing until it is paid, then /// 200.00, once, on both bases (Helvering v. Price; party_target /// INVARIANT 2). The statement of members' equity counts it when declared: -/// party totals catch up when it is paid (BS-partner-3 item 4's conditions). +/// party totals catch up when it is paid (BS-partner-3 statement 6's conditions). #[test] fn defect24_a_distribution_declared_to_a_payable_counts_once_when_paid() { let mut b = books(); @@ -829,7 +829,7 @@ fn defect24_a_distribution_declared_to_a_payable_counts_once_when_paid() { assert_eq!(b.totals(t, Basis::Cash), (d("300.00"), Decimal::ZERO)); } -/// BS-partner-3 item 3: a distribution's cash is the money it paid and its in +/// BS-partner-3 statement 3: a distribution's cash is the money it paid and its in /// kind the property it gave. Equipment carried at 1,000.00 less 300.00 /// depreciated, and 100.00 in cash, distributed: 100.00 cash and 700.00 /// in kind (it read 800.00 in kind and no cash, the equipment's cost @@ -868,7 +868,7 @@ fn a_distribution_of_money_and_depreciated_property_splits_by_what_moved() { assert_eq!(b.resolved(gain).1, vec![part(t, "900.00", "0", "900.00")]); } -/// Defect 24 and the card rule (BS-partner-3 item 5): a gift card the company +/// Defect 24 and the card rule (BS-partner-3 statement 7): a gift card the company /// sold is deferred revenue, a promise, though its account's name says /// "card". It counted as received when sold and again when redeemed /// (200.00); now once, when the money came in. A card the company pays @@ -892,7 +892,7 @@ fn defect24_a_gift_card_sold_is_received_once() { assert_eq!(b.totals(c, Basis::All), (Decimal::ZERO, d("100.00"))); } -/// BS-partner-3 item 5 and `parties::card_accounts` INVARIANTS 1-4: one rule for +/// BS-partner-3 statement 7 and `parties::card_accounts` INVARIANTS 1-4: one rule for /// what a card is. Before any business card is recorded, the liabilities /// whose names say "card" but not "gift" (2050 Business Card; never 2410 /// Gift Card Liability), less a member's card's account; once one is @@ -958,7 +958,7 @@ fn a_card_is_a_recorded_business_card_else_a_liability_named_card() { assert_eq!(b.resolved(on_2050).0.direction, Direction::Neither); } -/// BS-partner-3 item 3, case 3: E is the movement of equity other than retained +/// BS-partner-3 statement 3, case 3: E is the movement of equity other than retained /// earnings, so a members' entry reads as the statement of members' equity /// reads it. Retained earnings given up for equipment moves no member's /// capital: neither, as the statement shows no distribution. Retained @@ -1035,7 +1035,7 @@ fn a_refund_is_received_from_the_vendor() { assert_eq!(b.totals(v, Basis::Cash), (d("100.00"), d("20.00"))); } -/// BS-partner-3 item 3 (capital first): a mixed contribution is split into money +/// BS-partner-3 statement 3 (capital first): a mixed contribution is split into money /// and property exactly as the K-1 worksheet splits it (its SCENARIO 3), /// whichever member the shares list first; an expense a member pays /// straight to capital is cash, as on the K-1 (k1 INVARIANT 3); a debt @@ -1168,7 +1168,7 @@ fn a_members_entry_keeps_its_reading_after_they_leave() { ); } -/// BS-partner-3 item 3, case 1: a period's closing entry moves nothing with +/// BS-partner-3 statement 3, case 1: a period's closing entry moves nothing with /// anyone: direction neither, its members' part their income allocated /// (credited to their capital: negative), counted in no total. #[test] @@ -1661,7 +1661,7 @@ proptest! { /// account converted to capital, some through their distributions /// accounts, some declared to distributions payable and paid later, /// and reverse some of it later in the year. For each member, over - /// every span from the year's start to any date (BS-partner-3 item 4's + /// every span from the year's start to any date (BS-partner-3 statement 6's /// conditions hold: a reversal in such a span always has its original /// in it): basis all is the statement of members' equity's /// contributions and distributions, but for a distribution declared diff --git a/crates/ledger-core/tests/spec_projects.rs b/crates/ledger-core/tests/spec_projects.rs index ff902ac9..d50ecc45 100644 --- a/crates/ledger-core/tests/spec_projects.rs +++ b/crates/ledger-core/tests/spec_projects.rs @@ -534,7 +534,7 @@ fn a_reversal_nets_a_project_to_zero() { let entries = project_entries(&b.l, c); assert_eq!(entries, vec![(r, cents(180_000)), (e, cents(-180_000))]); // Nothing left on an account, but two lines tagged: it breaks even, - // it isn't untagged (BS-statement-5 item 7). + // it isn't untagged (WB-statement-7). assert!(t.expenses_by_account.is_empty()); assert_eq!((t.revenue_lines, t.expenses_lines), (0, 2)); assert!(t.any_tagged()); @@ -652,7 +652,7 @@ fn differs_from_names_projects() { assert_eq!(a.l.differs_from(&before), vec!["projects"]); } -/// BS-statement-5 item 7: the margin is the contribution's share of +/// WB-statement-7: the margin is the contribution's share of /// revenue, one place, half to even, and none without revenue. #[test] fn contribution_margin_is_one_place_and_none_without_revenue() { @@ -671,7 +671,7 @@ fn contribution_margin_is_one_place_and_none_without_revenue() { assert_eq!(pct(Decimal::MAX, cents(1)), None, "never panics"); } -/// BS-statement-5 item 7: each month's net to date opens on the lines +/// WB-statement-7: each month's net to date opens on the lines /// before the months (a deposit last year) and ends on the net to date; /// a reimbursement credited above its cost leaves the expense below zero. #[test] diff --git a/crates/ledger-core/tests/spec_reports.rs b/crates/ledger-core/tests/spec_reports.rs index 6d737ec0..be8adb6e 100644 --- a/crates/ledger-core/tests/spec_reports.rs +++ b/crates/ledger-core/tests/spec_reports.rs @@ -2505,9 +2505,9 @@ proptest! { /// the cash part of the equity and designated-debt movements: each /// entry's cash applied to the sections moving against it, operating, /// investing, financing, each up to its own movement (BS-statement-3 - /// rule 3), then to the kinds within each section in their order; + /// statement 4), then to the kinds within each section in their order; /// plus what the loan or a member's capital paid or received for the - /// company (rule 11, D-42): the loan pays for operating lines (the + /// company (statement 16, D-42): the loan pays for operating lines (the /// balance-sheet ones first) and receives for revenue and expense; /// capital pays and receives for revenue and expense only. Written /// here apart from the kernel. diff --git a/crates/ledger-core/tests/statements.rs b/crates/ledger-core/tests/statements.rs index 2e61b748..9bec545b 100644 --- a/crates/ledger-core/tests/statements.rs +++ b/crates/ledger-core/tests/statements.rs @@ -1444,7 +1444,7 @@ fn lines(ls: &[ledger_core::reports::CashFlowLine]) -> Vec<(String, Decimal)> { /// amounts borrowed"): borrowing and repayment are separate lines, one /// per entry, borrowing first (each lender's, by code), then repayments. /// The software the owner paid personally is borrowed from the owner and -/// spent on its date (BS-statement-3 rule 11, D-42: constructive receipt +/// spent on its date (BS-statement-3 statement 16, D-42: constructive receipt /// and disbursement). Financing: +100 + 1,000 − 100 − 400 = 600; nothing /// is disclosed. #[test] @@ -1487,7 +1487,7 @@ fn a_loan_the_entity_makes_is_investing_gross() { assert_eq!(cf.cash_from_investing, dec(-300)); } -/// Oracle: D-42 (BS-statement-3 rule 11; ASC 230 is silent on a payment +/// Oracle: D-42 (BS-statement-3 statement 16; ASC 230 is silent on a payment /// made on the entity's behalf, PwC FSP 6.9.3.1 and DART Roadmap 7.2 /// present it as constructive receipt and disbursement). The owner paying /// software personally is cash the company borrowed (financing +100) and diff --git a/crates/ledger-gui/src/attention.rs b/crates/ledger-gui/src/attention.rs index 662fdb53..ea0b1741 100644 --- a/crates/ledger-gui/src/attention.rs +++ b/crates/ledger-gui/src/attention.rs @@ -151,7 +151,7 @@ mod tests { .unwrap() } - /// INVARIANT 2's cash flow items (BS-statement-3 rule 12, D-35): a + /// INVARIANT 2's cash flow items (BS-statement-3 statement 17, D-35): a /// sale of equipment for an IOU is a Todo naming the entry, with the /// statement's fix; equipment bought on an operating card is Info; a /// sale for cash asks nothing. diff --git a/crates/ledger-gui/src/demo.rs b/crates/ledger-gui/src/demo.rs index e669aa31..72b0579b 100644 --- a/crates/ledger-gui/src/demo.rs +++ b/crates/ledger-gui/src/demo.rs @@ -247,7 +247,7 @@ pub fn build(dir: &Path, today: NaiveDate) -> Result<(), StoreError> { "Client work", &ledger_core::ProjectFacts { // Its invoices' lines and the contractors it pays are tagged - // to it (BS-statement-5 item 8), so its snapshot is its + // to it (BS-statement-5 statement 6), so its snapshot is its // revenue less its direct costs. description: Some( "Design work for the studio's clients: every client invoice, and the contractors who work on it." @@ -306,7 +306,7 @@ pub fn build(dir: &Path, today: NaiveDate) -> Result<(), StoreError> { .map(|n| s.add_customer(n)) .collect::>()?; // Work on spec for a customer, hoping they adopt it: its costs are - // expenses, and nothing is receivable (BS-statement-5 item 4). + // expenses, and nothing is receivable (BS-statement-5 statement 5). let tidepool_started = start + Months::new(13); let tidepool = s.add_project( "Tidepool app", diff --git a/crates/ledger-gui/src/pages/entry.rs b/crates/ledger-gui/src/pages/entry.rs index 08c7c29c..3da52ffd 100644 --- a/crates/ledger-gui/src/pages/entry.rs +++ b/crates/ledger-gui/src/pages/entry.rs @@ -302,7 +302,7 @@ pub fn detail(ui: &mut Ui, b: &Books, e: &EntryInfo, shell: &mut Shell<'_>) { ui.add_space(18.0); // The invoice or bill it records: its lines as the document - // gives them, each project a link (BS-statement-5 item 8). + // gives them, each project a link (BS-statement-5 statement 6). if let Some(doc) = document_of(b, e.id) { section(ui, &doc.title); document_lines(ui, &doc, &class_names, total_w, amt_w, shell); @@ -756,7 +756,7 @@ mod tests { /// A tagged line keeps its project tag inside its cell, in a narrow /// pane too: the name is cut to leave the tag room, so the amounts /// stay in their columns (an invoice's revenue line and its document - /// line, each tagged; BS-statement-5 item 8). + /// line, each tagged; BS-statement-5 statement 6). #[test] fn a_tagged_line_keeps_its_amounts_in_their_column() { use ledger_core::arap::DocumentLine; diff --git a/crates/ledger-gui/src/pages/parties.rs b/crates/ledger-gui/src/pages/parties.rs index 79061150..d1612a68 100644 --- a/crates/ledger-gui/src/pages/parties.rs +++ b/crates/ledger-gui/src/pages/parties.rs @@ -561,7 +561,7 @@ pub fn show_list(ui: &mut Ui, b: &Books, shell: &mut Shell<'_>) { } /// The party's totals with property in kind (basis all, BS-partner-3 -/// item 4), when it gave or took any in the period: "With property +/// statement 5), when it gave or took any in the period: "With property /// contributed or distributed: paid $X, received $Y". None when nothing /// moved in kind (the cash totals are then the whole story). pub fn in_kind_text(flow: &crate::books::PartyFlow) -> Option { @@ -775,7 +775,7 @@ pub fn show_party(ui: &mut Ui, b: &Books, id: PartyId, shell: &mut Shell<'_>) { r.context_menu(|ui| widgets::copy_item(ui, "Copy amount", &v.to_string())); } }); - // Basis all (BS-partner-3 item 4): property in kind, when any. + // Basis all (BS-partner-3 statement 5): property in kind, when any. if let Some(text) = in_kind_text(&flow) { ui.add_space(6.0); ui.add( diff --git a/crates/ledger-gui/src/pages/projects.rs b/crates/ledger-gui/src/pages/projects.rs index bfedd8cb..81de2de5 100644 --- a/crates/ledger-gui/src/pages/projects.rs +++ b/crates/ledger-gui/src/pages/projects.rs @@ -1,7 +1,7 @@ //! Projects: every class, with its facts (what it is, where it stands, who //! it is for), and one project completely: its snapshot (revenue, direct //! costs, contribution before overhead and its margin, to date or this -//! fiscal year, BS-statement-5 item 7), revenue and costs by month with the +//! fiscal year, WB-statement-7), revenue and costs by month with the //! running net, costs by category and by account, its entries, documents, //! decisions and history (BS-statement-5). Every figure is ledger-core's (`project_figures`, //! `project_to_date`, `project_entries`), the same the server's @@ -419,7 +419,7 @@ impl Snap { } /// The note on contribution: what it counts and what it leaves out. -pub const CONTRIBUTION_NOTE: &str = "Revenue less this project's direct costs: every expense line tagged to it, fixed and variable alike (what management accounting calls a segment margin, not a variable-cost contribution margin). Company overhead that isn't tagged to a project (rent, software, insurance, the owner's time) isn't counted, so a project in the black can still leave the company in the red. A management-accounting view (BS-statement-5 items 2 and 4), not a GAAP figure."; +pub const CONTRIBUTION_NOTE: &str = "Revenue less this project's direct costs: every expense line tagged to it, fixed and variable alike (what management accounting calls a segment margin, not a variable-cost contribution margin). Company overhead that isn't tagged to a project (rent, software, insurance, the owner's time) isn't counted, so a project in the black can still leave the company in the red. A management-accounting view (WB-statement-7), not a GAAP figure."; /// The snapshot: a header with where it stands to date and the to date / /// fiscal year switch, then its tiles (`shown`: to date, or for `year`, diff --git a/crates/ledger-gui/src/pages/reports.rs b/crates/ledger-gui/src/pages/reports.rs index 34fe33ba..2cee3259 100644 --- a/crates/ledger-gui/src/pages/reports.rs +++ b/crates/ledger-gui/src/pages/reports.rs @@ -2719,7 +2719,7 @@ mod tests { // The figures, by hand: the loan (not a financing setting) is an // operating receipt, 2,500.00; what the members paid personally // (85.00 and 216.40, 301.40) is borrowed from them through 2100 - // and spent (D-42, BS-statement-3 rule 11); the members' + // and spent (D-42, BS-statement-3 statement 16); the members' // contributions are financing, each named (1,200.00 and 800.00); // the reimbursement repays 2100 (301.40); the tablet is disclosed // (630.00), the reversed laptop gone. diff --git a/crates/ledger-gui/tests/parties.rs b/crates/ledger-gui/tests/parties.rs index b4645385..38f8c8fa 100644 --- a/crates/ledger-gui/tests/parties.rs +++ b/crates/ledger-gui/tests/parties.rs @@ -282,7 +282,7 @@ fn fixture(tag: &str) -> Fixture { let e = pay(&mut s, d(2026, 1, 20), "Old Co", cash, 12_300); s.set_entry_party(e, Some(old)).unwrap(); s.update_party(old, PartyField::Archived(true)).unwrap(); - // What the members advanced is money (BS-partner-3 item 5): Due to + // What the members advanced is money (BS-partner-3 statement 7): Due to // Shareholders is a financing account; the cash account stays the // books' (the settings file names both). journal_settings( @@ -356,7 +356,7 @@ fn each_partys_totals_are_the_books_numbers() { // (BS-1099-1); the card's charge is no payment out of cash. assert_eq!(line.paid, cents(150_000)); assert_eq!(line.undetermined, cents(30_000)); - // Party totals count all of it as paid to Sam (BS-partner-3 item 9): the + // Party totals count all of it as paid to Sam (BS-partner-3 statement 11): the // 1099's buckets, and the card's 200 (no business card is recorded, // so the worksheet lists it nowhere). assert_eq!( @@ -1490,7 +1490,7 @@ fn the_party_page_shows_the_basis_and_in_kind() { } /// The viewer's what-for reads a reversal as parties::flow does, the -/// opposite of its original (BS-partner-3 item 3; design §1.4): a member +/// opposite of its original (BS-partner-3 statement 3; design §1.4): a member /// paying the card from their own funds (Dr card / Cr 2100), tagged with /// the issuer, then reversed, is nothing on the issuer's page, paid or /// what for. Its lines alone read as a second payment. diff --git a/crates/ledger-gui/tests/projects.rs b/crates/ledger-gui/tests/projects.rs index faf13ee0..70cb3829 100644 --- a/crates/ledger-gui/tests/projects.rs +++ b/crates/ledger-gui/tests/projects.rs @@ -603,7 +603,7 @@ fn a_long_party_name_keeps_to_its_card() { } } -// ------------------------------------------------- the snapshot (BS-statement-5 item 7) +// ------------------------------------------------- the snapshot (WB-statement-7) /// Books holding one project of `kind`, started `started_on`, with /// `posts`: (date, debit code, credit code, cents), the line that isn't @@ -1253,7 +1253,7 @@ proptest::proptest! { } } -/// BS-statement-5 item 8: an invoice's or bill's page (its entry's) lists +/// BS-statement-5 statement 6: an invoice's or bill's page (its entry's) lists /// the document's lines, each project a link that opens it; an untagged /// line has none. The entry's own lines show the tagged revenue or cost /// line too. @@ -1373,7 +1373,7 @@ fn an_invoice_and_a_bill_show_each_lines_project() { } /// The demo's "Client work" project carries every client invoice ( -/// BS-statement-5 item 8): its revenue to date is the invoices' total, its direct +/// BS-statement-5 statement 6): its revenue to date is the invoices' total, its direct /// costs the contractors tagged to it. #[test] fn the_demos_client_work_counts_every_client_invoice() { diff --git a/crates/ledger-import/tests/spec_import.rs b/crates/ledger-import/tests/spec_import.rs index 1722141f..6786381a 100644 --- a/crates/ledger-import/tests/spec_import.rs +++ b/crates/ledger-import/tests/spec_import.rs @@ -1813,7 +1813,7 @@ fn iif_refuses_an_undeclared_account() { ); } -/// iif INVARIANT 8 (BS-format-2 item 7): an entry with a line on one +/// iif INVARIANT 8 (BS-format-2 statement 26): an entry with a line on one /// accounts receivable account still writes one transaction, and the entry /// is named to the human so they can add QuickBooks' customer or vendor. #[test] @@ -1855,7 +1855,7 @@ fn iif_writes_an_entry_on_one_receivable_or_payable_account() { assert_eq!(iif.receivable_payable, [e]); } -/// iif INVARIANT 8 (BS-format-2 item 7): an entry with lines on both the +/// iif INVARIANT 8 (BS-format-2 statement 7): an entry with lines on both the /// receivables and payables control accounts is refused, naming its id: /// QuickBooks Desktop records at most one A/R or A/P account a /// transaction, and splitting the entry would change what it says. @@ -1912,7 +1912,7 @@ fn iif_refuses_an_entry_on_two_receivable_or_payable_accounts() { ); } -/// iif INVARIANT 8 (BS-format-2 item 7): two distinct receivable accounts +/// iif INVARIANT 8 (BS-format-2 statement 7): two distinct receivable accounts /// in one entry are refused too (its `qb_type` decides, whatever the /// callers call them), and every offending entry is named. #[test] @@ -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 (BS-format-2 rules 3, 4): plain ASCII, a colon a '-' (a colon starts a +/// is (BS-format-2 statements 10 and 18): 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 diff --git a/crates/ledger-mcp/src/handbook.rs b/crates/ledger-mcp/src/handbook.rs index c26b5217..dd771edf 100644 --- a/crates/ledger-mcp/src/handbook.rs +++ b/crates/ledger-mcp/src/handbook.rs @@ -31,7 +31,7 @@ //! 6. A section says an invoice's or bill's lines take a project only //! for books that declared the journal feature //! `document_line_projects`; for the rest, that they wait for their -//! format upgrade (BS-format-1, BS-statement-5 item 8). +//! format upgrade (BS-format-1, BS-statement-5 statement 6). //! ``` use crate::settings::Settings; @@ -186,8 +186,8 @@ pub fn period_rule() -> String { ) } -/// How an invoice's or bill's lines reach a project (BS-statement-5 item -/// 8), for books that declared the journal feature +/// How an invoice's or bill's lines reach a project (BS-statement-5 statement +/// 6), for books that declared the journal feature /// `document_line_projects` or not yet (INVARIANT 6). pub fn document_projects_rule(declared: bool) -> &'static str { if declared { @@ -591,7 +591,7 @@ mod tests { with.contains("books.create_invoice and books.create_bill take class on each line") ); assert!(!with.contains("takes no project")); - // The owner's decision (BS-statement-5 item 8, D-43): one project or none a + // The owner's decision (BS-statement-5 statement 4, D-43): one project or none a // line, no percentage split, a shared cost by the allocation // convention. assert!(with.contains("Each line names one project or none")); diff --git a/crates/ledger-mcp/src/tools/documents.rs b/crates/ledger-mcp/src/tools/documents.rs index f5320020..d6c61f54 100644 --- a/crates/ledger-mcp/src/tools/documents.rs +++ b/crates/ledger-mcp/src/tools/documents.rs @@ -78,7 +78,7 @@ fn document_lines( /// A document's notes, each project once, in the order first named: its /// late-tag note ([`projects::late_tag_note`]) for a finished or abandoned /// project, and on an invoice ([`projects::on_spec_invoice_note`]) one for -/// an on-spec project (BS-statement-5 items 4, 5 and 8). +/// an on-spec project (BS-statement-5 statements 5, 6 and 7). fn document_notes( ledger: &ledger_core::Ledger, lines: &[DocumentLine], diff --git a/crates/ledger-mcp/src/tools/helpers.rs b/crates/ledger-mcp/src/tools/helpers.rs index bbcd608d..373314a2 100644 --- a/crates/ledger-mcp/src/tools/helpers.rs +++ b/crates/ledger-mcp/src/tools/helpers.rs @@ -141,7 +141,7 @@ pub(crate) fn settings_problems(ledger: &Ledger, cfg: &Settings) -> Vec let how = " with books.set_setting"; // The cash flow roles: codes the chart lacks here; the rest is the // engine's own check, the one the statement refuses on (BS-statement-3 - // rule 2), so the two never disagree. + // statement 3), so the two never disagree. let lists = [ ( ledger_core::RoleList::Cash, diff --git a/crates/ledger-mcp/src/tools/parties.rs b/crates/ledger-mcp/src/tools/parties.rs index 7f5d07e8..711083a6 100644 --- a/crates/ledger-mcp/src/tools/parties.rs +++ b/crates/ledger-mcp/src/tools/parties.rs @@ -144,7 +144,7 @@ fn party_document( } /// A party-totals `basis` from a tool: "cash" (the default) or "all" -/// (BS-partner-3 item 4); any other word is refused. +/// (BS-partner-3 statement 5); any other word is refused. fn parse_basis(basis: Option<&str>) -> Result { match basis { None => Ok(ledger_core::parties::Basis::default()), diff --git a/crates/ledger-mcp/src/tools/projects.rs b/crates/ledger-mcp/src/tools/projects.rs index b33fe568..637d634a 100644 --- a/crates/ledger-mcp/src/tools/projects.rs +++ b/crates/ledger-mcp/src/tools/projects.rs @@ -144,7 +144,7 @@ fn by_name(ledger: &Ledger) -> Vec { } /// The note `books.add_line` and `books.record_payout` give for a line tagged to a finished or -/// abandoned project (BS-statement-5 item 5). +/// abandoned project (BS-statement-5 statement 7). pub(super) fn late_tag_note(ledger: &Ledger, id: ClassId) -> Option { let f = ledger.project_facts(id)?; if !f.status.is_over() { @@ -162,7 +162,7 @@ pub(super) fn late_tag_note(ledger: &Ledger, id: ClassId) -> Option { } /// The note `books.create_invoice` gives for a line naming an on-spec -/// project (BS-statement-5 items 4 and 8): on spec, a hoped-for payment is +/// project (BS-statement-5 statements 5 and 6): on spec, a hoped-for payment is /// no receivable and no income until received, so an invoice for one /// means there is now an agreement, or it shouldn't be an invoice. pub(super) fn on_spec_invoice_note(ledger: &Ledger, id: ClassId) -> Option { diff --git a/crates/ledger-mcp/src/tools/reports.rs b/crates/ledger-mcp/src/tools/reports.rs index 1062aad9..30ccf3f4 100644 --- a/crates/ledger-mcp/src/tools/reports.rs +++ b/crates/ledger-mcp/src/tools/reports.rs @@ -729,7 +729,7 @@ impl BooksServer { checked.push(format!("{n} stored files match their SHA-256")); } // Receivables and payables equal their documents (BS-arap-2 - // INVARIANT 1): an identity, so a difference is an engine error. + // invariant 1): an identity, so a difference is an engine error. let checks = store .ledger() .control_check(chrono::NaiveDate::MAX) diff --git a/crates/ledger-mcp/src/tools/write_offs.rs b/crates/ledger-mcp/src/tools/write_offs.rs index 3e566035..eff299b5 100644 --- a/crates/ledger-mcp/src/tools/write_offs.rs +++ b/crates/ledger-mcp/src/tools/write_offs.rs @@ -65,7 +65,7 @@ impl BooksServer { Some(a) => parse_amount(a)?, None => owed, }; - // The evidence is the point of a write-off (BS-arap-5 INVARIANT 1): one + // The evidence is the point of a write-off (BS-arap-5 statement 9): one // of the two, and the preview says so too rather than posting // without it later. match (p.upload_id.is_some(), p.existing_attachment_id.is_some()) { diff --git a/crates/ledger-mcp/src/types.rs b/crates/ledger-mcp/src/types.rs index 1f7862f2..867199bc 100644 --- a/crates/ledger-mcp/src/types.rs +++ b/crates/ledger-mcp/src/types.rs @@ -3764,7 +3764,7 @@ pub struct AgingDocumentOut { } /// The aging's account against its documents (the control check, BS-ledger-8, -/// BS-arap-2 INVARIANT 1). +/// BS-arap-2 invariant 1). #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] pub struct AgingControlOut { /// "1200 Accounts Receivable" or "2000 Accounts Payable". diff --git a/crates/ledger-package/src/attention.rs b/crates/ledger-package/src/attention.rs index caa75a04..055b4670 100644 --- a/crates/ledger-package/src/attention.rs +++ b/crates/ledger-package/src/attention.rs @@ -71,7 +71,7 @@ //! amortization: no counterparty by nature) (one item: Info under //! suggest, Todo under require; its prompt names //! books.set_entry_party); each warning of the fiscal year's -//! statement of cash flows (BS-statement-3 rule 12: equipment sold for +//! statement of cash flows (BS-statement-3 statement 17: equipment sold for //! an IOU, Todo; bought on an operating payable, Info; one per //! entry, its detail the warning's fix); a filed PDF whose text //! extraction failed (Todo, one per file: a human must read its @@ -1342,7 +1342,7 @@ pub fn find_with( } // The statement of cash flows' warnings this fiscal year ( - // BS-statement-3 rule 12, D-35): equipment sold for an IOU, flagged with its fix + // BS-statement-3 statement 17, D-35): equipment sold for an IOU, flagged with its fix // (Todo); equipment bought on an operating payable, following how the // payable is classified (Info). A statement the settings can't give // (no cash accounts yet) has none. diff --git a/crates/ledger-package/src/iif.rs b/crates/ledger-package/src/iif.rs index 561913c2..82797604 100644 --- a/crates/ledger-package/src/iif.rs +++ b/crates/ledger-package/src/iif.rs @@ -19,7 +19,7 @@ //! imported close would zero its period's profit. The file's //! balances are the trial balance as of as_of without the closes. //! 3. Every class (project) in the books is declared, and each line -//! carries its class (BS-format-2 rule 8). +//! carries its class (BS-format-2 statements 27 and 28). //! ``` use chrono::NaiveDate; diff --git a/crates/ledger-package/src/reports.rs b/crates/ledger-package/src/reports.rs index 509e38e6..e2fd8c5e 100644 --- a/crates/ledger-package/src/reports.rs +++ b/crates/ledger-package/src/reports.rs @@ -16,7 +16,7 @@ //! 2. The cash flow statement needs at least one cash account, and //! every code it is given must be in the chart; account lists a call //! leaves empty default to the settings' roles. It foots, or it is -//! refused (an engine error, never a figure: BS-statement-3 rule 9); +//! refused (an engine error, never a figure: BS-statement-3 statement 14); //! roles that contradict each other or the chart are refused by the //! engine, naming the setting, so the viewer and the server refuse //! alike. Members are named on their contributions and diff --git a/crates/ledger-package/tests/p3_seams.rs b/crates/ledger-package/tests/p3_seams.rs index 8a68815b..02e35421 100644 --- a/crates/ledger-package/tests/p3_seams.rs +++ b/crates/ledger-package/tests/p3_seams.rs @@ -127,8 +127,8 @@ fn pnl_depreciation(l: &Ledger, end: NaiveDate) -> Decimal { pnl_expense(l, "6500", end) } -/// The members' figures agree on every date as BS-partner-1, BS-partner-3 items 4 and 8 -/// and BS-statement-3 rule 11 say: the statement of members' equity and the K-1 +/// The members' figures agree on every date as BS-partner-1, BS-partner-3 statements 6 and 10 +/// and BS-statement-3 statement 16 say: the statement of members' equity and the K-1 /// worksheet are one roll-forward; party totals on basis all are the /// statement's contributions, on basis cash the K-1's cash /// contributions; the cash flow statement's contributions are the K-1's @@ -178,7 +178,7 @@ fn the_members_figures_agree_on_every_date() { m.contributions, k.contributions_cash + k.contributions_property ); - // Party totals (BS-partner-3 item 4). + // Party totals (BS-partner-3 statement 6). let a = activity(&b, party, end); assert!(a.unresolved.is_empty(), "{name} {end}: {:?}", a.unresolved); assert_eq!(a.totals(Basis::All).1, m.contributions, "{name} {end}"); @@ -188,7 +188,7 @@ fn the_members_figures_agree_on_every_date() { "{name} {end}" ); assert_eq!(a.received_in_kind, k.contributions_property, "{name} {end}"); - // The cash flow (BS-statement-3 rule 11, BS-partner-3 item 8). + // The cash flow (BS-statement-3 statement 16, BS-partner-3 statement 10). assert_eq!( kind( &cf, @@ -208,7 +208,7 @@ fn the_members_figures_agree_on_every_date() { // A distribution declared to Distributions Payable is a // distribution on the statement of members' equity when declared // and on the cash flow statement and in party totals when paid - // (BS-statement-3 rule 2, BS-partner-3 item 4). + // (BS-statement-3 statement 3, BS-partner-3 statement 6). distributions_paid -= kind( &cf, CashFlowSection::Financing, @@ -281,7 +281,7 @@ fn the_members_figures_agree_on_every_date() { dec("2400.00") ); // Mid-year, the declaration is unpaid: the statement counts it, party - // totals and the cash flow don't yet (BS-partner-3 item 4's second condition). + // totals and the cash flow don't yet (BS-partner-3 statement 6's second condition). let mid = d("2026-06-30"); assert_eq!( activity(&b, b.ana, mid).totals(Basis::Cash).0, @@ -296,7 +296,7 @@ fn the_members_figures_agree_on_every_date() { ); } -/// BS-statement-3 rule 2, from the seam review: a distribution declared to a +/// BS-statement-3 statement 3, from the seam review: a distribution declared to a /// liability and paid later is a financing outflow when paid (ASC /// 230-10-45-15(a)), its declaration a noncash financing activity; before /// the fix it was "Cash paid to suppliers and employees". @@ -349,7 +349,7 @@ fn a_distribution_declared_then_paid_is_financing_when_paid() { ); } -/// BS-partner-3 item 9 and BS-1099-1: for a payee every entry of which names it alone, +/// BS-partner-3 statement 11 and BS-1099-1: for a payee every entry of which names it alone, /// party totals' paid less received (basis cash) is the 1099 worksheet's /// paid + excluded card + undetermined + not reportable, less what the /// worksheet lists as received for something else; and the worksheet @@ -445,7 +445,7 @@ fn iif_dates(iif: &str) -> Vec { .collect() } -/// Depreciation is one figure everywhere (BS-asset-1 rule 8, BS-statement-3 rule 8, +/// Depreciation is one figure everywhere (BS-asset-1 statement 28, BS-statement-3 statement 13, /// BS-partner-4): the P&L's expense, the cash flow reconciliation's add-back, the /// tax-basis K-1's open item, the IIF's, and the runs plus what the /// disposal posted; the balance sheet's accumulated depreciation is the diff --git a/crates/ledger-package/tests/package.rs b/crates/ledger-package/tests/package.rs index 9323462c..3c2423b6 100644 --- a/crates/ledger-package/tests/package.rs +++ b/crates/ledger-package/tests/package.rs @@ -1717,7 +1717,7 @@ fn one_list_of_cash_accounts_per_package() { assert_eq!(text(&plain, "1099-worksheet-2026.csv"), tool(&cash)); } -/// BS-format-2 rule 8 (P3 cutover review, open point 1): the +/// BS-format-2 statements 27-30 (P3 cutover review, open point 1): the /// package's QuickBooks file declares every project as a class and /// carries each line's project in CLASS; a project name written /// differently is listed in the warnings and the README, whose IIF line @@ -1776,7 +1776,7 @@ fn the_package_iif_carries_each_lines_project() { ); } -/// BS-format-2 rule 8 with BS-statement-5 item 8: an invoice's or a bill's +/// BS-format-2 statement 27 with BS-statement-5 statement 6: an invoice's or a bill's /// lines carry their projects into CLASS through the entry they post, /// the revenue or expense line of each project tagged, an untagged /// part and the receivable or payable line left without a class. @@ -1921,7 +1921,7 @@ fn the_readme_lists_what_the_iif_writes_differently() { assert!(!text(&p, "README.txt").contains("Written differently")); } -/// BS-format-2 rule 7 (P3 review round 2): the file names no customer or vendor +/// BS-format-2 statement 26 (P3 review round 2): the file names no customer or vendor /// (Intuit states no such need for an IIF journal; QuickBooks Desktop asks /// for one on a journal entry to accounts receivable or payable, and takes /// one such account a transaction: sources/intuit-iif.md), so the README @@ -2022,7 +2022,7 @@ fn the_readme_names_the_entries_on_receivables_and_payables() { assert!(!text(&p, "README.txt").contains("customer or vendor")); } -/// BS-format-2 item 7: an entry with lines on both the receivables and +/// BS-format-2 statement 7: an entry with lines on both the receivables and /// payables control accounts is refused, naming its id, and the package is /// not built: QuickBooks Desktop records at most one A/R or A/P account a /// transaction, and splitting the entry would change what it says. @@ -2481,7 +2481,7 @@ fn the_k1_worksheet_reports_tax_basis_capital() { /// The CPA package's aging CSVs are the agings, one row per open document /// and a tie-out line that equals the control account (plan P4b S6, -/// 8.3.10; BS-ledger-8, BS-arap-2 INVARIANT 1). +/// 8.3.10; BS-ledger-8, BS-arap-2 invariant 1). #[test] fn the_aging_csvs_tie_to_the_control_check() { let dir = tempfile::Builder::new() diff --git a/crates/ledger-store/src/error.rs b/crates/ledger-store/src/error.rs index e162707a..e8c253d8 100644 --- a/crates/ledger-store/src/error.rs +++ b/crates/ledger-store/src/error.rs @@ -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( diff --git a/crates/ledger-store/src/format.rs b/crates/ledger-store/src/format.rs index 210b9d56..f6230dc1 100644 --- a/crates/ledger-store/src/format.rs +++ b/crates/ledger-store/src/format.rs @@ -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. diff --git a/crates/ledger-store/src/store.rs b/crates/ledger-store/src/store.rs index 8ccc35d0..2e324fb6 100644 --- a/crates/ledger-store/src/store.rs +++ b/crates/ledger-store/src/store.rs @@ -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 { diff --git a/crates/ledger-store/tests/arap_props.rs b/crates/ledger-store/tests/arap_props.rs index 2a2e5c51..bd613da8 100644 --- a/crates/ledger-store/tests/arap_props.rs +++ b/crates/ledger-store/tests/arap_props.rs @@ -1,5 +1,4 @@ -//! Documents through the store, at random (BS-arap-2 INVARIANTS 1, 2, -//! 4 and 6; plan P4b.15): histories of invoices, bills, payments (with a +//! Documents through the store, at random (BS-arap-2 invariants 1, 6, 7 and 9; plan P4b.15): histories of invoices, bills, payments (with a //! payment method and a reference, or none), voids, reversals of any //! entry, closed months and refused hand lines, run through `Store`, then //! replayed (the books reopened) and read by a `Snapshot`. @@ -9,7 +8,7 @@ //! the live books, their replay and a viewer's snapshot agree on //! every figure, at every date, and the control accounts equal //! their documents. -//! SOURCE: BS-entry-4 (replay), BS-arap-2 INVARIANTS 1, 2, 4, 6. +//! SOURCE: BS-entry-4 (replay), BS-arap-2 invariants 1, 6, 7 and 9. //! ``` use chrono::NaiveDate; @@ -417,7 +416,7 @@ fn agree(live: &Ledger, dir: &Path, docs: &[DocRef]) -> Result<(), TestCaseError proptest! { #![proptest_config(ProptestConfig::with_cases(32))] - /// BS-arap-2 INVARIANT 4 (and 1, 2, 6 through the store): a document's + /// BS-arap-2 invariant 7 (and 1, 6, 9 through the store): a document's /// state is a function of the journal and the day. Half the history, /// then the books reopened and compared; the rest on the reopened /// books, compared again. diff --git a/crates/ledger-store/tests/arap_standing.rs b/crates/ledger-store/tests/arap_standing.rs index a466b7f3..c9c53932 100644 --- a/crates/ledger-store/tests/arap_standing.rs +++ b/crates/ledger-store/tests/arap_standing.rs @@ -377,7 +377,7 @@ fn legacy_reversal_now_counts() { assert_eq!(trial_balance_json(&again), g["trial_balance"]); } -/// BS-arap-2 scenario 5 and item 7 in books an earlier version keeps: the +/// BS-arap-2 scenario 5 and WB-arap-4 in books an earlier version keeps: the /// right payment after the wrong one was reversed waits for the journal /// feature document_standing (an older version would count both), /// refused and journaling nothing until the owner's upgrade; a payment @@ -831,7 +831,7 @@ fn no_new_fields_journals_byte_for_byte() { } /// The issued copy is filed with the invoice or nothing is (plan P4b S4.3 -/// item 11, A-7; BS-arap-4 item 3): a refusal leaves the journal, the +/// item 11, A-7; BS-arap-4 invariant 3 and WB-arap-8): a refusal leaves the journal, the /// ledger and the allocators exactly as they were; an issue journals the /// entry, `invoice.created`, `receipt.attached` on that entry /// (`INV-0007.pdf`, `application/pdf`, "Issued invoice") and @@ -1247,8 +1247,7 @@ fn mark_sent_on_void_refused() { /// A settlement of two invoices, a discount and a processor's fee: one /// entry whose events name the lines they tag, every figure derived, and -/// the books replaying to the same lines (plan P4b S6; BS-arap-6 -/// INVARIANTS 1 and 3). +/// the books replaying to the same lines (plan P4b S6; BS-arap-6 invariant 3 and WB-arap-15). #[test] fn a_settlement_names_its_lines_and_replays() { use ledger_core::{Application, DocRef, Fee, SettleParams}; @@ -1422,7 +1421,7 @@ fn settlement_waits_for_documents_v2() { /// Legacy payment events carry no `line`, so replay keeps the positional /// rule: the first untagged control line for the payment's amount, in the -/// order the events come (plan P4b S6; BS-arap-6 INVARIANT 3). +/// order the events come (plan P4b S6; WB-arap-15). #[test] fn legacy_payment_events_keep_the_positional_rule() { use ledger_core::{DocRef, Movement}; @@ -1582,7 +1581,7 @@ fn write_off_waits_for_documents_v2() { /// A write-off is journaled as its entry and one `invoice.written_off`, /// and replay derives the same figures and the projection agrees: the /// invoice reads Written off, the bad-debt expense is on 6990, and the -/// control account still equals its documents (BS-arap-5, BS-arap-2 INVARIANT 1). +/// control account still equals its documents (BS-arap-5, BS-arap-2 invariant 1). #[test] fn write_off_replays_and_projects() { let dir = test_dir("write-off-replay"); @@ -1600,7 +1599,7 @@ fn write_off_replays_and_projects() { ) .unwrap(); // Half paid, the rest written off: the invoice reads Written off with - // 50 paid and 50 written off (BS-arap-2 SCENARIO 7). + // 50 paid and 50 written off (BS-arap-2 scenario 7). s.receive_payment(inv, d(2026, 4, 20), cents(5_000), bank) .unwrap(); let from = journal_len(&dir.0); @@ -1683,7 +1682,7 @@ fn write_off_replays_and_projects() { s.verify().unwrap(); } -/// No evidence, no write-off (BS-arap-5 INVARIANT 1; Treas. Reg. +/// No evidence, no write-off (BS-arap-5 statement 10; Treas. Reg. /// §1.166-2(a)): refused, journaling nothing; an attachment already filed /// is linked instead, to the entry and the invoice. #[test] diff --git a/crates/ledger-store/tests/asset_tags.rs b/crates/ledger-store/tests/asset_tags.rs index 2473719a..dfd14ed1 100644 --- a/crates/ledger-store/tests/asset_tags.rs +++ b/crates/ledger-store/tests/asset_tags.rs @@ -1175,7 +1175,7 @@ fn reversing_a_linked_acquisition_still_opens_and_verifies() { Store::open(&dir).unwrap().verify().unwrap(); } -// ------------------------------------------------- depreciation runs (BS-asset-1 rules 6 and 8) +// ------------------------------------------------- depreciation runs (BS-asset-1 statements 14 and 28) /// A run is the books' record of what they carry for an asset /// (Ledger::accumulated_posted): recorded live, replayed from the journal, diff --git a/crates/ledger-store/tests/document_projects.rs b/crates/ledger-store/tests/document_projects.rs index d0e43f7e..eef6fa81 100644 --- a/crates/ledger-store/tests/document_projects.rs +++ b/crates/ledger-store/tests/document_projects.rs @@ -1,4 +1,4 @@ -//! An invoice's or bill's lines in the journal (BS-statement-5 item 8, +//! An invoice's or bill's lines in the journal (BS-statement-5 statement 6, //! BS-format-1): a line naming its project carries `class_id` (journal feature //! `document_line_projects`), and the entry's revenue or expense line for //! that project is tagged by `entry.line_class_set` right after its @@ -9,7 +9,7 @@ //! ```text //! GOAL: a document's projects are journaled once, replay exactly, and //! never reach books whose owner hasn't consented to the format. -//! SOURCE: BS-statement-5 item 8, BS-format-1, BS-entry-4; plan/served.md +//! SOURCE: BS-statement-5 statement 6, BS-format-1, BS-entry-4; plan/served.md //! D-39 (the owner's upgrade). //! ``` diff --git a/crates/ledger-store/tests/store.rs b/crates/ledger-store/tests/store.rs index ed3156c9..c6e54f20 100644 --- a/crates/ledger-store/tests/store.rs +++ b/crates/ledger-store/tests/store.rs @@ -2636,7 +2636,7 @@ fn every_figure_of(l: &ledger_core::Ledger) -> (usize, usize) { tally(reports::general_ledger(l, start, end).map(|_| ())); tally(reports::members_equity(l, start, end, &members).map(|_| ())); // The statement of cash flows foots on every book, or is refused - // for a reason: never an engine error (BS-statement-3 rule 9). + // for a reason: never an engine error (BS-statement-3 statement 14). let cf = reports::cash_flow( l, &reports::CashFlowParams { diff --git a/docs/mcp-interface.md b/docs/mcp-interface.md index 121e36b4..c8e8a0f7 100644 --- a/docs/mcp-interface.md +++ b/docs/mcp-interface.md @@ -636,14 +636,14 @@ every tool over every book in ledger-store's `tests/fixtures/old-books`. kind. An entry's interest is its own operating class, (b) or (e), apart from the rest of its operating cash. A payment to a party with the `government_agency` or `tax_agency` role is `other_payments`, (g), - on any account (BS-statement-3 rule 5; payroll remittances excepted); + on any account (BS-statement-3 statements 8 and 9; payroll remittances excepted); one shared between such a party and a supplier gives two operating lines for the one entry, `other_payments` and `to_suppliers_and_employees`, split by the parties' shares and summing to the payment. What a member or a lender paid or received for the company with no cash account moving is cash borrowed (or contributed) and spent, on the entry's date (D-42, BS-statement-3 - rule 11): an expense a member paid personally through Due to Members + statement 16): an expense a member paid personally through Due to Members is a "Proceeds from borrowing — " line and an operating line, each with `on_behalf`, the part of its amount so handled (absent when none; an entry's `on_behalf` parts net to zero). @@ -1295,7 +1295,7 @@ Vendor and customer follow the records and are never set by hand. A `tax_agency` or `government_agency` payee also classes the company's payments to it on the cash flow statement: other operating cash payments, never cash paid to suppliers (`books.cash_flow`, BS-statement-3 -rule 5). +statement 8). **Rules the engine enforces** (each refusal changes nothing, the journal byte for byte): no party field holds a full TIN (a run of nine digits, @@ -1443,7 +1443,7 @@ BS-partner-3): Both `"0.00"` for `neither`; `resolved − cash − in_kind` is a promise, counted on neither basis. All four are null exactly when the shares don't resolve (`parties_error` says why). -- What the shares split (BS-partner-3 item 3): a close, its parties' own-account +- What the shares split (BS-partner-3 statement 3): a close, its parties' own-account movement, neither; a reversal, its original's negated; an entry naming only members that moves equity, what moved their capital (a contribution received: the property in it, asset accounts that are @@ -1462,7 +1462,7 @@ BS-partner-3): record (bills and their payments); its customer record's invoices and the payments received on them; and reversals of any of these. Only posted entries dated in the year count. -- *Money accounts* (BS-partner-3 item 5, P3 defect 24): the `[books] +- *Money accounts* (BS-partner-3 statement 7, P3 defect 24): the `[books] cash_accounts` (every asset account but receivables when none are set), the cards (the business-card payment methods' liability accounts, `books.instruments`; while the books record none, the liability @@ -1490,7 +1490,7 @@ BS-partner-3): (and the payments of distributions declared to them) is the statement of members' equity's contributions and distributions, and basis `cash` their contributions is the K-1 worksheet's cash contributions (BS-partner-3 - item 4 gives the conditions: a distribution declared and not yet paid + statement 6 gives the conditions: a distribution declared and not yet paid is in the statement only). The year is the whole calendar year; the viewer's party page and directory show these same numbers, labelled "cash basis", with the in-kind figures beside them. @@ -1914,7 +1914,7 @@ posting. get " (id)", a name already written differently from the books (made safe or tagged) yielding first, so a class's own name stands wherever it can: "Café" beside "Cafe" is written "Cafe (1)" and "Cafe" is - kept, BS-format-2 rule 8). No line names a customer or vendor (no + kept, BS-format-2 statement 30). No line names a customer or vendor (no NAME column; see the package's README). `warnings` (absent when there are none) says what the file writes differently from the books, for the human: each account's name, number and place and each @@ -2403,7 +2403,7 @@ snapshots; see plan 8.2 S4. code, name, balance, documents_total, unattached: [{ entry_id, line, date, amount }], difference, attention: [{ kind, id, status, total, outstanding }] }] }`. Receivables and payables tied to their documents - (BS-ledger-8, BS-arap-2 INVARIANT 1): `difference` is always `0.00`; `agrees` when + (BS-ledger-8, BS-arap-2 invariant 1): `difference` is always `0.00`; `agrees` when there is no unattached line and nothing needing attention. `books.verify` checks the same identity and `books.digest` lists its problems (`control_problems`). @@ -2413,7 +2413,7 @@ snapshots; see plan 8.2 S4. discounted, outstanding, bucket, days_overdue }], control: { account, balance, documents_total, unattached, difference } }` (`as_of` omitted: today). `detail: true` adds one row per open invoice; `control` is the - receivables account's tie-out (BS-ledger-8, BS-arap-2 INVARIANT 1), `difference` + receivables account's tie-out (BS-ledger-8, BS-arap-2 invariant 1), `difference` always `0.00`. - `books.ap_aging { as_of?, detail? }` → same, per vendor and bill. - `books.bills_due { through?, as_of? }` → `{ as_of, through, bills: @@ -2507,7 +2507,7 @@ until the owner upgrades them. project (every class), by name ignoring capitals; `to_date` counts every posted revenue and expense line tagged to it through today in the company's time zone, closing entries left out; `net` is its - contribution before overhead (BS-statement-5 item 7: revenue less every cost + contribution before overhead (WB-statement-7: revenue less every cost tagged to it, fixed and variable alike, no company overhead allocated: a segment margin in Garrison's sense, not a variable-cost contribution margin); `margin_pct` is net as a percent of revenue to one place, half @@ -2549,7 +2549,7 @@ until the owner upgrades them. project); its result gains `notes`, one per finished or abandoned project tagged, as `books.add_line`'s `note`. - An invoice's or bill's lines take a project too (`books.create_invoice` - and `books.create_bill`, `class` on a line, BS-statement-5 item 8), in + and `books.create_bill`, `class` on a line, BS-statement-5 statement 6), in books that declared the journal feature `document_line_projects`; the handbook's projects section says which these books are. Their payments take none. diff --git a/docs/parity.md b/docs/parity.md index 5c6ef791..93440f2e 100644 --- a/docs/parity.md +++ b/docs/parity.md @@ -39,7 +39,7 @@ in CI that the floor never falls between commits. | A/R invoices + payments + aging | Business → Invoices | done | R-FUTURE-5; since P4b S1 (D-45) a document's paid, outstanding and status are read from its tagged ledger lines, hand lines on the receivables account are refused, `books.void_document` and `books.control_check` tie the subledger to the control account (BS-arap-2); S2 `books.documents`/`books.document` and the viewer pages; S3 the invoice PDF; S4.1-S4.3 terms, numbers, line accounts, the issued PDF filed at issue (behind `documents_v2`, the owner's next upgrade); numbers, terms, line accounts, the party snapshots and the issued PDF filed with the invoice, through `books.create_invoice`'s preview and confirm (P4b S4.4); S4.5 the issued PDF carries the number, terms, PO, quantity and price, the bill-to's contact block and ship-to, the ways to pay with QR codes, the memo and the footer, and the viewer shows the number, terms, bill-to and PO and saves the issued copy | | A/P bills + payments + aging | Business → Bills | done | R-FUTURE-5; the same S1 derivation and control guard on the payables account; S4.1-S4.3 the vendor's invoice number, terms, every line on its own account (behind `documents_v2`); the vendor's own invoice number (a duplicate refused), terms, line accounts and the vendor's invoice filed as the bill's evidence, through `books.create_bill`'s preview and confirm (P4b S4.4); S4.5 the viewer shows the vendor's number, the day received, terms and memo, and the handbook's procedure (numbers, terms, line accounts) | | Payroll runs (accounting only, no tax tables) + tax remittance | Payroll | done | — | -| Tracking classes (divisional P&L) | Class tracking | done | invoice and bill lines take a class too (projects, BS-statement-5 item 8; QBO/Xero class or tracking per line) | +| Tracking classes (divisional P&L) | Class tracking | done | invoice and bill lines take a class too (projects, BS-statement-5 statement 6; QBO/Xero class or tracking per line) | | CPA handoff package (TB + GL xlsx, P&L + BS pdf, zip) | Reports → export | done | — | | Budgets | Budgets | todo | R-FUTURE-6 (declined as bloat) | | Scheduled transactions (recurring entries → drafts) | Scheduled txns / Recurring transactions | partial | hand-verified fixture incl. month-end dates; drafts only, by design | diff --git a/docs/parties-and-attachments.md b/docs/parties-and-attachments.md index c985b33f..d491d987 100644 --- a/docs/parties-and-attachments.md +++ b/docs/parties-and-attachments.md @@ -154,7 +154,7 @@ derived. Spec: `ledger_core::shares`. entry has balanced lines, and `post_entry` refuses (`party_shares`) until they do. Replay never consults settings. - **Money:** `parties::activity_with` counts each party's part on two - bases (BS-partner-3 item 4): cash (its money: cash, a card, the members' + bases (BS-partner-3 statement 5): cash (its money: cash, a card, the members' financing, a loan) and all (adding property contributed or distributed in kind), the viewer labelling the first "cash basis". Money accounts are the cash accounts, the cards and `[books] financing_accounts`; any diff --git a/docs/spec/README.md b/docs/spec/README.md index 4a4269df..914db727 100644 --- a/docs/spec/README.md +++ b/docs/spec/README.md @@ -75,9 +75,9 @@ each checked again against the same sources in the P3 review (numbers, pages and wording hold). Open: 105-10-05-1 to 05-3, read only in their 2009 text (ASU 2009-01, and as Wiley GAAP 2020 quotes them); their current wording is unconfirmed. Also open (P3 surface review, 2026-10-21): ASC 230-10-45-15(f) (debt -issue costs, cited by BS-statement-3 rule 11) is in neither list above; ASC +issue costs, cited by BS-statement-3 statement 16) is in neither list above; ASC 606-10-25-31, 25-32 and 55-20 (BS-prepaid-1's over-time method) are not yet read; -BS-asset-1 rule 6 cites ASC 250 with no paragraph; BS-revenue-1's 606-10-55-39 is in +BS-asset-1 statement 16 cites ASC 250 with no paragraph; BS-revenue-1's 606-10-55-39 is in neither list. Each is to be read in the ASC basic view and listed in `sources/fasb-asc.md` before it is relied on further. Also open (plan P4b, 2026-10-23): BS-arap-2 cites ASC 310-10, 405-20-40-1 and 606-10-45-4, diff --git a/docs/spec/claims/partner.md b/docs/spec/claims/partner.md index 66fc3d27..55313a03 100644 --- a/docs/spec/claims/partner.md +++ b/docs/spec/claims/partner.md @@ -374,7 +374,7 @@ the 1099 worksheet together, labelled, and neither is read for the other: `books.get_entry` gives each part's `resolved`, `direction`, `cash` and `in_kind`; `books.party` gives both a party's totals (`basis` cash or all) and its worksheet figures, labelled; the known -limits of BS-partner-3 rule 7 are stated in the tools' text; the +limits of BS-partner-3 statement 9 are stated in the tools' text; the viewer's party pages and entry page show the same parts. **Enforced:** `ledger-mcp` `books.get_entry`, `books.party`, diff --git a/docs/spec/claims/statement.md b/docs/spec/claims/statement.md index ba360b74..9c567d29 100644 --- a/docs/spec/claims/statement.md +++ b/docs/spec/claims/statement.md @@ -327,7 +327,7 @@ contribution_margin_pct}`, `ProjectToDate::margin_pct`. **Checked:** **WB-statement-8** The statement's words and groupings are wanderbooks' product strings, not accounting (the accounting is -BS-statement-3's rules 4, 6 and 8): a reversal shown alone reads +BS-statement-3's statements 5, 11 and 13): a reversal shown alone reads "Reversal of #N — " and a reinstatement "Reinstatement of #A (reverses #B)", both listed under the original's kind; a financing inflow under a borrowing reads "Proceeds from borrowing — diff --git a/docs/spec/sources/fasb-asc.md b/docs/spec/sources/fasb-asc.md index 14911fd0..928236b3 100644 --- a/docs/spec/sources/fasb-asc.md +++ b/docs/spec/sources/fasb-asc.md @@ -69,7 +69,7 @@ Quotes are short; the rest is paraphrase. - **230-10-10-1** (EY p. 1): the statement's primary objective is "to provide relevant information about the cash receipts and cash payments - of an entity during a period." → BS-statement-3 rule 1. + of an entity during a period." → BS-statement-3 statement 2. - **230-10-45-1** (EY p. 1): the statement "shall report the cash effects during a period of an entity's operations, its investing transactions, and its financing transactions." (It says nothing of reconciling @@ -275,7 +275,7 @@ basic view: check it there at the next reading. A contingency that might result in a gain "usually should not be reflected in the financial statements because to do so might be to recognize revenue before its realization." -→ BS-statement-5 item 4: a payment hoped for from work done on spec is recorded +→ BS-statement-5 statement 5: a payment hoped for from work done on spec is recorded neither as a receivable nor as income until it is received; the unrecovered cost is a figure, never an asset. @@ -289,12 +289,12 @@ contract or an anticipated contract the entity can specifically identify; they generate or enhance resources used in satisfying performance obligations in the future; and they "are expected to be recovered." -→ BS-statement-5 item 4 (with BS-asset-2): on-spec work has no contract it is expected +→ BS-statement-5 statement 5 (with BS-asset-2): on-spec work has no contract it is expected to recover its costs from, so its costs are expensed as incurred. ## 340-40-25-7 (Costs that relate directly to a contract) -Added 2026-10-22 for BS-statement-5 item 8 as the DART revenue roadmap sets it +Added 2026-10-22 for BS-statement-5 statement 6 as the DART revenue roadmap sets it out; not re-read in the ASC basic view: check it there at the next reading. The costs that "relate directly to a contract" (25-5(a)) are (a) direct labor, (b) direct materials, (c) allocations of costs that @@ -314,7 +314,7 @@ the contract), costs of wasted materials, labor or other resources not reflected in the contract's price, costs that relate to satisfied (or partly satisfied) performance obligations, and costs the entity cannot tell apart between satisfied and unsatisfied obligations. -→ BS-statement-5 item 8 (with 25-7): a cost traceable to one job (25-7(a), (b), +→ BS-statement-5 statement 6 (with 25-7): a cost traceable to one job (25-7(a), (b), (d), (e)) is that job's, whole, on the document's line; a cost that relates to several jobs reaches them only by an allocation on a stated basis (25-7(c)), which the books record as the allocation convention's diff --git a/docs/spec/sources/intuit-iif.md b/docs/spec/sources/intuit-iif.md index ac41461a..62ee382d 100644 --- a/docs/spec/sources/intuit-iif.md +++ b/docs/spec/sources/intuit-iif.md @@ -89,7 +89,7 @@ Cited (not quoted, but for the lines below): the Class list's keyword is CLASS; > If the class is a subclass of another class, the name includes the name of the parent classes, beginning with the highest level class. If you are creating an import file, use a colon (:) to separate subclass names. -So a class's NAME, like an account's, is one level per colon: the books, whose classes have no parents, write a colon in a class's name as '-', as in an account's (BS-format-2 rule 8). The page states no length limit and nothing about case. +So a class's NAME, like an account's, is one level per colon: the books, whose classes have no parents, write a colon in a class's name as '-', as in an account's (BS-format-2 statement 29). The page states no length limit and nothing about case. ### IIF Example Files: list declarations SHA-256 of `IIF Import Kit/IIF Example Files/QB 2007 & Enterprise 7.0 and later/Import First - List Declarations (Not Version Specific).iif` (the same bytes in each version's folder): `13c730b23bcb8c142621b04206e3628241d83051442c9b14ea2416d21163439c` @@ -180,7 +180,7 @@ Searched 2026-10-20. What Intuit says: Not Intuit, for the record: a third-party IIF vendor answering on Intuit's community (BigRedConsulting, 14 April 2020, ) wrote that "a NAME is required for any AR row", about a bill, not a journal; QuickBooks Desktop sync tools quote the refusal "Transaction split lines to accounts receivable must include a customer on that split line" (Acctivate, ). -No Intuit source says what an IIF journal import does with an A/R or A/P line that has no NAME (refuses it, imports it, or asks). So the books write no NAME (writing names would need the customer and vendor lists declared too, with a name unique across them) and the package README names the entries with an A/R or A/P line, so the CPA can add the name in QuickBooks if it asks (BS-format-2 rule 7). +No Intuit source says what an IIF journal import does with an A/R or A/P line that has no NAME (refuses it, imports it, or asks). So the books write no NAME (writing names would need the customer and vendor lists declared too, with a name unique across them) and the package README names the entries with an A/R or A/P line, so the CPA can add the name in QuickBooks if it asks (BS-format-2 statement 26). ## How long a class's name may be @@ -203,7 +203,7 @@ Not Intuit, for the record: Conductor's QuickBooks Desktop API reference (a serv > Maximum length: 31 characters. -So the books hold a class's NAME to 31 characters, as an account's own level (Intuit's own limit for a class, above), and keep no two alike ignoring case (Conductor: case-insensitive; BS-format-2 rule 8). +So the books hold a class's NAME to 31 characters, as an account's own level (Intuit's own limit for a class, above), and keep no two alike ignoring case (Conductor: case-insensitive; BS-format-2 statements 29 and 30). ## What QuickBooks does with an over-long name (not Intuit) Source: Thomson Reuters, Accounting CS help, "Export payroll journal entries", diff --git a/docs/testing.md b/docs/testing.md index 4915a52c..974039d6 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -1288,9 +1288,9 @@ no mutation run here; what P12 must cover is at the end. | The audit's table (F36, F37), row by row: resolved, direction, cash, in kind; reversals the exact opposite; bills and invoices signed; totals on both bases | `ledger-core/tests/spec_party_totals.rs` `defect14_shares_take_the_partys_side_and_reversals_flip` | BS-partner-3, by hand | | Basis all is the members' equity statement, cash the K-1's cash contributions | `basis_all_is_the_members_equity_statement_and_cash_the_k1s`; property `member_totals_are_the_members_equity_statement` (members contributing and taking out money and property, alone and jointly, subject to a loan, through 2100 then converted, through their distributions accounts, depreciated property with money, declared to distributions payable and paid later, reversed later in the year; checked over every span from the year's start and, received less paid, over every span) | `reports::members_equity`, `k1::k1_detail` | | A reversed member card payment nets to zero (brief §1.4) | `defect14_a_reversed_member_card_payment_nets_to_zero` | BS-ledger-5 | -| Accruals through another liability count once (defect 24) | `defect24_an_accrual_through_another_liability_counts_once` | BS-partner-3 item 5 | -| A credit to a party's own liability never pays it: a card fee, a distribution owed, a seller's note, property subject to a loan | `defect24_a_credit_to_a_partys_own_liability_never_pays_it`; the documented limit, pinned: `a_distribution_owed_counts_twice_until_the_members_are_named_its_creditors` | BS-partner-3 item 6; Treas. Reg. §1.704-1(b)(2)(iv)(b)(2); Helvering v. Price | -| Review, 2026-10-21: a distribution declared to distributions payable counts once, when paid (it counted twice); a distribution of money and depreciated property splits by what moved (the money read as property); a gift card sold is received once (it was a "card": twice); a refund is received; tin_last4 never shows more than four digits | `defect24_a_distribution_declared_to_a_payable_counts_once_when_paid`, `a_distribution_of_money_and_depreciated_property_splits_by_what_moved`, `defect24_a_gift_card_sold_is_received_once`, `a_refund_is_received_from_the_vendor`, `defect11_a_partys_tin_last4_is_its_tin_facts_else_its_w9s` (SCENARIO 6) | BS-partner-3 items 3, 5; BS-partner-2 | +| Accruals through another liability count once (defect 24) | `defect24_an_accrual_through_another_liability_counts_once` | BS-partner-3 statement 7 | +| A credit to a party's own liability never pays it: a card fee, a distribution owed, a seller's note, property subject to a loan | `defect24_a_credit_to_a_partys_own_liability_never_pays_it`; the documented limit, pinned: `a_distribution_owed_counts_twice_until_the_members_are_named_its_creditors` | BS-partner-3 statement 8; Treas. Reg. §1.704-1(b)(2)(iv)(b)(2); Helvering v. Price | +| Review, 2026-10-21: a distribution declared to distributions payable counts once, when paid (it counted twice); a distribution of money and depreciated property splits by what moved (the money read as property); a gift card sold is received once (it was a "card": twice); a refund is received; tin_last4 never shows more than four digits | `defect24_a_distribution_declared_to_a_payable_counts_once_when_paid`, `a_distribution_of_money_and_depreciated_property_splits_by_what_moved`, `defect24_a_gift_card_sold_is_received_once`, `a_refund_is_received_from_the_vendor`, `defect11_a_partys_tin_last4_is_its_tin_facts_else_its_w9s` (SCENARIO 6) | BS-partner-3 statements 3 and 7; BS-partner-2 | | A mixed contribution splits as the K-1 does, ties to the first member | `a_members_mixed_entry_splits_as_the_k1_does` | k1 INVARIANTS 3, 4 | | Read from journaled facts: an archived member, a one-member company | `a_members_entry_keeps_its_reading_after_they_leave` | review R2 | | A close is neither; a basis is cash or all; creditor_of's checks; tin_last4's five scenarios; the kernel's cases | `a_close_tagged_with_its_members_is_neither`, `a_basis_is_cash_or_all`, `a_creditor_is_named_only_on_a_liability_with_one_owner`, `defect11_a_partys_tin_last4_is_its_tin_facts_else_its_w9s`, `party_target_cases_by_hand` | specs | @@ -1392,9 +1392,9 @@ must cover is at the end. | What | Where | Oracle | |---|---|---| -| One rule for what a card is: the recorded business cards' liabilities, else (none recorded) liabilities named "card", not "gift"; never a member's card, a member's check or a platform; a debit card on the bank is none; money follows it | `ledger-core` `tests/spec_party_totals.rs` `a_card_is_a_recorded_business_card_else_a_liability_named_card` | BS-partner-3 item 5, `parties::card_accounts` INVARIANTS 1-4 | -| Party totals and the 1099 worksheet never contradict: paid less received is the worksheet's paid + excluded_card + undetermined + not_reportable plus its other receipts, for a vendor named alone, whatever the methods, refunds and reversals | property `party_totals_are_the_1099s_buckets` (`ledger-core` `tests/form1099.rs`; `PROPTEST_CASES`, default 256; 2,000 run clean; dropping a bucket from the sum fails at once) | BS-partner-3 item 9, by hand | -| The same, one year by hand: a member's check, a member's card, a member's payment of unknown method, a company card charge and a company check to one contractor, then the member reimbursed | `bookspec/examples/1099-and-party-totals-for-a-members-payment.toml` | BS-partner-3 item 9; Treas. Reg. §1.6041-1(e)(1), (a)(1)(iv) | +| One rule for what a card is: the recorded business cards' liabilities, else (none recorded) liabilities named "card", not "gift"; never a member's card, a member's check or a platform; a debit card on the bank is none; money follows it | `ledger-core` `tests/spec_party_totals.rs` `a_card_is_a_recorded_business_card_else_a_liability_named_card` | BS-partner-3 statement 7, `parties::card_accounts` INVARIANTS 1-4 | +| Party totals and the 1099 worksheet never contradict: paid less received is the worksheet's paid + excluded_card + undetermined + not_reportable plus its other receipts, for a vendor named alone, whatever the methods, refunds and reversals | property `party_totals_are_the_1099s_buckets` (`ledger-core` `tests/form1099.rs`; `PROPTEST_CASES`, default 256; 2,000 run clean; dropping a bucket from the sum fails at once) | BS-partner-3 statement 11, by hand | +| The same, one year by hand: a member's check, a member's card, a member's payment of unknown method, a company card charge and a company check to one contractor, then the member reimbursed | `bookspec/examples/1099-and-party-totals-for-a-members-payment.toml` | BS-partner-3 statement 11; Treas. Reg. §1.6041-1(e)(1), (a)(1)(iv) | | The CPA package's 1099 worksheet is `books.vendor_1099`'s CSV for the package's accounts (the request's, else the settings', R18) through its as_of, byte for byte; without `through` the files differ; a `through` outside the year and an unknown account are refused | `ledger-cli` `oracle_mcp.rs` `cpa_package_holds_the_year_and_its_evidence`; `ledger-package` `tests/package.rs` `payments_to_a_vendor_come_from_the_packages_accounts`, `one_list_of_cash_accounts_per_package`, `the_1099_worksheet_stops_at_as_of` | BS-statement-4; mcp-interface.md | | A feature is asked for before a command's first line: `books.update_party` with a field and the first creditor, in P2's books waiting for their format upgrade, is refused whole (nothing journaled, never the field without the creditor); once upgraded, as in books this version made, it journals the field, then the creditor, declaring nothing | `ledger-cli` `tests/spec_party_totals.rs` `update_party_asks_for_the_creditor_feature_before_its_first_line` | BS-format-1 | | One bookspec loader for every example, the parties' and the 1099s' with them: `setup.parties`, `setup.members` (`distributions_account`), `setup.payees` (a party's vendor record), `setup.status_changes`, `setup.instruments`, events' `parties` and `instrument`, and the queries `vendor_1099`, `k1`, `party_part`, `party_totals`, `party_tin_last4`; refused: a party or payment method not in the setup, a reversal naming parties, party totals without a basis, a 1099 line leaving a figure out, a wrong direction or status | `ledger-core` `tests/bookspec/` (`every_bookspec_example_holds`, `a_party_not_in_the_setup_is_refused`, `a_party_parts_direction_is_checked`, `a_reversal_naming_parties_is_refused`, `party_totals_without_a_basis_are_refused`, `a_vendor_1099_line_leaving_a_figure_out_is_refused`, `a_vendor_1099_status_is_checked`, `a_payment_method_not_in_the_setup_is_refused`) | bookspec/README.md | @@ -1743,9 +1743,9 @@ bookspec's rules / `docs/spec/claims/` say why not. Mutation runs wait for P12 ( - **Engine** (`ledger-package/tests/p3_seams.rs`): `the_members_figures_agree_on_every_date` (members' equity, the K-1 worksheet, party totals on both bases, the cash flow's contributions, - advances and distributions, BS-partner-3 items 4 and 8), + advances and distributions, BS-partner-3 statements 6 and 10), `a_distribution_declared_then_paid_is_financing_when_paid`, - `the_1099_worksheet_ties_to_party_totals_and_the_ledger` (BS-partner-3 item 9, + `the_1099_worksheet_ties_to_party_totals_and_the_ledger` (BS-partner-3 statement 11, BS-1099-1), `depreciation_is_one_figure_everywhere` (the P&L, the cash flow add-back, the tax-basis K-1's open item, the IIF, the register posted and scheduled, the balance sheet), `every_statement_foots_on_every_date`, @@ -1759,14 +1759,14 @@ bookspec's rules / `docs/spec/claims/` say why not. Mutation runs wait for P12 ( `books.vendor_1099` through each date, `books.party` on both bases. - **Found and fixed** (each test fails before its fix): a distribution declared to a payable and paid later read as cash paid to suppliers - (BS-statement-3 rule 2; `a_distribution_declared_then_paid_is_a_distribution_paid` + (BS-statement-3 statement 3; `a_distribution_declared_then_paid_is_a_distribution_paid` in `ledger-core/tests/spec_cash_flow.rs`, with the property `prop_cf_financing_is_equity_plus_designated_debt`'s model extended); a disposal's depreciation credit-back was in the cash flow's gain or - loss, not its depreciation (BS-statement-3 rule 8; + loss, not its depreciation (BS-statement-3 statement 13; `a_disposals_depreciation_credit_back_is_depreciation`), and the tax-basis K-1's book depreciation left it out (BS-partner-4); `books.list_assets` - as of a day said "disposed" for a later disposal (BS-asset-1 rule 8). + as of a day said "disposed" for a later disposal (BS-asset-1 statement 28). ## P3: the surface review (2026-10-21) @@ -1975,7 +1975,7 @@ feature check; the decision `projects` omit-when-empty; The owner's ask: a "mini financial snapshot" of one project on its page, overhead left out, so it shows at a glance whether the project is in the -black or the red, with charts (BS-statement-5 item 7: contribution before +black or the red, with charts (WB-statement-7: contribution before overhead, revenue less every traced cost, a segment margin in Garrison's sense; a presentation choice, not GAAP). Every figure is ledger-core's: `ProjectToDate::{net, margin_pct, any_tagged, revenue_by_account, @@ -2085,7 +2085,7 @@ rounding strategy; `project_figures`' opening net and running sum; ## Invoices and bills take a project (2026-10-22) -BS-statement-5 item 8: each invoice and bill line takes an optional project +BS-statement-5 statement 6: each invoice and bill line takes an optional project (`books.create_invoice` / `books.create_bill` `class`); the entry's revenue or expense side is one line per project (`arap::document_parts`), the receivable or payable and the payments untagged; journaled as the line's @@ -2201,7 +2201,7 @@ The P3 cutover review's open points 1 (the IIF left CLASS empty) and 2 the tax-basis member split) waits for the owner: nothing is posted before the year-end close. No mutation run (D-33). -**Point 1, the IIF's classes** (BS-format-2 rule 8): `ledger-import` +**Point 1, the IIF's classes** (BS-format-2 statements 27-33): `ledger-import` `tests/spec_import.rs` `iif_writes_each_lines_class_and_declares_the_classes_first` (the file exact: the `!CLASS` list after the accounts, before `!TRNS`, every class @@ -2234,7 +2234,7 @@ and the property. The property found (seed in name yield to a changed one ("Café" twice beside "Cafe (1)" and "Cafe (1) (1)"); the cap is gone, a tag that changes nothing is skipped instead. -**Point 2, payments to governments** (BS-statement-3 rule 5): `ledger-core` +**Point 2, payments to governments** (BS-statement-3 statement 8): `ledger-core` `tests/spec_cash_flow.rs` `a_payment_to_a_government_is_other_operating` (a filing fee on an organization-costs account paid to a government agency, and a penalty on supplies paid to a tax agency, are (g); the @@ -2528,7 +2528,7 @@ accounting question), CHANGE (a source says otherwise; work pending). | 6 | Reconciliation balances | CONFIRMED | Signed by the account's normal side (a card reads as owed), as statements show it; `reconciling_a_card_reads_its_normal_side_...` | | 7 | A member's ending on one equity statement may differ by a cent from the next statement's beginning | CHANGED 2026-10-13; CHANGED P3 | A capital account is one running balance (Treas. Reg. §1.704-1(b)(2)(iv)(b); the Item L quote this row once gave was misread, P3 review R-4). Undistributed earnings now split cumulatively as of each date, so each member's capital chains exactly (`each_members_capital_chains_across_statements`; it fails on the old code); since P3 the split is what the count's next close would give, so a date's capital never moves when its month is closed (D-38; `each_members_capital_chains_and_holds_through_closes`); BS-partner-1 | | 8 | Cash flow nets one line per account; investing comes only from registered assets | CHANGED 2026-10-13 | ASC 230-10-45-7: gross receipts and payments "more relevant" than net; 45-8 limits netting to quick-turnover items. Financing and investing are now gross; loans made and investments bought are investing (230-10-20, 45-13) via `[books] investing_accounts`. Owner-advanced expenses: PwC 6.9.3.1 constructive treatment via `[books] financing_accounts` (BS-statement-3) | -| 8a | Cash flow by the indirect method; member-paid expenses as constructive receipts | CHANGED 2026-10-20 | The direct method with the reconciliation as a separate schedule (ASC 230-10-45-25, 45-30); noncash investing and financing activities disclosed, only the cash portion reported (50-3, 50-5). Member-paid expenses stay constructive receipts and disbursements, now gross and on each payment's date, and the same for a lender's payments and an expense paid into capital: a choice (D-42, after a day as noncash under D-35), since ASC 230 doesn't address payments made on the entity's behalf and the firm guides present them so (PwC 6.9.3.1, DART 7.2, BDO 3.4, EY 4.6.2; KPMG Q8.3.10 also accepts noncash for property a lender pays for). BS-statement-3 rule 11, P3 defect 1 | +| 8a | Cash flow by the indirect method; member-paid expenses as constructive receipts | CHANGED 2026-10-20 | The direct method with the reconciliation as a separate schedule (ASC 230-10-45-25, 45-30); noncash investing and financing activities disclosed, only the cash portion reported (50-3, 50-5). Member-paid expenses stay constructive receipts and disbursements, now gross and on each payment's date, and the same for a lender's payments and an expense paid into capital: a choice (D-42, after a day as noncash under D-35), since ASC 230 doesn't address payments made on the entity's behalf and the firm guides present them so (PwC 6.9.3.1, DART 7.2, BDO 3.4, EY 4.6.2; KPMG Q8.3.10 also accepts noncash for property a lender pays for). BS-statement-3 statement 16, P3 defect 1 | | 9 | An asset's life ends at purchase + life months, that day not held; day-count proration | CONVENTION | Exactly N months of service; day proration and the mid-month convention are both accepted book policies (ASC 360-10-35-4, read 2026-10-14: any systematic and rational allocation) | | 10 | A payroll entry has one line per account total | CONFIRMED | The per-employee detail the IRS requires ("Amounts and dates of all wage ... payments", Employment Tax Recordkeeping) is kept in the run; a summary entry is standard | | 11 | A period with exactly the dates of an existing one is allowed | DESIGN | Nothing governs duplicate periods; harmless (the second close locks only). Refusing exact duplicates is an option | @@ -2624,7 +2624,7 @@ the wiring into verify, the digest and Needs attention) is part B. `a_payment_journals_its_method_and_reference` (a plain payment's payload field for field as before), `legacy_documents_replay_with_tags`); `tests/arap_props.rs` `status_is_a_function_of_journal_and_date` (BS-arap-2 - INVARIANT 4: random invoices, bills, payments with and without a + invariant 7: random invoices, bills, payments with and without a method and reference, voids, reversals of any entry, closed months and refused hand lines through `Store`; at half time and at the end the books are reopened and read by a `Snapshot`, and `differs_from`, every @@ -3356,10 +3356,10 @@ collected leaves the receivables as a deduction, with its evidence filed in the same call. - **ledger-core, `tests/spec_documents.rs`:** - `half_paid_rest_written_off_is_written_off` (BS-arap-2 SCENARIO 7: 50 paid, + `half_paid_rest_written_off_is_written_off` (BS-arap-2 scenario 7: 50 paid, 50 written off, one balanced entry Dr 6990 / Cr 1200, the receivable line tagged `WriteOff`, receivables down by exactly the write-off); - `write_off_refused_on_cash_basis` (BS-arap-5 INVARIANT 3: refused, the + `write_off_refused_on_cash_basis` (BS-arap-5 invariant 5: refused, the snapshot unchanged, no draft left); `write_off_above_outstanding_refused` (the bound at the day, a zero and a negative amount, then the exact amount owed taken); `write_off_then_recovery_same_year` (D-49: the diff --git a/docs/verification.md b/docs/verification.md index 715ff6b5..456848b3 100644 --- a/docs/verification.md +++ b/docs/verification.md @@ -485,7 +485,7 @@ one kernel function, `kernel::basis_figures`, for every rule: ### A project's unrecovered cost (P3, projects) -The "if repaid" figure of work done on spec (BS-statement-5 item 4) is +The "if repaid" figure of work done on spec (BS-statement-5 statement 5) is one kernel function, `kernel::unrecovered_cost`: 32. **Never below zero, the shortfall exactly, and no overflow**: the @@ -879,7 +879,7 @@ Be precise about the claims: entries out of the sections but not out of the cash accounts' balances; the two agree because a close moves only revenue, expense and equity (`Ledger::validate_close_to`) and cash accounts must be - assets (BS-statement-3 rule 2). The Lean model's close step lets a + assets (BS-statement-3 statement 3). The Lean model's close step lets a target be any balance-sheet account, so `Reachable.cashflow_foots` takes any selection of entries with the cash over the same selection, and `Reachable.cashflow_is_change_in_cash` counts every entry, closes