refactor: rule references cite bookspec ids

Every B-n citation in crates/, docs/, deploy/, scripts/ and .github/ now names its bookspec id BS-<area>-<n> (D-68), via scripts/rewrite-rule-refs.py: the map is parsed from docs/spec/rules.md's index, rules.md-prefixed and bare forms are rewritten, sub-references (rule 11, item 7, INVARIANT 2) survive, and plan/, docs/spec/rules.md and docs/spec/claims/ are untouched. Program-output string literals that cited a rule were reverted by hand so user-visible output and its goldens are unchanged; DatedRule.catalog, metadata no output prints, now holds BS-1099-1. One SOURCE line that cited only 'R-?' now also cites BS-statement-5.

Co-Authored-By: Muse Wonder 1.0
This commit is contained in:
swaitsandMuse Wonder 1.0 committed 2026-11-08 19:40:22 -07:00
1 parent 7a177a3cfc
commit 489360f598
221 files changed
+1706 -1580

No files matched your search

+5 -6
View File
@@ -59,7 +59,7 @@ closure. The reader now lives in the small library crate `ledger-reader`;
re-exports it as `extract`), the store no longer builds the typesetter,
and `ledger-import` still never depends on the store.
Audits (P8, rules.md B-45) are split by what each layer can see. The pure
Audits (P8, BS-ledger-13) are split by what each layer can see. The pure
checks over a ledger are `ledger_core::audit` (`statements`, with the facts
a ledger cannot know handed in by the caller: the receipts filed, the
statement of cash flows the role settings give, the settings problems, the
@@ -204,7 +204,7 @@ when there is no next line or no `prev` it can read. The writer
for the same journal (fuzzed by `fuzz_store_replay`). The writer checks
every complete line before it changes anything: a torn tail is set aside
only when the gate passes, so an older version never alters newer books.
Rule: `docs/spec/rules.md` B-27.
Rule: BS-format-1.
## How the books are kept, in the books (P1)
@@ -222,7 +222,7 @@ books adopt`) moves an older books dir's file in through it, once, and
are their settings' only source (D-44): the server (`settings::Live`)
takes them whenever their last `settings.set` changes (on every lock of
the store), the viewer reads them from the journal it shows, and neither
reads a file; "today" is the company's time zone's, set per request. Rule: `docs/spec/rules.md` B-29.
reads a file; "today" is the company's time zone's, set per request. Rule: BS-ledger-9.
## The MCP server's layout (`ledger-mcp`, P0; U0a)
@@ -252,8 +252,7 @@ groups are:
- `parties` — parties, vendors, customers, roles, W-9s, the TIN vault,
1099s, entry parties;
- `attachments` — receipts, filed documents, and their links;
- `write_offs` — `books.write_off_invoice`, the bad debt (P4b S7; rules.md
B-41), kept apart from `documents` so S4.4's document tools and this one
- `write_offs` — `books.write_off_invoice`, the bad debt (P4b S7; BS-arap-5), kept apart from `documents` so S4.4's document tools and this one
land in different files;
- `evidence` — finding a file by its hash, number or text, annotating it,
recording what a payment settles, and consolidating duplicates (P6);
@@ -328,7 +327,7 @@ to move to its own repository (P13 step 6, D-34, Z-17):
per rule: pass, fail or not claimed. It compares the engine's answers
with the examples' exact expected values; it never asks the engine
whether its own answer is right.
- `bookspec/spec/rules-index.md` maps B-1 to B-45 to the bookspec ids;
- `bookspec/spec/rules-index.md` maps BS-entry-1 to BS-ledger-13 to the bookspec ids;
`docs/spec/rules.md` carries each stated rule's id under its heading.
- `crates/ledger-core/tests/bookspec/` is the wanderbooks adapter: it
implements `Engine` over `Store` (a dev-dependency only, so no engine
+1 -1
View File
@@ -35,7 +35,7 @@ Statuses: `covered` (built and tested), `partial` (built, known gaps listed),
- Row 10 (`books.digest`) has no sheet equivalent — the sheet can't tell you
what changed. This is parity *plus*: the new system is more reviewable
than the old one, which is the point of the exercise.
- Projects (rules.md B-37) have no sheet equivalent either: a class with
- Projects (BS-statement-5) have no sheet equivalent either: a class with
its facts, created and changed by the agent (`books.add_project`,
`books.update_project`), read by the viewer's Projects pages and by
`books.projects` / `books.project` (D-28: the agent writes, the viewer
+1 -1
View File
@@ -62,7 +62,7 @@ definitions exactly.
reports it: cash plus the adjusted tax basis of property contributed,
plus their share of income as figured for tax, less cash and the adjusted
tax basis of property distributed (Form 1065 instructions, Item L).
- **Project** — A class with its facts (rules.md B-37): what it is, where it
- **Project** — A class with its facts (BS-statement-5): what it is, where it
stands (active, paused, finished, abandoned), what kind of work it is
(internal product, client work, on spec, other), who it is for, its
dates and links. Its figures are the revenue and expense lines tagged to
+67 -67
View File
@@ -34,7 +34,7 @@ layer.
The books keep their own settings (journal format 2, plan/served.md P1):
each change is a `settings.set` line with who decided it and when, replayed
into `ledger_core::settings::Settings` by the server and the viewer alike
(rules.md B-29). Every key is in `ledger_core::settings::KEYS`, with what it
(BS-ledger-9). Every key is in `ledger_core::settings::KEYS`, with what it
takes and means: the company's facts (`company.name`, `.entity_type`,
`.tax_classification`, `.tax_form`, `.fiscal_year_start` ("MM-01"; the
year's end is derived, never stored), `.timezone` (what "today" means for
@@ -92,7 +92,7 @@ in its folder).
changes the books' settings after that.
The accounts invoices, bills, payroll, and closes post to are not settings:
they are control roles in the journal (rules.md B-23).
they are control roles in the journal (BS-ledger-8).
- `books.roles {}` → `{ roles: [{ role, purpose, account_type,
default_code, assigned, account_code?, account_name? }] }`: every control
@@ -106,7 +106,7 @@ they are control roles in the journal (rules.md B-23).
## Tools — how the books are kept
Conventions, decisions, open items and approvals live in the books too
(`ledger_core::conventions`, rules.md B-29), each with who decided it and
(`ledger_core::conventions`, BS-ledger-9), each with who decided it and
when; `books.start` lists them, and the handbook's
settings-and-conventions section says how to use them.
@@ -177,7 +177,7 @@ settings-and-conventions section says how to use them.
item is a problem.
`focus` is `daily` (the default), `onboarding`, `close` or `audit`;
anything else is refused. Also `books://start`.
**The format upgrade** (plan 3.9, D-39, rules.md B-27). Books an older
**The format upgrade** (plan 3.9, D-39, BS-format-1). Books an older
wanderbooks wrote are in an older journal format: they are served on it,
and every tool that needs nothing new works as before. A tool whose
change needs the newer format (on main: settings, conventions, decisions,
@@ -230,7 +230,7 @@ as it is made.
`{ id }`; `books.decisions { include_superseded?, project? }`. A decision
supersedes at most one live decision; its evidence is a document still
in the books. `projects` (ids or names, each once, resolved before
anything is written) names the projects it is about (rules.md B-37); a
anything is written) names the projects it is about (BS-statement-5); a
decision without them journals the bytes it always did, and one with
them needs the journal feature `projects`. `books.decisions` gives each
decision's `projects: [{ id, name }]` (left out when none); `project`
@@ -459,7 +459,7 @@ those bounds still open (replay accepts what that version accepted), so
every figure the server derives from them (a draft's total, a schedule's
plan, aging, a party's totals, the asset register) is computed or
refused ("too large to compute exactly", or a date outside the calendar
the books keep), never a panic (rules.md B-28). `tests/hostile_args.rs`
the books keep), never a panic (BS-entry-4). `tests/hostile_args.rs`
drives every tool with generated hostile arguments and every resource
with generated URIs, checks after each call that the server still
serves, restarts it after them to check the books reopen, and drives
@@ -545,13 +545,13 @@ every tool over every book in ledger-store's `tests/fixtures/old-books`.
Codes are unique; a name another account under the same parent has
(top-level accounts are siblings too; ignoring capitals and surrounding
space), one holding a run of nine digits, or one that isn't one line of
at most 200 characters, is refused (rules.md B-31); the name is kept
at most 200 characters, is refused (BS-ledger-10); the name is kept
trimmed. A revenue or expense account (not a header) without `tax_category` is
created with a warning ("6150 Software has no tax category: the tax
summary will list it as uncategorized. Propose one from
books.tax_categories and set it with books.set_tax_category once the
human agrees."), or, under `policy.require_tax_category = refuse`,
refused (rules.md B-32). The category is checked against the account's
refused (BS-ledger-11). The category is checked against the account's
type and the return, as `books.set_tax_category` checks it; journaled as
`account.added` then `account.tax_set`.
- `books.draft_entry { date: "2026-10-10", description: "...", vendor?,
@@ -585,7 +585,7 @@ every tool over every book in ledger-store's `tests/fixtures/old-books`.
schedule month a second time (naming the entry that posts it now), or
re-instate a run a later run caught up (carrying the books past the
schedule); and a reversal of any entry dated before that entry's own
date (a correction comes after what it corrects, B-9, D-73; the preview
date (a correction comes after what it corrects, BS-ledger-5, D-73; the preview
refuses the same way, and books written before D-73 open as they were).
- `books.get_entry { entry_id }` → full entry with lines (each `{
account_id, code, name, side, amount, class_id?, project? }`: a tagged
@@ -602,7 +602,7 @@ every tool over every book in ledger-store's `tests/fixtures/old-books`.
reversal_of, receipt_count }] }`, posted entries, newest first (no
lines: `books.get_entry` has them). `limit` defaults to 50 and caps at
500.
- **Omitted dates (rules.md B-30).** One rule everywhere
- **Omitted dates (BS-period-3).** One rule everywhere
(`ledger_core::calendar::PeriodDefaults`), stated in every report
tool's description and date parameters in the same words: a period
report with no dates covers the fiscal year to date
@@ -623,7 +623,7 @@ every tool over every book in ledger-store's `tests/fixtures/old-books`.
the fiscal year to date). Closing entries are excluded, so a closed
period still shows what it earned.
- `books.cash_flow { start?, end?, cash_accounts?, financing_accounts?, investing_accounts? }` (each defaults to the books' settings, `books.cash_accounts` and so on; cash is required one way or the other)
→ the statement of cash flows, direct method (rules.md B-14, P3 defect
→ the statement of cash flows, direct method (BS-statement-3, P3 defect
1; omitted dates: the fiscal year to date): `{ method: "direct", start,
end, operating_by_class, operating, cash_from_operations,
investing_by_kind, investing, cash_from_investing,
@@ -636,13 +636,13 @@ 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 (rules.md B-14 rule 5; payroll remittances excepted);
on any account (BS-statement-3 rule 5; 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, rules.md B-14
(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
is a "Proceeds from borrowing — <account>" line and an operating
line, each with `on_behalf`, the part of its amount so handled (absent
@@ -716,12 +716,12 @@ every tool over every book in ledger-store's `tests/fixtures/old-books`.
Needs attention uses the same rule (`ledger_store::reconcilable`).
`uncategorized_accounts` lists every revenue and expense account (not a
header) with no tax category, active or not, `"CODE Name"`: the list
Needs attention shows (rules.md B-32).
Needs attention shows (BS-ledger-11).
## Tools — fixed assets
Straight-line **book** depreciation only; tax depreciation stays with the
CPA. Depreciation accrues by the day (rules.md B-15): a partial first
CPA. Depreciation accrues by the day (BS-asset-1): a partial first
month, the life's final month (which takes what the others leave, evenly
over its days), and any month a schedule stops in (through a date, or a
disposed asset's disposal day, held) are prorated by days, never plugged;
@@ -738,7 +738,7 @@ life's last day is 9999-12-31 at the latest.
next free `PREFIX-0001` (`[books] asset_tag_prefix`, else the company
name's initials without LLC/Inc; "FA" when none). `in_service_date` (the
day it is ready and available for its use) starts depreciation (P3,
defect 13; B-15); `purchase_date` is its alias for one release (both
defect 13; BS-asset-1); `purchase_date` is its alias for one release (both
given and meaning different days: refused; the alias noted in `notes`). The
`acquisition_entry` (posted, debiting the cost account, neither a
reversal nor reversed, dated on or before the in-service date) gives
@@ -891,7 +891,7 @@ life's last day is 9999-12-31 at the latest.
Amortization spreads a prepaid expense (asset → expense) or deferred
revenue (liability → revenue) over the time it covers, posting on each
month end, to the minor unit (rules.md B-16). A new schedule's convention
month end, to the minor unit (BS-prepaid-1). A new schedule's convention
is `books.schedule_convention` (unset: `daily`, D-11/D-37): `daily`
spreads by the day from `start`, the first day covered, as depreciation
does, so a mid-month start posts a small first and last month (a 12-month
@@ -969,7 +969,7 @@ through the policy.
`viewer_open` says whether one does. The note says "The viewer shows
…", or "No viewer has these books open: ask the human to open it
(opened within a couple of minutes, it shows …)".
- **Dates (rules.md B-30).** For an account or a report, the dates are
- **Dates (BS-period-3).** For an account or a report, the dates are
resolved by the one default (omitted: the fiscal year to date; only
`end`: its fiscal year to it) and sent to the viewer resolved, so
`shown` and the screen can't differ: "the register of 1000 Business
@@ -1115,7 +1115,7 @@ on from it.
What counts toward a vendor's 1099 is what left the books' cash accounts
(`books.cash_accounts`) and financing accounts (`books.financing_accounts`)
on entries tagged with the vendor, classified by how each payment was made
(rules.md B-19; plan P3, defects 12, 18 and 23; D-40):
(BS-1099-1; plan P3, defects 12, 18 and 23; D-40):
- out of a cash account with no payment method recorded: counts
(presumed check, ACH or transfer; tag a debit-card payment with the
@@ -1181,7 +1181,7 @@ first entry's).
year): tell the human, a filed 1099 may need correcting. Journaled as
`vendor.1099_set` (a W-9 flag alone as `vendor.w9_flag_set`), under the
journal feature `vendor_1099_decisions` (books an older version wrote
refuse it, `format_upgrade_pending`, until their format upgrade: B-27).
refuse it, `format_upgrade_pending`, until their format upgrade: BS-format-1).
- `books.add_instrument { kind, label, last4?, owner_party?, account }` →
`{ id, kind, card_or_network, label, last4?, owner_party?, account_id,
account, warnings }`. `kind`: `bank` (the company's checks, ACH, wires,
@@ -1243,9 +1243,9 @@ first entry's).
setting, the CPA package's rule: `ledger_package::Settings::with_accounts`;
a code the chart lacks is refused), from January 1 of `year` through
`through` when given (`YYYY-MM-DD`, a day of `year`: the worksheet as of
a day, rules.md B-33), else the whole year. On an entry naming several
a day, BS-statement-4), else the whole year. On an entry naming several
parties, the buckets count only the vendor's resolved share of the
payment, split across them to the cent (rules.md B-19); an entry whose
payment, split across them to the cent (BS-1099-1); an entry whose
shares don't resolve counts in full and `notes` names it. `tin_last4`
is the party's TIN facts' last four, else its W-9 facts'
(`Party::tin_last4`). With `include_tins: true` (default false) each
@@ -1294,7 +1294,7 @@ registries that don't tax: a division of corporations, a licensing board),
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`, rules.md B-14
payments, never cash paid to suppliers (`books.cash_flow`, BS-statement-3
rule 5).
**Rules the engine enforces** (each refusal changes nothing, the journal
@@ -1327,7 +1327,7 @@ texts are at most 500 characters, no control characters.
phone, contact, billing_address, shipping_address, billing_email,
archived, then one `party.creditor_set` per account added or dropped.
The email, terms and contact block need the journal feature
`documents_v2` (rules.md B-27): books that haven't declared it refuse
`documents_v2` (BS-format-1): books that haven't declared it refuse
them with `format_upgrade_pending`, journaling nothing. Un-archiving is
refused while another party has the name.
- `books.set_party_roles { party, add?, remove? }` → the party. Adds apply
@@ -1405,7 +1405,7 @@ texts are at most 500 characters, no control characters.
newest first); its invoices and bills (`{ id, date, due_date, total,
paid, balance, status, entry_id }`); and the payroll lines naming it
(`{ run_id, date, entry_id, gross_pay, net_pay }`); and the projects for
or with it, by name (`{ id, name }`, rules.md B-37).
or with it, by name (`{ id, name }`, BS-statement-5).
- `basis` (both): `"cash"` (the default) or `"all"`; any other word is
refused (`basis is "cash" or "all"`). Echoed in the output. Not the
books' accounting method (`books.accounting_basis`).
@@ -1423,14 +1423,14 @@ replaces the list (`[]` clears it), journaled as `party.creditor_set {id,
account_id, on}`, one line per account added or dropped, under the
journal feature `party_creditors` (books an older version wrote refuse
the whole change, `format_upgrade_pending`, until their format upgrade:
B-27); refused, journaling nothing, for an account that isn't a
BS-format-1); refused, journaling nothing, for an account that isn't a
liability, is a placeholder, or is payables or a payroll withholding
(owed to many).
**Each party's part of an entry** (`books.get_entry`, the
`books.post_entry` preview, `books.set_entry_party`: `parties: [{ party_id,
party, share, amount?, percent?, resolved, direction, cash, in_kind }]`,
rules.md B-35):
BS-partner-3):
- `resolved`: signed as a line on the party's own account would be
(debit-positive): positive, the company paid it or gave it value;
@@ -1443,7 +1443,7 @@ rules.md B-35):
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 (B-35 item 3): a close, its parties' own-account
- What the shares split (BS-partner-3 item 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 @@ rules.md B-35):
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* (B-35 item 5, P3 defect 24): the `[books]
- *Money accounts* (BS-partner-3 item 5, 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
@@ -1489,7 +1489,7 @@ rules.md B-35):
`all` over the entries that name only members and move their capital
(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 (B-35
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
is in the statement only). The year is the whole
calendar year; the viewer's party page and directory show these same
@@ -1509,7 +1509,7 @@ rules.md B-35):
Full TINs (SSN, EIN, ITIN) and signed W-9 forms, kept so what the CPA
gets is complete (every member's TIN for their K-1, every payee's for
their 1099), never in the books (`ledger-vault`; design in
`docs/parties-and-attachments.md` "The TIN vault"; B-26). DECISION
`docs/parties-and-attachments.md` "The TIN vault"; BS-partner-2). DECISION
(the owner, 2026-10-15): the vault holds everyone's TIN, members included,
and the CPA package carries them.
@@ -1590,11 +1590,11 @@ and the CPA package carries them.
test alone), or a stand-alone number printed as an SSN or EIN is
(123-45-6789, 12-3456789; no digit, and no hyphen or dot followed by a
digit, beside it). Bank exports pass: routing and account numbers, long
references and dates next to amounts are not TINs (rules.md B-26). No
references and dates next to amounts are not TINs (BS-partner-2). No
probing: a text with more than two TIN-shaped numbers ending in the last
four of a TIN the books know is refused before the vault is opened, in
the same words whether or not one is that TIN, so the vault is compared
against at most two candidates a filing (rules.md B-26). An altered copy
against at most two candidates a filing (BS-partner-2). An altered copy
of a binary file (a W-9 PDF re-saved or re-scanned), and a TIN the vault
doesn't hold written another way, are not detected: P7 takes full
TINs out of the agent's reach.
@@ -1867,7 +1867,7 @@ posting.
changes in members' equity; members from the settings (`company.members`); earnings
not yet closed are split the way the next members close will split
them, so a member's capital on a day never changes when its month is
closed: rules.md B-13, D-38),
closed: BS-partner-1, D-38),
`general_ledger` (by account: beginning balance, postings with running
balance and split, ending balance), `general_journal` (alias
`journal`: each entry posted in the period, line by line; `iif`:
@@ -1877,19 +1877,19 @@ posting.
(as of a day: columns `number,party,date,due_date,terms,total,paid,
discounted,outstanding,bucket,days_overdue`, one row per open
document, then a tie-out line `TOTAL,,,,,,,,<Σ outstanding>,GL
<account> <balance>,difference 0.00`; B-23, 8.3.10).
<account> <balance>,difference 0.00`; BS-ledger-8, 8.3.10).
- Formats: `pdf` and `xlsx` for `profit_and_loss`,
`balance_sheet`, `cash_flow`, `trial_balance`, `members_equity`,
`tax_summary` and `fixed_asset_register`; `xlsx`, `csv`, `json` for
every report (`general_ledger` and `general_journal` have no pdf);
`iif` for `general_journal` (alias `journal`), for QuickBooks Desktop.
- Dates (rules.md B-30): the period reports (`profit_and_loss`,
- Dates (BS-period-3): the period reports (`profit_and_loss`,
`cash_flow`, `members_equity`, `tax_summary`, `general_ledger`, and
`general_journal` as csv, json and xlsx) take `start` and `end`
(omitted: the fiscal year to date; a start after the end is
refused); `balance_sheet`, `trial_balance`, `fixed_asset_register`
and `iif` take `as_of` (omitted: today, the company's time zone).
- IIF (`docs/spec/rules.md` B-34; plan D-36): plain ASCII text, every
- IIF (BS-format-2; plan D-36): plain ASCII text, every
line ending CR LF (`text/plain`, handed over like every export): every posted entry
from the first through `as_of`, period-closing entries left out
(QuickBooks keeps none; imported, a close would zero its period's
@@ -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, rules.md B-34 rule 8). No line names a customer or vendor (no
kept, BS-format-2 rule 8). 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
@@ -1972,7 +1972,7 @@ posting.
- `books.rename_account { account, name, reason? }` → `{ id, code,
previous_name, name, notes }` (scope `books:post`, destructive: a
rename changes the label every past report prints): give an account a
new name (rules.md B-31). Only the name changes (entries name accounts
new name (BS-ledger-10). Only the name changes (entries name accounts
by id): no entry, balance or statement amount moves, and every report,
past periods included, prints the new name. Refuses an unknown account,
a blank name, the name it has, a name another account under the same
@@ -1981,7 +1981,7 @@ posting.
`reason` is one to 2,000 characters with no full TIN. Journaled as
`account.renamed { account_id, code, name, previous, reason }`, keyed
by id (a code can change; an id can't), under the journal feature
`account_renamed` (rules.md B-27; books an older version wrote refuse
`account_renamed` (BS-format-1; books an older version wrote refuse
it, `format_upgrade_pending`, until their format upgrade), so an
earlier version stops at the declaration. `notes` always says that QuickBooks
matches accounts by name (tell a CPA who imported an earlier IIF), says
@@ -2010,12 +2010,12 @@ posting.
refuse`, refuses the whole file (a row is never a header account: the
file can't say so).
- `policy.require_tax_category` (`books.set_setting`): `warn` (unset) or
`refuse` (rules.md B-32). The accounts invoices, bills and payroll
`refuse` (BS-ledger-11). The accounts invoices, bills and payroll
create (Revenue 4000, General Expenses 6999, 6100, 6110) are never
refused; their results' `warnings` name them. A change naming the key
needs the journal feature `require_tax_category`: books an older
version wrote refuse it (`format_upgrade_pending`) until the owner's
format upgrade (rules.md B-27).
format upgrade (BS-format-1).
## Tools — import
@@ -2115,7 +2115,7 @@ accounting only: the caller supplies every figure), tax filing.
missing), or to `books.close_into` (a single owner's capital), zeroing
the `books.close_sweep` accounts (draws, dividends) into it too; or,
with `company.members` in the settings, to each member's capital
account by share (each member's distribution account zeroed into it), cumulatively (rules.md B-13; D-10): each close gives a member
account by share (each member's distribution account zeroed into it), cumulatively (BS-partner-1; D-10): each close gives a member
their share of everything closed to these members and shares so far, to
the currency's minor unit (odd units by largest remainder, ties to the
member listed first when the count began), less what earlier closes gave
@@ -2217,14 +2217,14 @@ snapshots; see plan 8.2 S4.
spelling is gone, P5).
- The due date: `due_date` as given (and it overrides `terms`); else
`terms` ("Net 30", "Net 15 EOM", "2/10 net 30", "Due on receipt",
"Due 2026-11-15", rules.md B-39); else the customer's
"Due 2026-11-15", BS-arap-3); else the customer's
`default_terms_as_customer`; else the books' `invoicing.default_terms`
("Net 30" unset); else refused, naming those ways. Terms are kept on
the invoice only when given or taken from a default: with only a due
date the invoice prints none.
- Its number (`INV-0001`) is `invoicing.number_prefix` and
`invoicing.first_number` plus the count of numbered invoices before it
(A-2, B-40); it is stored at issue and never recomputed, and a preview
(A-2, BS-arap-4); it is stored at issue and never recomputed, and a preview
shows the number the confirm will take (an abandoned preview uses up
none). Books that haven't declared `documents_v2` number nothing and
show a document as "Invoice {N}".
@@ -2244,7 +2244,7 @@ snapshots; see plan 8.2 S4.
- Without `confirmed` the DRAFT copy of the PDF is handed over (`pdf`,
run its `download`, D-46); confirming renders the issued copy before
anything is journaled and files it with the invoice in the same call
(A-7, B-40), returning its `attachment_id` and `sha256` (the same
(A-7, BS-arap-4), returning its `attachment_id` and `sha256` (the same
`sha256` `books.get_receipt` reports).
- `mailto` is a convenience link for a human to send it from their own
mail program: the subject "Invoice INV-0007 from {company}", the body
@@ -2252,7 +2252,7 @@ snapshots; see plan 8.2 S4.
never send anything (A-4): a mailto link carries no attachment, so say
which file to attach.
- `warnings` names a revenue account it created with no tax category
(rules.md B-32); `notes` one per finished or abandoned project a line
(BS-ledger-11); `notes` one per finished or abandoned project a line
names, and on confirm one per on-spec project (is there now an
agreement?).
- `books.create_bill { vendor | party_id, date, received_on?, vendor_ref?,
@@ -2268,7 +2268,7 @@ snapshots; see plan 8.2 S4.
project) part; `vendor` is a vendor id, its party's id or its name
(required; the old `party_id` spelling is gone, P5).
- `vendor_ref` is the vendor's own invoice number: required in books
that have declared `documents_v2` (B-40). The same vendor and number
that have declared `documents_v2` (BS-arap-4). The same vendor and number
twice is refused unless `duplicate_reason` says why, which is
journaled with the bill; case, spaces and hyphens are ignored.
`received_on` is the day it was received, when it differs from its
@@ -2285,7 +2285,7 @@ snapshots; see plan 8.2 S4.
- The due date and terms fall back as an invoice's, to the vendor's
`default_terms_as_vendor` and no further. `discount_by` is the last
day an early-payment discount is open and `max_discount` the largest
it allows (B-39): the caller gives the exact cents when it takes one.
it allows (BS-arap-3): the caller gives the exact cents when it takes one.
- `warnings` names an expense account it created with no tax category;
`notes` one per finished or abandoned project a line names (none for
on-spec: a cost of on-spec work is an expense like any other).
@@ -2298,7 +2298,7 @@ snapshots; see plan 8.2 S4.
(entry 0, the figures the documents would show, `preview` to pass
back) and nothing is written (P4: the S6 tools preview and confirm like
the create tools). Settles one or several invoices of one customer in one
entry (B-42): Dr the deposit account the cash less the fee, Dr the
entry (BS-arap-6): Dr the deposit account the cash less the fee, Dr the
payment-processing-fees account the fee, Dr sales allowances the
discounts, Cr A/R each invoice's cash and discount, every receivable
line tagged with its invoice (payment lines in application order, then
@@ -2318,7 +2318,7 @@ snapshots; see plan 8.2 S4.
- `books.pay_bill { date, paid_from, instrument?,
reference?, bill, amount? | applications: [{ bill, amount,
discount?, discount_reason? }], confirmed?, preview? }` → as `receive_payment`, per bill and
one vendor (B-42): Dr A/P each bill's cash and discount, Cr the payer
one vendor (BS-arap-6): Dr A/P each bill's cash and discount, Cr the payer
account the cash, Cr purchase discounts the discounts. A discount on a
bill with an asset or prepaid line is refused with its remedy (record
the bill net, or reclassify Dr 6995 / Cr the asset, D-49); a processor's
@@ -2328,7 +2328,7 @@ snapshots; see plan 8.2 S4.
have existed by reversing its own entry with the reason; it keeps its
number and reads `void`. Refused while a payment stands on it (the
refusal names the payment entry to reverse first), when void already,
before its date or in a closed period (P4b S1, B-38).
before its date or in a closed period (P4b S1, BS-arap-2).
- `books.mark_sent { invoice, on?, by?, via?, recipients?: [string],
kind?, reference?, note? }` → `{ invoice, sends: [{ on, by, via, to, kind,
reference?, note? }] }`. Records that an invoice went out (P4b S5,
@@ -2347,10 +2347,10 @@ snapshots; see plan 8.2 S4.
- `books.write_off_invoice { invoice, date, amount?, reason, upload_id |
existing_attachment_id, confirmed?, preview? }` → `{ entry_id, document: { ref,
status, paid, written_off, outstanding } }`. Writes off an invoice that
will not be collected (a bad debt, P4b S7; rules.md B-41): posts Dr
will not be collected (a bad debt, P4b S7; BS-arap-5): posts Dr
`6990` Bad Debt Expense / Cr `1200` Accounts Receivable, the receivable
line tagged with the invoice (`WriteOff`), so the invoice reads
`written_off` and its figures stay derived (B-38). `amount` (a decimal
`written_off` and its figures stay derived (BS-arap-2). `amount` (a decimal
string, default all it owes) is at most what is owed and may be partial
(§1.166-3(a)). Its evidence of worthlessness (collection
correspondence, a bankruptcy notice: §1.166-2(a)) is filed in the same
@@ -2370,7 +2370,7 @@ snapshots; see plan 8.2 S4.
kind, documents: [{ ref, party, date, due_date, total, outstanding,
status, overdue_days, last_sent? }], outstanding_total }`. Invoices (`kind`
`invoices`) or bills (`bills`), due date first, every figure derived
from the document's lines that stand (B-38). `status` filters: `open`
from the document's lines that stand (BS-arap-2). `status` filters: `open`
(default: anything still owed, partly paid and overdue included),
`overdue`, `paid`, `void`, `written_off`, `overpaid` or `all`; a row's
own `status` is one of `open`, `partial`, `paid`, `written_off`,
@@ -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
(B-23, B-38 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 (B-23, B-38 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:
@@ -2464,7 +2464,7 @@ entries.
## Tools — projects (classes)
A project is a class with its facts (`docs/spec/rules.md` B-37): the
A project is a class with its facts (BS-statement-5): the
same id, the same name, so `books.add_line`'s `class`, the P&L `class`
filter and `books.profit_and_loss_by_class` take projects. A `project`
reference is an id or a name (ignoring capitals in any script and
@@ -2475,7 +2475,7 @@ ignoring capitals and surrounding space, and never digits only (they
would read as an id). A change that keeps a project's own name never
checks it again, so old books holding a duplicate name can change either
project's facts; a rename onto another project's name is refused. Every project write but a name alone needs the journal feature
`projects` (B-27): books waiting for their format upgrade (D-39) can add
`projects` (BS-format-1): books waiting for their format upgrade (D-39) can add
a project by name only, and every other project write (facts, a link to
a project, a decision naming one) is refused with `format_upgrade_pending`
until the owner upgrades them.
@@ -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 (B-37 item 7: revenue less every cost
contribution before overhead (BS-statement-5 item 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
@@ -2515,7 +2515,7 @@ until the owner upgrades them.
for an on-spec project (else null): expenses less revenue, never below
zero.
- `books.project { project, start?, end? }` (books:read; omitted dates: the fiscal
year to date, B-30, as every period report) → `{ project, period: {
year to date, BS-period-3, as every period report) → `{ project, period: {
start, end, revenue, expenses, net, margin_pct, by_account: [{ code, name, type
("revenue" | "expense"), amount }], by_month: [{ month ("YYYY-MM"),
start, end, revenue, expenses, net, net_to_date }] }, to_date (as above, through
@@ -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, rules.md B-37 item 8), in
and `books.create_bill`, `class` on a line, BS-statement-5 item 8), in
books that declared the journal feature `document_line_projects`; the
handbook's projects section says which these books are. Their payments
take none.
@@ -2571,12 +2571,12 @@ until the owner upgrades them.
dated on or before `as_of` is open (post it or discard it); with
`allow_open_drafts: { reason }` the package goes and the reason is
journaled as a decision.
**As of one day** (`docs/spec/rules.md` B-33): nothing in it reflects
**As of one day** (BS-statement-4): nothing in it reflects
anything dated after `as_of` (default today): no figure, entry,
receipt or worksheet row; the chart and `documents/` are as they stand.
One list of cash accounts and one of financing accounts serve the
whole package: the request's, else the settings'.
**QuickBooks file** (`general-journal.iif`, B-34): as `books.export`
**QuickBooks file** (`general-journal.iif`, BS-format-2): as `books.export`
iif makes it, through `as_of`; `warnings` says what it writes
differently from the books, in the same lines as `books.export` iif's
(account and class names and account numbers one each, the memos
@@ -2629,7 +2629,7 @@ until the owner upgrades them.
party is the party with the member's name (not a display name) and the
member role, as the viewer's capital statement finds it; with none, the
member's TIN is a gap. **Tax-basis capital** (`k1-tax-basis-capital.csv`,
P3, D-41, rules.md B-36; Form 1065 instructions, Item L, the tax-basis
P3, D-41, BS-partner-4; Form 1065 instructions, Item L, the tax-basis
method): per member, `member, item, book, tax_basis, book_less_tax,
status, note` for each Item L line (beginning; capital contributed,
cash and property; current year net income (loss); other increase
@@ -2667,7 +2667,7 @@ until the owner upgrades them.
A draft is an entry being built (`books.draft_entry`, `books.add_line`) that
is not in any report until it posts. P4 gives it a state, a way out, and a
read-only preview (rules.md B-43; the journal feature `drafts_v2`: the
read-only preview (BS-entry-5; the journal feature `drafts_v2`: the
state and discard tools wait for the books' format upgrade).
- `books.list_drafts { state?, as_of? }` → `{ drafts: [{ entry_id, date,
@@ -2746,7 +2746,7 @@ An audit is the books read as an auditor reads them, through a day, in one
run: the same books give the same findings and the same workpaper. An
attestation is a claim by a checker that it looked at something. The audit
finds; the attestations stand behind it; the CPA package waits for both
(rules.md B-45; decision D-9; the journal feature `audits`: the audit run
(BS-ledger-13; decision D-9; the journal feature `audits`: the audit run
and the attestations wait for the books' format upgrade, refused with
`format_upgrade_pending` until then).
+1 -1
View File
@@ -94,7 +94,7 @@ built through wanderbooks (entries, foreign lines, reversals, closes),
every account's balance at month ends and random dates, and each month's
P&L, compared exactly (15,800 comparisons). Its first run found one real
difference, adjudicated from principles: wanderbooks kept sub-cent
amounts on foreign lines; it now books in cents (rules.md B-3). What the
amounts on foreign lines; it now books in cents (BS-ledger-1). What the
original plan still owes (roadmap phase 3): fixture books, not only random
ones, diffed as `snapshot()` output automatically, inside the harness as
it is (no `ledger-oracle` crate is planned: D-53). This is the direct analog
+14 -15
View File
@@ -30,16 +30,16 @@ in CI that the floor never falls between commits.
| Reversing entries | Reverse transaction | done | linked via `reversal_of`; dated on or after its original, every kind of entry (D-73) |
| Canonical report snapshots (JSON) | — (our oracle format) | done | `reports::snapshot` |
| Fixed-asset register + straight-line depreciation | Fixed Asset register | done | `assets.rs`; golden-covered schedule; idempotent runs; disposal with gain/loss; posted (the books') vs scheduled, in-service vs acquired dates, the §723, depreciable and §704(c) figures (P3) |
| Cash flow statement (direct, with the reconciliation schedule and noncash disclosures) | Reports → Cash Flow | done | R-FUTURE-3; rules.md B-14 (P3 defect 1) |
| Cash flow statement (direct, with the reconciliation schedule and noncash disclosures) | Reports → Cash Flow | done | R-FUTURE-3; BS-statement-3 (P3 defect 1) |
| Foreign-currency lines (base + foreign stored) | Multi-currency accts | done | R-FUTURE-1 |
| Period close (closing entry to Retained Earnings) | Close books | done | R-FUTURE-2 |
| Bank reconciliation (cleared flags + report) | Reconcile | done | — |
| QuickBooks CSV import (bank txns, chart of accounts) | Banking → Upload | done | R-FUTURE-4 |
| QuickBooks IIF + XLSX export | Export / reports | done | R-FUTURE-4 |
| 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 (rules.md B-38); 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/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, rules.md B-37 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 item 8; 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 |
@@ -48,7 +48,7 @@ in CI that the floor never falls between commits.
| Prepaid expense + deferred revenue amortization | Amortization schedules (Xero/QBO add-ons) | done | hand-verified fixture, to the cent; golden-covered (`golden/amortization_plans.json`, `schedules.rs::golden_amortization_plans`: plan, posted, remaining, P&L and balance sheet; worksheet `plan/golden-worksheets/amortization-plans.md`) |
| Automated cross-implementation diff harness (GnuCash first) | — (`just oracle`) | partial | live: `tests/oracle_gnucash.rs` runs 200 random books through GnuCash 5.10 in a pinned container, 15,800 exact comparisons, weekly in CI (docs/oracle.md Layer 5); open: fixture books diffed as `snapshot()` output, and the machine-readable catalog with CI enforcing this floor |
| Invoice sent tracking (who, how, to whom, when, original or reminder, the channel's reference) | Business → Invoices (Xero's "Sent"; QBO's email) | done | P4b S5; records, never sends (A-4); a send changes no figure; `invoice.sent` under `documents_v2` (D-52) |
| Multi-document settlements with early-payment discounts (gross method) | Business → Invoices/Bills; Receive payment | done | P4b S6: one entry, one party, one application per document (`kernel::settle`, B-42); a discount beyond the terms needs a reason; a bill with an asset line is refused (D-49); the bill and its payment tested, replay equal to live |
| Multi-document settlements with early-payment discounts (gross method) | Business → Invoices/Bills; Receive payment | done | P4b S6: one entry, one party, one application per document (`kernel::settle`, BS-arap-6); a discount beyond the terms needs a reason; a bill with an asset line is refused (D-49); the bill and its payment tested, replay equal to live |
| A processor's fee on a payment received (gross presentation) | Xero/QBO Stripe & Shopify deposits | done | P4b S6: Dr the deposit the net, Dr processing fees the fee, Cr A/R the gross (A-4); `a_fee_posts_gross_to_receivables_and_net_to_the_bank` |
| Bills due, aging detail and tie-out, aging exports | Business → Bills; Reports → A/R and A/P Aging | done | P4b S6: `books.bills_due`, `detail`, `control`, `ar_aging.csv`/`ap_aging.csv` in `books.export` and the CPA package, each with its `TOTAL` tie-out (`the_aging_csvs_tie_to_the_control_check`) |
@@ -59,13 +59,12 @@ egui phase starts; semantics come first.
P0 (`plan/served.md`) changed no feature in the catalog above, so no
status moved and the floor stands. It hardened what exists: an older
version refuses books from a newer one as newer, not corrupt (rules.md
B-27); the MCP server fails closed after an internal error, and no input
reaches one (dates are four-digit years, amounts at most a line's, B-28);
version refuses books from a newer one as newer, not corrupt (BS-format-1); the MCP server fails closed after an internal error, and no input
reaches one (dates are four-digit years, amounts at most a line's, BS-entry-4);
local files
were read only from the import roots, never the books, the vault or its
key (P2 slice 5 removed local paths: files now come in only as uploads,
D-46); no file with a full TIN is filed into the books (B-26); the agent is
D-46); no file with a full TIN is filed into the books (BS-partner-2); the agent is
told the rules in force in a short connect text and a handbook, and no
agent text points at the books' files, git or the repo.
@@ -109,7 +108,7 @@ P13 is a specification, not a feature, so no row of the semantic catalog
moves and the floor stands. It adds the checker crate (`bookspec/checker`:
the example schema, the rule identifiers `BS-<area>-<n>` and the `Engine`
trait), the runner (`bookspec/runner`: pass, fail or not claimed per rule),
and the rule index from B-1 to B-45 (`bookspec/spec/rules-index.md`). Every
and the rule index from BS-entry-1 to BS-ledger-13 (`bookspec/spec/rules-index.md`). Every
existing bookspec example still runs on every `cargo test`, through both
the loader's own checks and the `Engine` trait.
@@ -122,7 +121,7 @@ number and due date it will take, the DRAFT or the discount, and nothing
written) and post with it (A-1), which is what the workflow reference
does before a document leaves the company. A bill in books that have
declared `documents_v2` names each line's account and keeps the vendor's
invoice (A-10, A-13); an invoice keeps the copy it issued (A-7, B-40) and
invoice (A-10, A-13); an invoice keeps the copy it issued (A-7, BS-arap-4) and
a `mailto` link for a human to send it, since the books never send (A-4).
`books.update_party` takes the party's email and terms per side (A-13) and
the owner's full contact block (D-55: phone, contact person, billing and
@@ -144,7 +143,7 @@ saves the issued copy beside the re-created one; the Money in list names an
invoice by its number. The handbook's invoices-and-bills procedure is
complete (issue, collect, pay on terms, void or write off, the fee, the
CPA's list) and says what waits for the owner's upgrade. rules.md gains
B-39 (terms) and B-40 (numbers and the issued copy). No golden moved.
BS-arap-3 (terms) and BS-arap-4 (numbers and the issued copy). No golden moved.
### P9a self-host deployment (2026-10-26)
@@ -188,7 +187,7 @@ A/R gained the direct write-off the owner chose (A-5; plan 8.2 S7): an
invoice that will not be collected comes off 1200 with Dr 6990 Bad Debt
Expense, its receivable line tagged `WriteOff` so the receipt's figures
stay derived, and its evidence of worthlessness filed in the same call
(rules.md B-41; IRC §166, §111; Treas. Reg. §1.166-1(e), (f), -2(a),
(BS-arap-5; IRC §166, §111; Treas. Reg. §1.166-1(e), (f), -2(a),
-3(a)). A same-year recovery is the reversal D-49 records, not a new
movement; bills are never written off. No row above changed status (the
A/R and A/P rows already say `done`), so the floor stands (10 done).
@@ -207,7 +206,7 @@ hash `books.verify` checks), holds identical bytes as one live attachment
annotation field list, engine receipt numbers running from the max) and
what a payment settles (`entry.settles`, the only source of "reimbursed"),
and gives company records four more homes (`notices`, `correspondence`,
`plans`, `history`, D-20). Rules.md B-44 states it; `docs/testing.md`'s P6
`plans`, `history`, D-20). Rules.md BS-ledger-12 states it; `docs/testing.md`'s P6
section lists its tests and the P12 mutation targets.
### P4: drafts, the evidence gate, the preview digest (2026-10-29)
@@ -216,7 +215,7 @@ Three new rows, none above changed status, and the floor stands.
| Area | Counterpart (a cross-check, not the spec) | Status | Notes |
|---|---|---|---|
| Draft states and discard (`books.set_draft_state`, `books.discard_draft`, `books.list_drafts`; Lean `Step.discard`) | Draft/pending transactions (QBO "pending"), voiding an unposted entry | done | `entry.draft_state_set` and `entry.draft_discarded` under `drafts_v2`; B-43; tests `discard_unblocks_close`, `draft_states_replay_and_project`, `a_draft_waits_for_its_receipt_and_posts`; the fixture `p4_before` was written by the version before and opens to the same figures; golden-covered (`ledger-store` `golden/draft_states_and_evidence_gate.json`, `golden_drafts.rs::golden_draft_states_and_evidence_gate`; worksheet `plan/golden-worksheets/draft-states-and-evidence-gate.md`) |
| Draft states and discard (`books.set_draft_state`, `books.discard_draft`, `books.list_drafts`; Lean `Step.discard`) | Draft/pending transactions (QBO "pending"), voiding an unposted entry | done | `entry.draft_state_set` and `entry.draft_discarded` under `drafts_v2`; BS-entry-5; tests `discard_unblocks_close`, `draft_states_replay_and_project`, `a_draft_waits_for_its_receipt_and_posts`; the fixture `p4_before` was written by the version before and opens to the same figures; golden-covered (`ledger-store` `golden/draft_states_and_evidence_gate.json`, `golden_drafts.rs::golden_draft_states_and_evidence_gate`; worksheet `plan/golden-worksheets/draft-states-and-evidence-gate.md`) |
| One evidence gate (`evidence::requirement`) | Attach-required rules on posting | done | the store, the previews, the digest, the viewer and Needs attention call one function; `gui_and_server_gate_agree`, `a_reversal_needs_no_receipt_of_its_own` (D-47); golden-covered by the same file as the row above (every entry's `evidence::requirement`, the gate's refusals, a reversal exempt by origin) |
| Preview digest on every confirm (D-50) | Confirm dialogs | partial | `stale_preview_refused`, `every_confirm_tool_takes_a_preview`; detects drift, not a human's look |
@@ -246,7 +245,7 @@ Three new rows, none above changed status, and the floor stands.
| Area | Counterpart (a cross-check, not the spec) | Status | Notes |
|---|---|---|---|
| Audit run: one programme of checks over the statements, the control accounts, closes, schedules, assets, evidence, drafts, tax categories, 1099 decisions, settings and the store's integrity (`books.audit`, `books.workpaper`) | An auditor's workpaper; QBO "Audit log"/"Review" and Xero's "Reports review" are a cross-check only | done | rules.md B-45; `ledger_core::audit`, `ledger_store::audit`; tests `audit_detects_each_seeded_defect` (every code seeded), `audit_is_deterministic`, `workpaper_pdf_is_deterministic`; the fixture `p8_before` was written by the version before; golden-covered (`golden/audit_workpaper.json`, `golden_audit.rs::golden_audit_workpaper`: five findings in five areas, the 1099 and cash-flow inputs derived from the books; severities are the `CODES` table's CONVENTION; worksheet `plan/golden-worksheets/audit-workpaper.md`) |
| Audit run: one programme of checks over the statements, the control accounts, closes, schedules, assets, evidence, drafts, tax categories, 1099 decisions, settings and the store's integrity (`books.audit`, `books.workpaper`) | An auditor's workpaper; QBO "Audit log"/"Review" and Xero's "Reports review" are a cross-check only | done | BS-ledger-13; `ledger_core::audit`, `ledger_store::audit`; tests `audit_detects_each_seeded_defect` (every code seeded), `audit_is_deterministic`, `workpaper_pdf_is_deterministic`; the fixture `p8_before` was written by the version before; golden-covered (`golden/audit_workpaper.json`, `golden_audit.rs::golden_audit_workpaper`: five findings in five areas, the 1099 and cash-flow inputs derived from the books; severities are the `CODES` table's CONVENTION; worksheet `plan/golden-worksheets/audit-workpaper.md`) |
| Attestations of receipts, entries and periods, weighed against `policy.attestation_bar` when asked (`books.attest_receipt`, `books.review_entry`, `books.attest_period`, `books.attestations`) | An accountant's sign-off on a month | partial | `below_bar_not_counted`, `amount_mismatch_never_counts`, `stale_head_period_attestation_refused`; the method is the client's own claim, and the books say so |
| The CPA package waits for a counted audit (`policy.cpa_package_requires_audit`) | A close checklist before handoff | partial | `cpa_package_refuses_without_a_counted_audit_unless_a_reason_is_given`; behind the feature `audits` |
+4 -4
View File
@@ -6,7 +6,7 @@ subject. Status: built (2026-10-15 to 2026-10-17: parties with roles, the
TIN vault, attachments linked to any subject; the party's contact block,
D-55, landed with P4b S4.4 on 2026-10-29; the same bytes filed twice are
one attachment since P6, the same day). The design is kept as
written; departures are in `plan/served.md` and `docs/spec/rules.md` B-26.
written; departures are in `plan/served.md` and BS-partner-2.
## Why together
@@ -50,7 +50,7 @@ W4Facts { received: NaiveDate, state: String, kept_at: String }
The 1099 form stays on the vendor record (`vendor.1099_set`); a party
reaches it through `vendor`.
Rules (to vendor as B-26 with sources):
Rules (to vendor as BS-partner-2 with sources):
- A full TIN or SSN is never in the journal: `tin_last4` is exactly four
digits, and any nine-digit run in any party field is refused (the engine
@@ -102,7 +102,7 @@ derived. Spec: `ledger_core::shares`.
(`set_entry_party`) is one derived share: all of it.
`Ledger::entry_party` means "the sole party"; `entry_parties` lists
them all.
- **What a share is of** (rules.md B-35, P3 defect 14): one signed
- **What a share is of** (BS-partner-3, P3 defect 14): one signed
target, debit-positive as a line on the parties' own account (positive:
the company paid or gave; negative: it received), with its direction
(paid, received, neither) and what of it was money and what property in
@@ -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 (B-35 item 4): cash (its money: cash, a card, the members'
bases (BS-partner-3 item 4): 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
+1 -1
View File
@@ -174,6 +174,6 @@ rounding) and `Fx.booked_whole` (every booked amount in `Z * u`). The
D-75 bound is stated in BS-entry-4 as an engine-neutral MUST (a foreign
amount and an exchange rate each take at most ten decimal places, trailing
zeros not counted; replay exempt, BS-entry-8), with D-75 as its
provenance. wanderbooks' claim for B-28 (`docs/spec/claims/entry.md`)
provenance. wanderbooks' claim for BS-entry-4 (`docs/spec/claims/entry.md`)
lists the enforcement (`add_line_fx`, `ValueOutOfRange`, never on replay)
and the checks.
+1 -1
View File
@@ -23,7 +23,7 @@ wrapper: when the amount carries no more places than `places` it is returned
unchanged, otherwise the result carries exactly `places` places, matching
`Decimal::round_dp_with_strategy` to the character (including its scale).
`round_minor` picks `10^-currency.minor_units()`; a currency ISO 4217 gives
no minor unit is returned exactly, the FX rule's existing behaviour (B-3).
no minor unit is returned exactly, the FX rule's existing behaviour (BS-ledger-1).
The `Amount` trait gained `checked_round_to_step`, implemented for
`Decimal`, `i32` and `i64` exactly as `checked_div_round_cent` was: the
+3 -3
View File
@@ -1,8 +1,8 @@
# K-U4: collection totals (`kernel/total.rs`)
Kernel sweep unit U4 (`plan/kernel-sweep-audit.md` sections 2 and 3). The
authority is rules.md B-21 (amounts are exact; rounding only on returns) and
B-28 (no input may reach a panic), bookspec `BS-entry-3` and `BS-entry-4`.
authority is BS-entry-3 (amounts are exact; rounding only on returns) and
BS-entry-4 (no input may reach a panic), bookspec `BS-entry-3` and `BS-entry-4`.
## The functions
@@ -105,7 +105,7 @@ mirrors):
arguments: `audit::check_articulation` (`current_earnings + closed`),
`periods::allocate_last_absorbs` / `allocate` (`amount * share`), and the
kernel-less helpers with `Decimal` arguments. All now refuse. Documents,
drafts and recurring entries are the figures B-28 lets restore oversized.
drafts and recurring entries are the figures BS-entry-4 lets restore oversized.
## Sites replaced
+4 -5
View File
@@ -93,8 +93,7 @@ apply is safe — on startup the applier replays every journal line with
through that link (plan 8.3.11). An `invoice.written_off` (plan 8.3.6,
P4b S7) carries `{invoice_id, entry_id, date, amount, reason}`; replay
tags the entry's receivables line `WriteOff`, and the projection keeps
no written-off figure either: it is the tagged lines' sum (rules.md
B-38, B-41). Its evidence of worthlessness rides beside it, as a
no written-off figure either: it is the tagged lines' sum (BS-arap-2, BS-arap-5). Its evidence of worthlessness rides beside it, as a
`receipt.attached` on the write-off's entry and an `attachment.linked`
to the invoice, filed in the same call.
- `prev`: hex SHA-256 of the previous line's canonical JSON (keys sorted, no
@@ -164,7 +163,7 @@ a backup is then proven where it lands, by a drill (docs/mcp-interface.md,
only leaves an entry through a recorded unlink. Blobs are untouched: a
withdrawn file is still hash-verified and readable, and the journal shows
when it was filed, linked, unlinked, and withdrawn, and why.
- **Extraction is derived, and journaled** (P6, rules.md B-44):
- **Extraction is derived, and journaled** (P6, BS-ledger-12):
`attachment.text_extracted {attachment_id, text_sha256, extractor,
version, pages, status}` records what reading a file found (`ok`,
`none`, `failed`); the text itself is a content-addressed blob like any
@@ -176,7 +175,7 @@ a backup is then proven where it lands, by a drill (docs/mcp-interface.md,
read off a file (the closed field list; a later annotation replaces the
earlier record), and `entry.settles {entry_id, settles[]}` says which
entries a payment pays back (the only source of "reimbursed").
- **Audits and attestations are records, not figures** (P8, rules.md B-45,
- **Audits and attestations are records, not figures** (P8, BS-ledger-13,
feature `audits`): `audit.run {id, through, through_seq, scope,
program_version, tb_hash, findings_sha256, workpaper_attachment?,
workpaper_pdf?}` says a programme of checks was run through a day at the
@@ -206,7 +205,7 @@ Suspected corruption is fixed by rebuild, never by forensics.
schema keeps a file of its own, and a version never migrates, writes or
deletes another schema's (`ledger_store::db_file_for`; the legacy
`wanderbooks.db` is used only while it holds this version's schema;
rules.md B-27). The journal lives next to it
BS-format-1). The journal lives next to it
at `$WANDERBOOKS_DATA/journal.jsonl`; blobs under
`$WANDERBOOKS_DATA/blobs/`. WAL mode on, `synchronous=FULL`,
`integrity_check` on startup.
+8 -8
View File
@@ -66,7 +66,7 @@ requirement conflict, the requirement wins.
to the currency's minor unit by largest remainder (the odd cent goes to
the largest remainder, ties to the earlier member; the owner, 2026-10-13),
earnings not yet closed the way their close will split them (D-38,
rules.md B-13), so every row's total is exact and a member's capital on a
BS-partner-1), so every row's total is exact and a member's capital on a
day never changes when its month is closed. Any equity change the roll-forward doesn't explain is shown as
"other", never hidden.
- **R-9d — Tax categories.** Revenue and expense accounts map to stable
@@ -100,7 +100,7 @@ requirement conflict, the requirement wins.
- **R-13 — Receipt enforcement.** The server (not the engine — the engine
stays policy-free) enforces the books' evidence policy: postings at or
above a threshold (the journaled setting `policy.evidence.threshold`,
with required and exempt accounts; P1, rules.md B-29) must have at least
with required and exempt accounts; P1, BS-ledger-9) must have at least
one attached receipt. Evaluated by `ledger-config`'s `ReceiptPolicy`
today; P4 moves the evaluation into `ledger_core::evidence` so the
store, the server and the viewer call one function (plan I-5, D-47:
@@ -118,7 +118,7 @@ requirement conflict, the requirement wins.
- **R-? — Cash flow statement** (direct method, with the reconciliation
of net income to operating cash and the noncash investing and financing
activities; rules.md B-14, P3 defect 1). Was R-FUTURE-3.
activities; BS-statement-3, P3 defect 1). Was R-FUTURE-3.
`ledger-core::reports::cash_flow` + `books.cash_flow`.
- **R-? — QuickBooks-compatible import/export.** Was R-FUTURE-4.
`ledger-import` crate: CSV bank/chart import, IIF and XLSX export.
@@ -137,7 +137,7 @@ requirement conflict, the requirement wins.
account by share, to the currency's minor unit, odd units by largest
remainder, cumulatively from the first members close with these members
and shares, so no member is ever a unit from their exact share: the
partnership convention, rules.md B-13; closes journaled under earlier
partnership convention, BS-partner-1; closes journaled under earlier
rules replay with the rule they were made under: `CloseTo::MembersRun`,
the run rule of 2026-10-13 to P3, `CloseTo::MembersPerClose`, and
before 2026-10-13 the last member absorbing rounding), or `CloseTo::Account` (any equity account, e.g.
@@ -166,7 +166,7 @@ requirement conflict, the requirement wins.
- **R-? — A/R and A/P workflows.** Was R-FUTURE-5.
`ledger-core::arap`: customers, vendors, invoices, bills, payments,
AR/AP aging. MCP tools for the full workflow. Since P4b S1 (D-45,
rules.md B-38): a document's figures are the signed sum of its tagged
BS-arap-2): a document's figures are the signed sum of its tagged
ledger lines dated on or before the day asked about, so reversals,
voids and write-offs are right by construction; a hand line on a
control account is refused; `books.control_check` ties the subledger to
@@ -185,11 +185,11 @@ requirement conflict, the requirement wins.
split explicitly across lines at entry time.
- **R-? — CPA handoff package.** `books.export_cpa_package` (and the
viewer's Export menu, D-29): a zip, built by `ledger-package` for both,
as of a day (B-33), with the trial balance and general ledger as XLSX,
the statements as Typst PDFs, the journal as IIF (B-34), every receipt
as of a day (BS-statement-4), with the trial balance and general ledger as XLSX,
the statements as Typst PDFs, the journal as IIF (BS-format-2), every receipt
behind the period's entries with an index, the company's documents, the
1099 worksheet, the members' equity and K-1 worksheets (book and tax
basis, B-36), and a README; handed over as a download (D-46).
basis, BS-partner-4), and a README; handed over as a download (D-46).
## Non-goals (all phases of the engine)
+7 -7
View File
@@ -24,7 +24,7 @@ layers differ in what they cover and in whether we may copy them:
```text
SOURCE: Pacioli ch. 36 (sources/pacioli-1494.md); IRS Pub. 583 (sources/irs-records.md)
SOURCE: ASC 830-20-30-1 (cited, rules.md B-3)
SOURCE: ASC 830-20-30-1 (cited, BS-ledger-1)
SOURCE: CHOICE (the owner, 2026-10-13)
SOURCE: CONVENTION (QuickBooks aging); nearest authority ASC 326-20-55-38 (illustrative)
```
@@ -73,12 +73,12 @@ 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 B-14 rule 11) is in neither list above; ASC
606-10-25-31, 25-32 and 55-20 (B-16's over-time method) are not yet read;
B-15 rule 6 cites ASC 250 with no paragraph; B-17's 606-10-55-39 is in
issue costs, cited by BS-statement-3 rule 11) 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
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): B-38 cites ASC 310-10, 405-20-40-1 and 606-10-45-4,
none yet read in the ASC basic view; B-38 keeps the CONVENTION label
P4b, 2026-10-23): BS-arap-2 cites ASC 310-10, 405-20-40-1 and 606-10-45-4,
none yet read in the ASC basic view; BS-arap-2 keeps the CONVENTION label
until they are vendored with a SHA-256, as P4b.16 lists with the sources
B-39 to B-41 will need.
BS-arap-3 to BS-arap-5 will need.
+14 -14
View File
@@ -14,7 +14,7 @@ allocated "as equitably as possible" to the periods that get its
services. Depreciation distributes cost, "less salvage (if any)", over
the estimated useful life "in a systematic and rational manner"; it is
"a process of allocation, not of valuation." No method is prescribed.
→ B-15: straight line, salvage never depreciated, partial months by
→ BS-asset-1: straight line, salvage never depreciated, partial months by
days (each day of service bears the same cost) is one systematic and
rational allocation.
@@ -25,7 +25,7 @@ normal operating cycle," paid "in advance of their use or consumption"
(05-4); examples include insurance, interest, rents, taxes, and
advertising not yet received (05-5). The Subtopic covers only their
nature (05-2): it prescribes no expensing method.
→ B-16: a prepaid is an asset, expensed over the months it covers
→ BS-prepaid-1: a prepaid is an asset, expensed over the months it covers
(a convention; the ASC is silent on the method).
## 210-10-45-1, -45-2, -45-5 (Balance sheet: current assets and liabilities)
@@ -47,10 +47,10 @@ operating activities" (45-10). Collections on, and disbursements for,
loans the entity makes are investing (45-12(a), 45-13(a)). Proceeds of
"other short- or long-term borrowing" are financing inflows (45-14(b));
"repayments of amounts borrowed" are financing outflows (45-15(b)).
→ B-14: money owners advance (Due to Shareholders) is borrowing, so
→ BS-statement-3: money owners advance (Due to Shareholders) is borrowing, so
financing, gross; a loan the company makes is investing, gross.
## ASC 230 for the direct method (rules.md B-14, P3 defect 1)
## ASC 230 for the direct method (BS-statement-3, P3 defect 1)
Read 2026-10-20, not in the ASC basic view: DART's Codification pages
need a login, and its public Roadmap on the statement of cash flows
@@ -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." → B-14 rule 1.
of an entity during a period." → BS-statement-3 rule 1.
- **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
@@ -92,7 +92,7 @@ Quotes are short; the rest is paraphrase.
purchase" for PP&E; generally only those are investing, and incurring
debt directly to the seller is a financing transaction whose later
principal payments are financing. → rule 12 (the bill split), and the
limit B-14 records.
limit BS-statement-3 records.
- **230-10-45-14(a)** (EY p. 42): financing inflows include "Proceeds from
issuing equity instruments". **45-15(a)**: financing outflows include
"Payments of dividends or other distributions to owners"; **45-15(c)**:
@@ -175,7 +175,7 @@ Quotes are short; the rest is paraphrase.
referenced to it. → the printed statement's noncash schedule.
- **830-230-45-1** (EY p. 81; DART 7.1): the effect of exchange-rate
changes on cash held in foreign currencies is reported as a separate
part of the reconciliation of the change in cash. → B-14's scope note
part of the reconciliation of the change in cash. → BS-statement-3's scope note
(single-currency books, R-5).
- **105-10-05-1, 05-2, 05-3** (read only in their 2009 text, ASU 2009-01
Appendix B, pp. 17-18, https://storage.fasb.org/ASU2009-01.pdf; the
@@ -264,24 +264,24 @@ An entity controlling the specified good or service before transfer is
the principal (55-37) and recognizes revenue "in the gross amount of
consideration" it expects (55-37B); an agent recognizes only its fee or
commission (55-38).
→ B-17: an app seller is the principal for its app, so its revenue is
→ BS-revenue-1: an app seller is the principal for its app, so its revenue is
the gross price; the platform's commission is an expense.
## 450-30-25-1 (Gain contingencies)
Added 2026-10-21 for B-37 from the paragraph's text as Deloitte's DART
Added 2026-10-21 for BS-statement-5 from the paragraph's text as Deloitte's DART
roadmaps quote it (originally FAS 5 ¶17(a)); not re-read in the ASC
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."
→ B-37 item 4: a payment hoped for from work done on spec is recorded
→ BS-statement-5 item 4: 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.
## 340-40-25-5 (Costs to fulfill a contract)
Added 2026-10-21 for B-37 as the DART revenue roadmap sets it out; not
Added 2026-10-21 for BS-statement-5 as the DART revenue roadmap sets it out; not
re-read in the ASC basic view: check it there at the next reading. Costs
incurred to fulfill a contract (one not in another Topic's scope) are an
asset only if all three criteria are met: they relate directly to a
@@ -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."
→ B-37 item 4 (with B-22): on-spec work has no contract it is expected
→ BS-statement-5 item 4 (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 B-37 item 8 as the DART revenue roadmap sets it
Added 2026-10-22 for BS-statement-5 item 8 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.
→ B-37 item 8 (with 25-7): a cost traceable to one job (25-7(a), (b),
→ BS-statement-5 item 8 (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
+1 -1
View File
@@ -1,5 +1,5 @@
# A promise to pay is not payment: Helvering v. Price, 309 U.S. 409 (1940)
Governs why a party's totals never count a promise as a payment (rules.md B-35): a bill, a fee charged on the party's own card, equipment bought on the seller's own note, or a distribution still owed counts when it is paid, not when it is promised. The Supreme Court held that a taxpayer reporting on the cash basis who gave his own note, even a secured one, had not paid. Opinions of the Supreme Court are works of the United States Government (`us-public-domain-status.md`).
Governs why a party's totals never count a promise as a payment (BS-partner-3): a bill, a fee charged on the party's own card, equipment bought on the seller's own note, or a distribution still owed counts when it is paid, not when it is promised. The Supreme Court held that a taxpayer reporting on the cash basis who gave his own note, even a secured one, had not paid. Opinions of the Supreme Court are works of the United States Government (`us-public-domain-status.md`).
## Helvering v. Price, 309 U.S. 409, 412-413 (1940)
Source: <https://tile.loc.gov/storage-services/service/ll/usrep/usrep309/usrep309409/usrep309409.pdf> (United States Reports, Library of Congress)
+7 -7
View File
@@ -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 (rules.md B-34 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 rule 8). 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`
@@ -151,7 +151,7 @@ Retrieved: 2026-10-20
Cited (not quoted): "User recognizable name for the Account", with ValidRange "QBW: Max=31" (QuickBooks Desktop; QuickBooks Online: 100). Its `Account.AcctNum` page (`.../95a0835b-80bd-4fe1-2d7f-96ea2c372442.htm`) states no length.
So the limits are Intuit's own: an account name (one level of a subaccount's NAME, as the account's own name is entered) at most 31 characters, an account number at most 7, a memo at most 4,095. The books write each within them: a longer level is cut to 31 (then no two NAMEs may match), a longer number is left out of ACCNUM (it is optional; the NAME identifies the account), a longer memo is cut to 4,095, and every one is listed (rules.md B-34).
So the limits are Intuit's own: an account name (one level of a subaccount's NAME, as the account's own name is entered) at most 31 characters, an account number at most 7, a memo at most 4,095. The books write each within them: a longer level is cut to 31 (then no two NAMEs may match), a longer number is left out of ACCNUM (it is optional; the NAME identifies the account), a longer memo is cut to 4,095, and every one is listed (BS-format-2).
## Add, edit, or delete accounts in QuickBooks Desktop (US, updated 8/4/2026)
Source: <https://quickbooks.intuit.com/learn-support/en-us/help-article/chart-accounts/add-edit-delete-accounts-quickbooks-desktop-mac/L95VT34uN_US_en_US>
@@ -162,7 +162,7 @@ Tagged for QuickBooks Desktop (Mac Plus, Premier Plus, Pro Plus, Accountant, Ent
> The parent and subaccount must be the same account type.
So the books write a subaccount whose QuickBooks type differs from its parent's (a bank account under a header that is no bank, an asset's cost account under a "Fixed assets" header) at the top level, its own subaccounts with it, and list it (rules.md B-34). Intuit's own journal sample (`journal.zip`, above) declares `Construction:Labor` without ever declaring `Construction`, so QuickBooks makes a missing parent itself; the books declare each parent before its subaccounts all the same, so a parent keeps its own type and number rather than taking ones QuickBooks guesses.
So the books write a subaccount whose QuickBooks type differs from its parent's (a bank account under a header that is no bank, an asset's cost account under a "Fixed assets" header) at the top level, its own subaccounts with it, and list it (BS-format-2). Intuit's own journal sample (`journal.zip`, above) declares `Construction:Labor` without ever declaring `Construction`, so QuickBooks makes a missing parent itself; the books declare each parent before its subaccounts all the same, so a parent keeps its own type and number rather than taking ones QuickBooks guesses.
## Customer and vendor names on accounts receivable and payable
@@ -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, <https://quickbooks.intuit.com/learn-support/en-us/other-questions/iif-import-error-3040/00/535675>) 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, <https://hub.acctivate.com/articles/troubleshoot/synchronization/transaction-split-lines-to-accounts-receivable-must-include-a-customer-on-that-split-line>).
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 (rules.md B-34 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 rule 7).
## 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; rules.md B-34 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 rule 8).
## What QuickBooks does with an over-long name (not Intuit)
Source: Thomson Reuters, Accounting CS help, "Export payroll journal entries", <https://thomsonreuters.com/en-us/help/accounting-cs/integrate-data-with-other-applications/export-payroll-journal-entries>
@@ -221,7 +221,7 @@ Intuit's own journal sample (above) wraps fields holding a comma in double quote
> For imports, you will break the import if you have double quotes within your text
So the books write a double quote as a single one, listed like any other change (rules.md B-34).
So the books write a double quote as a single one, listed like any other change (BS-format-2).
## Not found in any Intuit source
@@ -230,7 +230,7 @@ Searched 2026-10-13 and 2026-10-20 (the help articles above and every document i
- an escaping mechanism for tabs, line breaks, or double quotes inside a field (no escape syntax is documented; the only safe reading is that fields must not contain tabs or line breaks, and, from the reports above, double quotes);
- an explicit sentence that a transaction's TRNS and SPL amounts must sum to zero (every example does; the sign rule implies it);
- the allowed number of decimal places, or whether thousands separators or currency symbols are accepted in AMOUNT;
- the character encoding beyond "ASCII text" (so the books write plain ASCII, transliterating anything else and listing what changed: rules.md B-34, DECISION D-36);
- the character encoding beyond "ASCII text" (so the books write plain ASCII, transliterating anything else and listing what changed: BS-format-2, DECISION D-36);
- whether a four-digit year is accepted everywhere despite the "MM/DD/YY" wording (Intuit's 2007+ example uses one);
- what QuickBooks Desktop does on import with an account name, account number or memo longer than its limits (only the non-Intuit note above, for names), how many levels of subaccounts it allows, or a limit on a whole NAME with its parents;
- how long a journal entry's number (DOCNUM) may be (the limits article has no row for it; the books' entry ids are a few digits);
+1 -1
View File
@@ -1,5 +1,5 @@
# Partners' capital accounts: what a member's money and property count as
Governs what a member's party totals count (rules.md B-35): a member's capital account rises by the money and the property (net of liabilities on it) the member contributes, and falls by the money and property distributed to them; a partnership liability the member pays for it is money the member contributed. The K-1's capital account analysis (Item L) reports the same contributions and distributions. wanderbooks counts these from the books as they are; the tax-basis figures stay with the CPA.
Governs what a member's party totals count (BS-partner-3): a member's capital account rises by the money and the property (net of liabilities on it) the member contributes, and falls by the money and property distributed to them; a partnership liability the member pays for it is money the member contributed. The K-1's capital account analysis (Item L) reports the same contributions and distributions. wanderbooks counts these from the books as they are; the tax-basis figures stay with the CPA.
## Treas. Reg. §1.704-1(b)(2)(iv)(b): basic rules of capital accounts
Source: <https://www.ecfr.gov/api/renderer/v1/content/enhanced/current/title-26?part=1&section=1.704-1>
+2 -2
View File
@@ -1,5 +1,5 @@
# Tax basis of fixed assets: cost, contributed property, and personal-use conversion
Governs the tax figures the fixed asset register carries beside book value (rules.md B-25): the §723 basis, the depreciable basis, and the §704(c) built-in gain or loss at contribution; and the property contributed at its adjusted basis on the K-1 worksheet's tax-basis capital (rules.md B-36). Property the partnership buys has a cost basis (IRC §1012); property a member contributes keeps the member's adjusted basis (IRC §723), and the difference from its fair market value is the built-in gain or loss that §704(c) makes the partnership account for; property a member converts from personal use has a depreciable basis of the lesser of fair market value and adjusted basis (Treas. Reg. §1.168(i)-4(b)(1)). wanderbooks records the basis; tax depreciation (MACRS, conventions, elections) stays with the CPA.
Governs the tax figures the fixed asset register carries beside book value (BS-asset-4): the §723 basis, the depreciable basis, and the §704(c) built-in gain or loss at contribution; and the property contributed at its adjusted basis on the K-1 worksheet's tax-basis capital (BS-partner-4). Property the partnership buys has a cost basis (IRC §1012); property a member contributes keeps the member's adjusted basis (IRC §723), and the difference from its fair market value is the built-in gain or loss that §704(c) makes the partnership account for; property a member converts from personal use has a depreciable basis of the lesser of fair market value and adjusted basis (Treas. Reg. §1.168(i)-4(b)(1)). wanderbooks records the basis; tax depreciation (MACRS, conventions, elections) stays with the CPA.
## 26 U.S.C. §1012(a): basis is cost
Source: <https://www.law.cornell.edu/uscode/text/26/1012>
@@ -99,6 +99,6 @@ SHA-256 of the retrieved file (`p946.html`): `bcc1d04f59bbfc4e74181831c112745e62
> - Increased by the cost of any permanent improvements or additions and other costs that must be added to basis.
> - Decreased by any deductions you claimed for casualty and theft losses and other items that reduced your basis.
**Placed in Service** (for tax depreciation, the CPA's; the book in-service date rests on ASC 360-10-35-4, rules.md B-15)
**Placed in Service** (for tax depreciation, the CPA's; the book in-service date rests on ASC 360-10-35-4, BS-asset-1)
> You place property in service when it is ready and available for a specific use, whether in a business activity, an income-producing activity, a tax-exempt activity, or a personal activity. Even if you are not using the property, it is in service when it is ready and available for its specific use.
+2 -2
View File
@@ -1,5 +1,5 @@
# Partnerships: shares of income and capital accounts
Governs `CloseTo::Members`, the members' equity statement, and the K-1 worksheet's capital accounts on the tax basis (rules.md B-13; `ledger_core::tax_capital`, rules.md B-36). Partners' shares come from the partnership agreement (IRC §704(a)); a partner's capital account is one running balance of what they contributed, their allocations of income and loss, and what was distributed to them (Treas. Reg. §1.704-1(b)(2)(iv)(b)); when a partner's interest changes during the year, the distributive shares take the varying interests into account, period by period (IRC §706(d)(1), Treas. Reg. §1.706-4(a)); Form 1065 reports each partner's capital account on the tax basis (Schedule K-1 item L) and the changes in them (Schedule M-2). No authority prescribes how to round a share to the cent: that rule is the owner's decision (largest remainder, 2026-10-13), counted from the company's first close (D-10, 2026-10-16).
Governs `CloseTo::Members`, the members' equity statement, and the K-1 worksheet's capital accounts on the tax basis (BS-partner-1; `ledger_core::tax_capital`, BS-partner-4). Partners' shares come from the partnership agreement (IRC §704(a)); a partner's capital account is one running balance of what they contributed, their allocations of income and loss, and what was distributed to them (Treas. Reg. §1.704-1(b)(2)(iv)(b)); when a partner's interest changes during the year, the distributive shares take the varying interests into account, period by period (IRC §706(d)(1), Treas. Reg. §1.706-4(a)); Form 1065 reports each partner's capital account on the tax basis (Schedule K-1 item L) and the changes in them (Schedule M-2). No authority prescribes how to round a share to the cent: that rule is the owner's decision (largest remainder, 2026-10-13), counted from the company's first close (D-10, 2026-10-16).
## 26 U.S.C. §704(a)-(b)
Source: <https://www.law.cornell.edu/uscode/text/26/704>
@@ -64,7 +64,7 @@ SHA-256 of the retrieved file (`i1065sk1.html`): `d7d6298286601fd95ab8e445c10fd6
own hash: `irs-capital-accounts.md` quotes another retrieval of the same day. A re-fetch on
2026-10-21 hashed differently again; the quoted text was checked present.)
**Item L, its first paragraph** (the partner's capital account, on the tax basis; the K-1 worksheet carries the book capital account and, beside it, the tax-basis one as far as the books know it, rules.md B-36)
**Item L, its first paragraph** (the partner's capital account, on the tax basis; the K-1 worksheet carries the book capital account and, beside it, the tax-basis one as far as the books know it, BS-partner-4)
> The partnership must report your beginning capital account and ending capital account for the year using the tax-basis method, including the amount of capital you contributed to the partnership during the year, your share of the partnership’s current-year net income or loss as computed for tax purposes, any withdrawals and distributions made to you by the partnership, and any other increases or decreases to your capital account determined in a manner generally consistent with figuring the partner’s adjusted tax basis in its partnership interest (without regard to partnership liabilities), taking into account the rules and principles of sections 705, 722, 733, and 742. See the Instructions for Form 1065 for more details.
+1 -1
View File
@@ -1,7 +1,7 @@
# ISO 4217: currency minor units
Governs `Currency::minor_units`, which sets the smallest unit a ledger
books in (rules.md B-3): foreign-currency lines are rounded to it.
books in (BS-ledger-1): foreign-currency lines are rounded to it.
Source: ISO 4217 "list one" (current currency & funds), published
2026-09-17 by SIX Financial Information, the ISO 4217 maintenance agency.
+2 -2
View File
@@ -1,6 +1,6 @@
# Unicode character properties: how a TIN can be written
Governs `ledger_core::parties::has_full_tin` (rules.md B-26): which
Governs `ledger_core::parties::has_full_tin` (BS-partner-2): which
characters separate a TIN's digits, and which are invisible between them.
The Unicode Character Database is © Unicode, Inc., under the Unicode
License v3, which permits copying the data files; the code point lists
@@ -53,7 +53,7 @@ form is one of the ASCII separators.
- `'/'`: U+FF0F FULLWIDTH SOLIDUS.
- `'_'`: U+FE33, U+FE34, U+FE4D..U+FE4F, U+FF3F FULLWIDTH LOW LINE.
## How the books read them (rules.md B-26)
## How the books read them (BS-partner-2)
A TIN is nine numerals (any script's: `char::is_numeric`) with at most
three separators between neighbors. In ASCII the separators are exactly
+74 -77
View File
@@ -59,21 +59,21 @@ that would fail if it broke:
| Law | Test |
|---|---|
| Books from a newer wanderbooks are "newer", never "corrupt", from the writer, the viewer and the server; damage stays corruption (rules.md B-27) | `ledger-store` `tests/format.rs` (`old_reader_gets_newer_journal`, `damaged_journals_are_still_corrupt`); `ledger-gui` `tests/newer_journal.rs`; `ledger-cli` `tests/startup.rs` |
| Books from a newer wanderbooks are "newer", never "corrupt", from the writer, the viewer and the server; damage stays corruption (BS-format-1) | `ledger-store` `tests/format.rs` (`old_reader_gets_newer_journal`, `damaged_journals_are_still_corrupt`); `ledger-gui` `tests/newer_journal.rs`; `ledger-cli` `tests/startup.rs` |
| A line the gate refuses is called newer only once the next line's `prev` checks its hash; a last line is "newer or damaged" | `a_damaged_line_that_looks_newer_is_corrupt_when_the_next_line_checks_it`, `an_unreadable_last_line_is_reported_as_newer_or_damaged`, `a_newer_line_the_next_line_chains_onto_is_newer_and_intact` (the message vouches for that line only) |
| The envelope and its hash are frozen across formats: a next line in a newer format (a float, a string seq, keys of its own) settles by its `prev` alone, never as corrupt; a key beside the envelope is newer, never dropped, and still checked through; a refused line followed by an unreadable one is "newer or damaged" | `format.rs` `a_newer_format_frames_its_lines_its_own_way`, `an_unknown_envelope_key_is_newer_and_checked_through`, `a_refused_line_followed_by_a_garbled_line_is_unverified` |
| The writer and the viewer read bytes alike: a line that isn't UTF-8 is corrupt to both; an older version never repairs (truncates) newer books | `a_line_that_is_not_utf8_is_corrupt_for_the_viewer_and_the_writer`, `an_old_reader_never_repairs_newer_books` |
| A newer format is newer whatever its features look like; a blank line is damage to the viewer as to the writer | `format.rs` `a_newer_format_is_newer_whatever_its_features_look_like`; `a_blank_line_is_corrupt_for_the_viewer_and_the_writer` |
| A request that panics stops the server: every later request, on every session, is refused | `server.rs` `a_request_that_panics_stops_the_server` |
| No input reaches a panic (each would stop the server for every session): every tool with arguments generated from its schema and made hostile (wrong types, u64::MAX, decimals of 30+ digits or absurd exponents, dates like 0000-00-00, 99999-12-31, +262142-12-31, 2026-02-30, periods like 999999-01, control and format characters, long strings), every resource URI generated; the inputs that once panicked, pinned; after each property the server restarts and the books reopen (a call a command accepts but replay refuses would brick them); every tool and resource over every old book (rules.md B-28) | `ledger-cli` `tests/hostile_args.rs` `hostile_tool_arguments_never_stop_the_server` (with a floor: most calls reach a tool, some succeed), `hostile_resource_uris_never_stop_the_server`, `inputs_that_once_panicked_are_refused_or_answered`, `old_books_answer_every_tool`; `MCP_CASES` and `OLD_BOOKS_CASES` (default 3 per tool per book) set the cases |
| Dates are in 0001-01-01 through 9999-12-31 and amounts at most a line's, for every new command; replay accepts every line an earlier version accepted (each bound has its pair: the command refuses past it, the replayed old line is accepted); a figure derived past exact arithmetic or chrono's calendar is refused, never a panic; a recurring run makes at most 1,000 drafts (rules.md B-28) | `ledger-core` `tests/spec_bounds.rs`, `calendar.rs` tests, `plans_at_the_edges_are_computed_or_refused`, `intervals_reach_chronos_last_day`, `a_vendor_part_is_scaled_exactly_or_refused`, the `share_property` cases; `ledger-store` `tests/bounds.rs`, `tests/store.rs` (the old-books tests); `server.rs` `periods_are_a_year_and_a_month`, `dates_are_four_digit_years_and_real_days` |
| Opening the books changes nothing until every complete line passes in memory (chain, gate, first line, replay); the viewer applies the writer's first-line rule (rules.md B-27) | `format.rs` `a_bad_complete_line_before_a_torn_tail_leaves_the_journal_as_it_was`, `the_first_line_is_store_created_for_the_viewer_and_the_writer`; `fuzz_store_replay` (the first line varies) |
| No input reaches a panic (each would stop the server for every session): every tool with arguments generated from its schema and made hostile (wrong types, u64::MAX, decimals of 30+ digits or absurd exponents, dates like 0000-00-00, 99999-12-31, +262142-12-31, 2026-02-30, periods like 999999-01, control and format characters, long strings), every resource URI generated; the inputs that once panicked, pinned; after each property the server restarts and the books reopen (a call a command accepts but replay refuses would brick them); every tool and resource over every old book (BS-entry-4) | `ledger-cli` `tests/hostile_args.rs` `hostile_tool_arguments_never_stop_the_server` (with a floor: most calls reach a tool, some succeed), `hostile_resource_uris_never_stop_the_server`, `inputs_that_once_panicked_are_refused_or_answered`, `old_books_answer_every_tool`; `MCP_CASES` and `OLD_BOOKS_CASES` (default 3 per tool per book) set the cases |
| Dates are in 0001-01-01 through 9999-12-31 and amounts at most a line's, for every new command; replay accepts every line an earlier version accepted (each bound has its pair: the command refuses past it, the replayed old line is accepted); a figure derived past exact arithmetic or chrono's calendar is refused, never a panic; a recurring run makes at most 1,000 drafts (BS-entry-4) | `ledger-core` `tests/spec_bounds.rs`, `calendar.rs` tests, `plans_at_the_edges_are_computed_or_refused`, `intervals_reach_chronos_last_day`, `a_vendor_part_is_scaled_exactly_or_refused`, the `share_property` cases; `ledger-store` `tests/bounds.rs`, `tests/store.rs` (the old-books tests); `server.rs` `periods_are_a_year_and_a_month`, `dates_are_four_digit_years_and_real_days` |
| Opening the books changes nothing until every complete line passes in memory (chain, gate, first line, replay); the viewer applies the writer's first-line rule (BS-format-1) | `format.rs` `a_bad_complete_line_before_a_torn_tail_leaves_the_journal_as_it_was`, `the_first_line_is_store_created_for_the_viewer_and_the_writer`; `fuzz_store_replay` (the first line varies) |
| UTF-16 text without a byte-order mark is scanned like any text; a refused `books.set_w9` marks no file; a refused resource read never echoes a TIN | `tin_files.rs` (tests) `utf16_text_without_a_byte_order_mark_is_scanned_either_way_round`, `a_refused_set_w9_never_marks_its_file`, unit test `only_nul_interleaved_bytes_read_as_utf16_without_a_mark`; `spec_vault.rs` `resource_refusals_never_echo_a_tin` |
| idempotentHint only where a repeat with the same arguments leaves the journal and the vault as they were; every tool's hints pinned in one table | `spec_vault.rs` `idempotent_tools_change_nothing_when_repeated`; `annotations_complete` |
| books.settings lists every receipt-required and exempt account, uncut; a fresh company is "a new company"; the lint catches `just` however it ends and where the books are | `mcp_journeys.rs` `every_receipt_account_left_out_of_the_connect_text_is_in_books_settings`; `handbook.rs` `a_fresh_company_is_a_new_company`; `tool_text_lint_catches_helpers_and_locations` |
| A file with full TINs is never written to a path (handed over instead, D-29), and never filed into the books: every file the server read or wrote with TINs (from any session, after a restart, out of a CPA package), by every filing tool | `mcp_journeys.rs` `tin_bearing_files_are_refused_when_given_back_to_be_filed`; `spec_vault.rs` `a_package_is_handed_over_and_never_written`; `tin_files.rs` (tests) `a_tin_bearing_file_is_refused_from_every_session_and_after_a_restart`; unit test `a_recorded_tin_file_is_refused_by_every_reader_of_the_registry` |
| Text filed into the books is refused when it holds a TIN the vault keeps (nine digits, 3-2-4 by hyphen, space or dot, 2-7 by hyphen or space, anywhere) or a stand-alone printed SSN or EIN (123-45-6789, 12-3456789), and only then: a bank export (routing numbers, long references, a date next to an amount) and a longer number holding an SSN shape go in; a locked vault leaves the printed shapes (rules.md B-26) | `tin_files.rs` (tests) `text_with_a_vault_tin_or_a_printed_one_is_refused_and_a_bank_export_is_not`; unit tests `text_holding_a_vault_tin_is_refused_in_every_rendering`, `a_printed_ssn_or_ein_is_refused`, `a_longer_number_holding_a_tin_shape_passes`, `an_ordinary_bank_export_passes`, `binary_bytes_are_not_scanned` |
| Filing is no TIN oracle: text with more than two TIN-shaped numbers ending in a known TIN's last four (the books' TIN and W-9 facts, then the vault's own) is refused before the vault is opened, byte for byte alike whether one is the vault's TIN or none is, the vault open or locked, by every filing tool; one or two such numbers are compared against the vault, one number written many ways counts once, and other last fours never count (rules.md B-26) | `tin_files.rs` (tests) `text_probing_for_a_tin_is_refused_alike_by_every_filing_tool`; unit tests `text_probing_for_a_tin_is_refused_alike_whether_or_not_it_holds_it` (the vault never opened for a probe), `one_or_two_candidates_are_compared_against_the_vault` |
| Text filed into the books is refused when it holds a TIN the vault keeps (nine digits, 3-2-4 by hyphen, space or dot, 2-7 by hyphen or space, anywhere) or a stand-alone printed SSN or EIN (123-45-6789, 12-3456789), and only then: a bank export (routing numbers, long references, a date next to an amount) and a longer number holding an SSN shape go in; a locked vault leaves the printed shapes (BS-partner-2) | `tin_files.rs` (tests) `text_with_a_vault_tin_or_a_printed_one_is_refused_and_a_bank_export_is_not`; unit tests `text_holding_a_vault_tin_is_refused_in_every_rendering`, `a_printed_ssn_or_ein_is_refused`, `a_longer_number_holding_a_tin_shape_passes`, `an_ordinary_bank_export_passes`, `binary_bytes_are_not_scanned` |
| Filing is no TIN oracle: text with more than two TIN-shaped numbers ending in a known TIN's last four (the books' TIN and W-9 facts, then the vault's own) is refused before the vault is opened, byte for byte alike whether one is the vault's TIN or none is, the vault open or locked, by every filing tool; one or two such numbers are compared against the vault, one number written many ways counts once, and other last fours never count (BS-partner-2) | `tin_files.rs` (tests) `text_probing_for_a_tin_is_refused_alike_by_every_filing_tool`; unit tests `text_probing_for_a_tin_is_refused_alike_whether_or_not_it_holds_it` (the vault never opened for a probe), `one_or_two_candidates_are_compared_against_the_vault` |
| The connect text fits its budgets, its lead stands alone, it states the receipt rule enforced (exact threshold in the base currency, required and exempt accounts, reversals) and the parties rule in force, and the company name can't break it (control and format characters) | `handbook.rs` `instructions_budget`, `a_typical_company_gets_the_whole_connect_text`, `the_company_name_is_one_plain_line`; `receipt_policy.rs` `the_rule_told_is_the_rule_enforced`, `a_long_or_odd_account_list_stays_short_and_plain`; a new session is told the settings in force: `a_new_session_is_told_the_settings_in_force` |
| No text the agent is given (whole tool JSON, resources, connect text, handbook, every error template and refusal) points at files, git, GitHub, repo docs, flags or helper commands; descriptions fit 700 characters (listed exceptions, P5; and what git itself said of a failed backup, which `books.backup` passes on to the human as git said it, its paths hidden) | `tool_text_lint`, `tool_descriptions_fit_700_characters`; `ledger-core` `an_unknown_year_threshold_is_never_guessed` |
| Every tool is annotated (openWorldHint false on all but `books.back_up_now`), and the read-only hint is true in behaviour (journal, every file of the books' folder but what every call writes by design: the access log, `ops/` (the viewer's side channel for `books.show`, which is not the books), the books' own backup and the files handed over; the database's rows and the vault unchanged) | `annotations_complete`; `spec_mcp.rs` `read_only_tools_change_nothing` (checked on every call in `Mcp::tool`) |
@@ -96,7 +96,7 @@ viewer against its lib tests and `newer_journal`). Final run:
| `ledger-core` | 1 | 1 | 0 | 0 | 0 |
(`ledger-cli`'s change makes no mutant.) After the filing scan's probe
bound (rules.md B-26), `tin_files.rs` alone was run again against the
bound (BS-partner-2), `tin_files.rs` alone was run again against the
whole P0 diff: 74 mutants, 74 caught, among them every mutant of the
bound (`probes` made true or false, `>` made `>=`, `==` or `<`, the
last four's `%` made `/` or `+`, here and for the vault's own last
@@ -628,7 +628,7 @@ are kept with the run's output, outside the repository.
## P3: odd cents (2026-10-20)
Defect 17 (rules.md B-13; D-10, D-38), built without its mutation run
Defect 17 (BS-partner-1; D-10, D-38), built without its mutation run
(D-33); what P12 must cover is listed at the end. Every expected figure is
worked by hand in the test's comment.
@@ -737,7 +737,7 @@ pass.
## P3: the IIF and as-of (2026-10-20)
Defects 7 and 21 (plan P3; the owner's decisions D-36). Rules
`docs/spec/rules.md` B-33 (a package as of a day) and B-34 (the IIF). No
BS-statement-4 (a package as of a day) and BS-format-2 (the IIF). No
mutation run (D-33): what P12 must cover is at the end.
**Named regression tests**, each from its reproduction, on anonymized
@@ -877,7 +877,7 @@ each name; with `SHOT_DIR` set, it saves `scripts.png`: looked at,
and Hebrew, but doesn't reorder the words of a right-to-left phrase:
"مكتب الرياض" shows its two words left to right.
**TINs in any script (B-26).** `ledger_core::parties::has_full_tin`
**TINs in any script (BS-partner-2).** `ledger_core::parties::has_full_tin`
missed "123-45-6789": the fullwidth hyphen-minus, the ideographic
and thin spaces, the Hebrew maqaf and the other Unicode dashes weren't
separators, and a zero-width space or a right-to-left mark between digits
@@ -942,8 +942,7 @@ doesn't count them.
## P3: cash flow (defect 1, 2026-10-20)
The statement of cash flows was rebuilt by the direct method (rules.md
B-14, D-35), and what a member or a lender pays for the company shown as
The statement of cash flows was rebuilt by the direct method (BS-statement-3, D-35), and what a member or a lender pays for the company shown as
cash borrowed and spent (D-42, rule 11). Built, reviewed twice, `just
check` and `just prove`; no mutation run (D-33): what P12 must cover is at
the end.
@@ -1089,7 +1088,7 @@ in `take` where both bounds coincide, and the kind order's tie-breaks.
## P3: rename, defaults and tax categories (2026-10-20)
Defects 15, 16 and 8 (`plan/served.md` P3; rules.md B-30, B-31, B-32).
Defects 15, 16 and 8 (`plan/served.md` P3; BS-period-3, BS-ledger-10, BS-ledger-11).
Every fixture is fictional (Fernhill Labs LLC, its members and vendors);
no mutation run (D-33): the targets are listed for P12 below.
@@ -1132,7 +1131,7 @@ no mutation run (D-33): the targets are listed for P12 below.
(every figure, entry and earlier journal line, every projection row but
`accounts.name`; refusals append nothing; reopen, rebuild and viewer),
`a_journaled_rename_replays_past_the_command_rules` and
`a_journaled_clear_replays_under_refuse` (B-28's pairs, review R5),
`a_journaled_clear_replays_under_refuse` (BS-entry-4's pairs, review R5),
`the_tax_category_policy_refuses_only_what_it_says`,
`books_written_under_p3_keep_their_names` (fixture `old-books/p3_rename`,
written once by `write_p3_rename_fixture`, `--ignored`; its figures are
@@ -1220,7 +1219,7 @@ cash flow statement:
fiscal year.
- `ledger-core` `tests/bookspec/`: the three examples are in the
loader's one shape, and the loader gained what they need (bookspec
`README.md`): `setup.today` and omitted dates resolved by B-30,
`README.md`): `setup.today` and omitted dates resolved by BS-period-3,
`header` and `tax_category` on an account, a `bill` event, `[[changes]]`
(a rename, the policy) made after an event's expectations, the queries
`period`, `day`, `calendar_year`, `account_names` and
@@ -1240,7 +1239,7 @@ cash flow statement:
`iif_writes_plain_ascii_and_lists_every_change`,
`iif_warnings_never_hold_a_tin`) make their siblings of one name, names
with a tab and names holding a TIN by replay (`replay_add_account`), as
books written before P3 hold them: B-31 refuses them in a new name, and
books written before P3 hold them: BS-ledger-10 refuses them in a new name, and
the file must still keep them apart, write them on one line and mask
them.
- `books.cash_flow`'s description is the direct method's, shortened to
@@ -1281,26 +1280,26 @@ A party's part of an entry is signed as a line on its own account, with a
direction and its money and property; party totals take a basis; money is
cash, cards and the financing accounts; a credit to a liability a party is
owed itself never pays it; the directory's TIN last four comes from TIN or
W-9 facts (rules.md B-35, B-26). Built, reviewed and checked under D-33:
W-9 facts (BS-partner-3, BS-partner-2). Built, reviewed and checked under D-33:
no mutation run here; what P12 must cover is at the end.
| What | Where | Oracle |
|---|---|---|
| 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` | B-35, by hand |
| 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` | B-9 |
| Accruals through another liability count once (defect 24) | `defect24_an_accrual_through_another_liability_counts_once` | B-35 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` | B-35 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) | B-35 items 3, 5; B-26 |
| 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 |
| 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 |
| Properties: a reversal's target, parts and flow are the original's negated; parts sum to the target, each with its sign; a sole party's money part is the flow as before P3; tin_last4 is every source present | `a_reversal_is_the_exact_opposite`, `a_sole_partys_money_part_is_the_flow_as_before`, `tin_last4_is_every_source_present` (`PROPTEST_CASES`, default 256; 5,000 run clean) | B-35, B-9 |
| Properties: a reversal's target, parts and flow are the original's negated; parts sum to the target, each with its sign; a sole party's money part is the flow as before P3; tin_last4 is every source present | `a_reversal_is_the_exact_opposite`, `a_sole_partys_money_part_is_the_flow_as_before`, `tin_last4_is_every_source_present` (`PROPTEST_CASES`, default 256; 5,000 run clean) | BS-partner-3, BS-ledger-5 |
| Decimal and i64 agree on party_target and reverse_target | `kernel_bridge/` `party_target_agrees` | the bridge |
| Kani: the direction is the sign, the target is odd, reverse_target an involution | `proofs/` `party_target_direction_is_its_sign`, `party_target_is_odd`, `reverse_target_is_an_involution` | the kernel spec |
| The journal: party.creditor_set one line each, under the feature the books declared when created; in books an older version wrote, refused (FormatUpgradePending, nothing journaled) until the format upgrade; refusals journal nothing; books without creditors never change, in either format; corrupt lines refused | `ledger-store/tests/party_creditors.rs` | the format gate |
| Over the MCP: get_entry's direction, cash, in_kind; party totals by basis, echoed, others refused; basis all equals members' equity; creditor_of round trips and a card fee isn't a payment; the post_entry preview's parts are what it posts | `ledger-cli/tests/spec_party_totals.rs` | the tool docs |
| Defect 11 over the MCP: a member's TIN last four in the directory, a W-9's, none, after a purge | `ledger-cli/tests/spec_vault.rs` `defect11_the_directory_shows_a_members_tin_last4` | B-26 |
| Defect 11 over the MCP: a member's TIN last four in the directory, a W-9's, none, after a purge | `ledger-cli/tests/spec_vault.rs` `defect11_the_directory_shows_a_members_tin_last4` | BS-partner-2 |
| The viewer shows the tools' numbers, labelled cash basis, with the in-kind line; its what-for reads a reversal as `parties::flow` does | `ledger-gui/tests/parties.rs` `the_party_page_shows_the_basis_and_in_kind`, `a_reversed_member_card_payment_is_nothing_on_the_issuers_page` | `activity_with`, `flow` |
| bookspec | `bookspec/examples/p3-party-*.toml` | the same cases, by hand |
@@ -1330,10 +1329,10 @@ never disagree, parties INVARIANT 2a, enforced on replay).
The 1099 decision kept as a decision (nec, misc, not_reportable with its
reason kind and words, undetermined), with who decided and the date it
takes effect (D-40); payment methods and the tag on each payment; one
report for the server, the package and the viewer (rules.md B-19). No
report for the server, the package and the viewer (BS-1099-1). No
mutation run (D-33); the list P12 must cover is at the end.
| Law (rules.md B-19) | Tests |
| Law (BS-1099-1) | Tests |
|---|---|
| Undecided is not "not reportable" (defect 18) | `undecided_is_not_not_reportable` |
| "No 1099" is a decision with who and when; "none" refused (defect 23) | `a_vendor_marked_no_1099_is_not_undecided`, `the_cutovers_reasons_are_recorded_as_given`, `set_vendor_1099_says_what_a_decision_needs` (`ledger-cli` `spec_1099.rs`) |
@@ -1393,11 +1392,11 @@ 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` | B-35 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) | B-35 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` | B-35 item 9; 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` | B-33; 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` | B-27 |
| 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) |
| 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 |
**For P12 (mutation targets, none run, D-33):** `parties::card_accounts`
@@ -1411,8 +1410,7 @@ method setup.
## P3: depreciation and schedules (defects 22 and 9, 2026-10-20)
Every expected figure below was worked by hand from the rule (rules.md
B-15, B-16) and is written out in the test's doc comment; the fixtures are
Every expected figure below was worked by hand from the rule (BS-asset-1, BS-prepaid-1) and is written out in the test's doc comment; the fixtures are
made up (asset X: 12,000.00 over 12 months from 2026-01-01; a 1,200.00
policy from March 15). Each regression that is an accounting rule is also
a bookspec example (`bookspec/examples/`, P13, D-34).
@@ -1448,7 +1446,7 @@ a bookspec example (`bookspec/examples/`, P13, D-34).
| Every order of runs, reversals (any day, before an entry's own included), re-runs, re-instatements, disposals and closes on one asset keeps the books right: refusals journal nothing; at every month end before the disposal the expense is the accumulated depreciation and within the schedule; one run in effect per month; a disposal's month and the end at the schedule through its day, accumulated 0.00, the gain proceeds less book value; an active asset run month by month past its life takes exactly cost less salvage (P3 review round 2) | store `asset_orders.rs` `every_order_of_runs_reversals_disposals_and_closes_keeps_the_books_right` (exhaustive, three commands deep; four and five with `WB_ORDERS_DEPTH`, run clean 2026-10-21), `prop_any_sequence_keeps_the_books_right` (64 cases, up to 9 commands, any day) |
| The viewer reads an asset as the store does, whatever the runs, reversals and disposals: what the books carry, each finished month's status against a run of it, what is unposted (P3 review round 2) | GUI `prop_the_viewer_reads_an_asset_as_the_store_does` (48 cases), `the_viewer_counts_a_run_reinstated_after_its_rerun_was_reversed` |
| A run re-instated after its month was run again and that run reversed still counts: in the store, the disposal and the viewer (P3 review round 2; before, the projection's row named the reversed re-run) | store `a_run_reinstated_after_its_rerun_was_reversed_still_counts`; GUI `the_viewer_counts_a_run_reinstated_after_its_rerun_was_reversed` |
| Every reversal is dated on or after its original, any kind of entry (D-73); a journal holding an earlier-dated one still opens with the same figures (B-28): store `reversal_dates.rs` `a_plain_entrys_reversal_is_not_dated_before_it`, `a_journal_with_an_earlier_dated_reversal_opens_as_it_was` |
| Every reversal is dated on or after its original, any kind of entry (D-73); a journal holding an earlier-dated one still opens with the same figures (BS-entry-4): store `reversal_dates.rs` `a_plain_entrys_reversal_is_not_dated_before_it`, `a_journal_with_an_earlier_dated_reversal_opens_as_it_was` |
| A depreciation run's or schedule month's reversal can't be dated before the entry it reverses (P3 review round 2: a run of March reversed on Jan 31, then a disposal on Feb 15, ended February with a 1,000.00 debit in accumulated depreciation) | store `a_reversal_dated_before_the_entry_it_reverses_is_refused` |
| A disposal waits only until what the runs carry at its month's end is what they carry now, so a late change undone after its month closed lets it through (P3 review round 2; round 1 refused it for ever) | store `a_disposal_is_taken_once_a_late_change_is_undone_after_its_month_closed` |
| Depreciation still due when the disposal's month has a run is charged in the disposal entry, never as a second run of the month (P3 review round 2; no store test held it) | store `a_disposal_whose_month_has_run_charges_what_is_still_due_in_its_entry` |
@@ -1496,7 +1494,7 @@ none (`r >= step - r` against `>` is killed by `half_a_unit_rounds_up`).
D-39 and plan/served.md 3.9 (`format_upgrade_pending`): books an older
wanderbooks wrote wait for the owner's go-ahead before they move to this
version's journal format (rules.md B-27). Mutation testing waits for P12
version's journal format (BS-format-1). Mutation testing waits for P12
(D-33); the targets are listed at the end.
- `ledger-store` `format.rs` unit tests: this version's format is the
@@ -1629,7 +1627,7 @@ basis. Mutation runs wait for P12 (D-33); none was run.
note; the gain property's disposal flagged with its built-in gain),
property subject to a liability (negative tax property), and three
members with unequal shares, one contributing nothing; and, from the
owner's ask of 2026-10-22 (B-36 with D-38), three odd-cent devices
owner's ask of 2026-10-22 (BS-partner-4 with D-38), three odd-cent devices
contributed 50/50 whose built-in loss runs cumulatively, a cent apart
for the year and from June on a beginning carried from January
(`tied_odd_cents_of_property_basis_run_cumulatively`; it fails with
@@ -1745,13 +1743,13 @@ rules.md says why not. Mutation runs wait for P12 (D-33).
- **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, B-35 items 4 and 8),
advances and distributions, BS-partner-3 items 4 and 8),
`a_distribution_declared_then_paid_is_financing_when_paid`,
`the_1099_worksheet_ties_to_party_totals_and_the_ledger` (B-35 item 9,
B-19), `depreciation_is_one_figure_everywhere` (the P&L, the cash flow
`the_1099_worksheet_ties_to_party_totals_and_the_ledger` (BS-partner-3 item 9,
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`,
`the_cpa_package_as_of_each_date_is_the_tools_figures` (B-33).
`the_cpa_package_as_of_each_date_is_the_tools_figures` (BS-statement-4).
- **Viewer** (`ledger-gui/tests/p3_seams.rs`): its capital statements,
party money, cash flow, register and 1099 worksheet, read from the
books' folder and settings file as it opens them, are the engine's.
@@ -1761,14 +1759,14 @@ rules.md says why not. Mutation runs wait for P12 (D-33).
`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
(B-14 rule 2; `a_distribution_declared_then_paid_is_a_distribution_paid`
(BS-statement-3 rule 2; `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 (B-14 rule 8;
loss, not its depreciation (BS-statement-3 rule 8;
`a_disposals_depreciation_credit_back_is_depreciation`), and the
tax-basis K-1's book depreciation left it out (B-36); `books.list_assets`
as of a day said "disposed" for a later disposal (B-15 rule 8).
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).
## P3: the surface review (2026-10-21)
@@ -1838,7 +1836,7 @@ The earlier P3 sections' lists stand (one name corrected:
The owner's ask: "a Projects page that treats a class as a project ...
Projects are entities too", a company rule to link things to projects
(the convention `link-to-projects`), and the sidebar's links drawn under
the status box in a short window (rules.md B-37). Mutation runs wait for
the status box in a short window (BS-statement-5). Mutation runs wait for
P12 (D-33); none was run.
- **ledger-core:** `tests/spec_projects.rs`
@@ -1977,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 (rules.md B-37 item 7: contribution before
black or the red, with charts (BS-statement-5 item 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,
@@ -2046,7 +2044,7 @@ fail.
`the_running_net_is_each_months_net_to_date` (sweeping the pointer over
the bars and over the net's own strip shows each month's
`months_net_to_date`, in order),
`the_fiscal_year_switch_shows_the_default_period` (B-30's omitted dates,
`the_fiscal_year_switch_shows_the_default_period` (BS-period-3's omitted dates,
as `books.project`, with fiscal-year costs unlike to date's; the pill
stays to date; switching writes nothing to the journal),
`a_fiscal_year_with_nothing_says_so`,
@@ -2087,11 +2085,11 @@ rounding strategy; `project_figures`' opening net and running sum;
## Invoices and bills take a project (2026-10-22)
rules.md B-37 item 8: each invoice and bill line takes an optional project
BS-statement-5 item 8: 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
`class_id` behind the new feature `document_line_projects` (B-27).
`class_id` behind the new feature `document_line_projects` (BS-format-1).
- **ledger-core:** `tests/spec_document_projects.rs`
(`an_invoices_revenue_is_one_line_per_project_and_the_receivable_none`,
@@ -2203,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** (rules.md B-34 rule 8): `ledger-import`
**Point 1, the IIF's classes** (BS-format-2 rule 8): `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
@@ -2236,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** (rules.md B-14 rule 5): `ledger-core`
**Point 2, payments to governments** (BS-statement-3 rule 5): `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
@@ -2525,22 +2523,21 @@ accounting question), CHANGE (a source says otherwise; work pending).
| 1 | A P&L whose start is after its end is refused | DESIGN | No standard governs a reversed range; refusing beats silently swapping a typo |
| 2 | A balance sheet omits zero-balance accounts | CONFIRMED | Reg. S-X 210.4-03(a): "No caption should be shown ... as to which the items and conditions are not present." A comparative statement must still show a zero beside a non-zero prior column |
| 3 | The lifetime `profit_and_loss` counts closing entries | CONFIRMED | Used as earnings not yet closed on the balance sheet; closed income is already in capital (OpenStax Principles of Financial Accounting 5.1). Renamed `unclosed_earnings` (2026-10-14) |
| 4 | Closing a period with nothing to close still locks it | CONVENTION | A close is a lock (B-12); a dormant month must still lock and count for close-in-order |
| 4 | Closing a period with nothing to close still locks it | CONVENTION | A close is a lock (BS-period-2); a dormant month must still lock and count for close-in-order |
| 5 | Draws and distributions are closed into capital at period end | CONFIRMED | OpenStax 5.1: dividends "are closed to the permanent account"; drawing accounts close to owner's capital. Monthly closes mean the year's K-1 Item L withdrawals sum across months |
| 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`); rules.md B-13 |
| 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` (rules.md B-14) |
| 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). rules.md B-14 rule 11, P3 defect 1 |
| 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 |
| 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 |
| 12 | Each close into members' capital rounds on its own (ties to the earlier member) | CHANGED 2026-10-13; CHANGED P3 | Twelve monthly 50/50 closes could leave one member several cents ahead. A run of members closes split cumulatively from 2026-10-13 (Lean `runPart_telescopes`; property `each_member_stays_within_a_cent_of_their_share` fails on the per-close rule), but any other close restarted the run. Since P3 a count of members closes runs from the company's first close (D-10), skipping closes to anything else and ignoring the members' order, so no member is ever a cent from their share (`the_audit_odd_cent_never_piles_up_across_closes` fails on the run rule; Kani `cumulative_close_never_drifts_a_unit_at_*`, Lean `allocW_cumulative_drift`); journaled `"cumulative_since"`, older closes replay as booked (rules.md B-13) |
| 12 | Each close into members' capital rounds on its own (ties to the earlier member) | CHANGED 2026-10-13; CHANGED P3 | Twelve monthly 50/50 closes could leave one member several cents ahead. A run of members closes split cumulatively from 2026-10-13 (Lean `runPart_telescopes`; property `each_member_stays_within_a_cent_of_their_share` fails on the per-close rule), but any other close restarted the run. Since P3 a count of members closes runs from the company's first close (D-10), skipping closes to anything else and ignoring the members' order, so no member is ever a cent from their share (`the_audit_odd_cent_never_piles_up_across_closes` fails on the run rule; Kani `cumulative_close_never_drifts_a_unit_at_*`, Lean `allocW_cumulative_drift`); journaled `"cumulative_since"`, older closes replay as booked (BS-partner-1) |
Questions are settled from the sources, not by any one company's CPA
(wanderbooks is general software). Where the standards leave a real
choice, it is a per-company setting with a sourced default, for that
company's accountant to review: the cash flow account roles (rules.md
B-14) are the first.
company's accountant to review: the cash flow account roles (BS-statement-3) are the first.
## Gap list: what isn't covered, and what would bring it in
@@ -2559,7 +2556,7 @@ B-14) are the first.
## P4b S1, part A: documents read their figures from standing lines (2026-10-23)
rules.md B-38 (plan P4b, D-45): every line on receivables or payables
BS-arap-2 (plan P4b, D-45): every line on receivables or payables
carries its document (`Ledger.line_docs`); what a document owes, was paid
and is (Open, Partly paid, Paid, Void) is read from those lines as of a
day; hand lines on the control accounts are refused; a reversal is
@@ -2581,7 +2578,7 @@ the wiring into verify, the digest and Needs attention) is part B.
line for line; Jan 22 unchanged; Jan 31 Fernhill owes 100.00 and Tobin
80.00 again (their payments' reversals); Mar 31 the voided invoice
leaves the aging and the reopened ones age at 31-60.
- **ledger-core:** `tests/spec_documents.rs`, one test per B-38 scenario
- **ledger-core:** `tests/spec_documents.rs`, one test per BS-arap-2 scenario
(`reversing_a_payment_reopens_the_invoice`,
`a_voided_invoice_never_ages`, `void_refused_while_paid`,
`aging_as_of_ignores_a_later_reversal`,
@@ -2626,7 +2623,7 @@ the wiring into verify, the digest and Needs attention) is part B.
`a_void_is_journaled_as_its_reversal`,
`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` (B-38
`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
method and reference, voids, reversals of any entry, closed months and
refused hand lines through `Store`; at half time and at the end the
@@ -2671,7 +2668,7 @@ check; `control_check`'s chain netting.
## P4b S1, part B: void, control check, and each payment's details (2026-10-24)
The MCP layer of rules.md B-38 (plan P4b S1, part B). Part A (above) is
The MCP layer of BS-arap-2 (plan P4b S1, part B). Part A (above) is
the engine: the tags, the derived figures, the guards. Part B puts it on
the wire: `books.void_document` reverses a document's own entry with the
reason, `books.control_check` ties each control account to its documents,
@@ -2727,7 +2724,7 @@ and per document, both loops); the `digest` that includes it and the
`books.documents` and `books.document` (`7d2bf0b7`) and the viewer's
Money in and Money out lists and a document's page (`b7b7f171`). No
format change and no engine rule: both read the figures part A derives
(B-38), and the viewer reads the same ledger directly (I-8).
(BS-arap-2), and the viewer reads the same ledger directly (I-8).
The plan calls the timeline's reversed items "struck through"; as built
they are labelled: a payment reversed later reads "Payment (reversed
@@ -2787,7 +2784,7 @@ An invoice as a PDF: `ledger_import::invoice_pdf::invoice_pdf` typesets
books once, so the server's download and the viewer's Save give the same
bytes for the same books. `books.document { pdf: true }` hands the file
over; a bill's PDF is the vendor's, so it is refused. No format change
and no engine rule: the figures are part A's (B-38) and the template does
and no engine rule: the figures are part A's (BS-arap-2) and the template does
no arithmetic.
- **`crates/ledger-import/src/invoice_pdf.rs`:**
@@ -2833,7 +2830,7 @@ it but asserts only that it succeeds).
## P7: the TIN scanner's separators (2026-10-26)
*(Consolidated, with the other units' targets, in "P12: the checklists" at the end of this file.)*
rules.md B-26; plan 8.2 P7, with vault v2 closed by D-48 (nothing of
BS-partner-2; plan 8.2 P7, with vault v2 closed by D-48 (nothing of
HPKE, keyslots or human pages is built here). The scanner
(`ledger_core::parties::has_full_tin`, `redact_full_tins`) reads the
commas, parentheses and any run of spaces that a TIN's groups can be
@@ -2843,9 +2840,9 @@ separates only a 3-2-4 or 2-7 group, so an amount's comma-grouped
thousands (`1,234,567.89`, 1-3-3-2) stay an amount. The legacy run
reading is unchanged for everything it found (the property asserts it
never forgets one), and replay still reads a journaled line as P2 did
(`parties::replaying`, B-28). The access log's masking and digest use
(`parties::replaying`, BS-entry-4). The access log's masking and digest use
the same function; the filing scan keeps its narrow printed shapes
(B-26: a bank export's routing numbers must go in) and gains the comma
(BS-partner-2: a bank export's routing numbers must go in) and gains the comma
renderings.
Tests: `tin_shapes_with_any_separator_are_found`
@@ -2893,10 +2890,10 @@ adapter claims the rules the catalogue gives an example; a rule with no
example is not claimed, never silently passed.
Step 3 adds the rule identifiers: `BS-<area>-<n>` for the eleven areas,
`bookspec/spec/rules-index.md` as the table from B-1 to B-45, and each
`bookspec/spec/rules-index.md` as the table from BS-entry-1 to BS-ledger-13, and each
stated rule's id under its heading in `docs/spec/rules.md`. `DECISION`
there is bookspec's `CHOICE`: the specification names the options, an
engine declares its pick (`Claims::with_choice`). B-39 to B-45 are
engine declares its pick (`Claims::with_choice`). BS-arap-3 to BS-ledger-13 are
allocated (`plan/served.md` 8.0.3) and not yet stated; they carry an id and
an area and no status.
@@ -3277,7 +3274,7 @@ each item's target (`Target::Invoice`) and `books.mark_sent` step args.
## P4b S6: paying on terms (2026-10-27)
rules.md B-42; plan 8.2 P4b S6. One payment settles several documents of
BS-arap-6; plan 8.2 P4b S6. One payment settles several documents of
one party, with the early-payment discounts their terms allow, the
processor's fee posted gross, a bills-due list, the agings' detail and
tie-out, and the aging exports.
@@ -3355,15 +3352,15 @@ viewer's `discount_by` and `days_overdue` flags.
## P4b S7: bad debts (write-offs), 2026-10-27
The write-off (plan 8.2 S7; rules.md B-41): an invoice that will not be
The write-off (plan 8.2 S7; BS-arap-5): an invoice that will not be
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` (B-38 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` (B-41 INVARIANT 3: refused, the
`write_off_refused_on_cash_basis` (BS-arap-5 INVARIANT 3: 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
@@ -3408,14 +3405,14 @@ in the same call.
(a write-off of at most what is owed leaves nothing owed below zero over
the date-sum). Both theorems are in `Audit.lean`. No kernel function
was added, so no Kani harness.
- **bookspec:** `bad-debt-direct-write-off` (B-41, CHOICE: invoice 100,
- **bookspec:** `bad-debt-direct-write-off` (BS-arap-5, CHOICE: invoice 100,
two partial write-offs, the balances and the trial balance) and
`arap-hand-control-posting-refused` (B-38: an entry an earlier version
`arap-hand-control-posting-refused` (BS-arap-2: an entry an earlier version
wrote on receivables replays, attempts the control guard now refuses,
and the books still tie out). The example schema gained the `write_off`
event and lets a refused `lines` event say so (an entry posts whole or
not at all); the refusal vocabulary gained `untagged_control_line`,
which belongs to B-38.
which belongs to BS-arap-2.
**For P12 (mutation targets, none run, D-33):** `Ledger::write_off_steps`'
cash-basis comparison (the `eq_ignore_ascii_case`, the early return), its
@@ -3434,7 +3431,7 @@ check, and the preview's clone; attention's year comparison and its
## P6: the evidence pipeline (2026-10-27)
Extraction, dedup, annotations and company record categories (plan P6;
rules.md B-44). One in-process extractor in `ledger-reader`
BS-ledger-12). One in-process extractor in `ledger-reader`
(`crates/ledger-reader/src/lib.rs`): `pdf_text` and `pdf_lines` (promoted from the PDF
reader test), `page_count`, `page_png` (promoted from the viewer's private
rasterizer), `xlsx_text` (cells as the exact decimal strings the sheet XML
+25 -25
View File
@@ -103,7 +103,7 @@ Each law, and what proves it. Kani harnesses are in
`Reachable.accounting_equation_through` (any number of accounts)
9. **Period statements add up**: a year's P&L is the sum of its months'.
- Lean `statements_add_up`
10. **The statement of cash flows foots** (rules.md B-14, plan P3 defect
10. **The statement of cash flows foots** (BS-statement-3, plan P3 defect
1): each entry's cash is applied to the sections moving against it,
operating, investing, financing, each up to its own movement; what a
member or a lender paid or received for the entry, with no cash
@@ -196,13 +196,13 @@ sequence of commands, of any length**:
model's `record` step touches only the records by definition, so the
proof says the model is sound, not the engine; the engine's side is
checked by `settings_replay_is_pure`, which snapshots every figure and
entry around each record (rules.md B-29), and for the 1099 records by
entry around each record (BS-ledger-9), and for the 1099 records by
`decision_and_method_records_change_no_entry` (ledger-store
`tests/form1099.rs`; they change the 1099 worksheet by design, never
an entry). Settings that change how the
same entries are presented (the fiscal year, cash flow roles, members)
are outside this law by design. A rename (`rename_account`, P3,
rules.md B-31) is a record too: the model's chart is `(code, type)`
BS-ledger-10) is a record too: the model's chart is `(code, type)`
(`Ledger.lean`), names are not modelled, so a rename is the identity
on the model and needs no new `Step` (plan I-13 is met as P1 met it
for records). The engine's side is the property
@@ -231,7 +231,7 @@ sequence of commands, of any length**:
- Lean `net_closings_is_net_income`, `close_credits_net_income`
18. **An allocation's parts sum to the whole, to the unit**, however the
other shares were rounded, and only the last share changes; and the
largest-remainder apportionment (`kernel::apportion`, rules.md B-13)
largest-remainder apportionment (`kernel::apportion`, BS-partner-1)
succeeds exactly when the rounded-down parts are short of the whole by
less than a unit each, then sums to the whole, gives each part nothing
or one unit (one part may also take the sub-unit fraction), and never
@@ -245,12 +245,12 @@ sequence of commands, of any length**:
of cumulative closes is their allocation of everything the run closed
(so its rounding is one allocation's, never a sum of them), and each
close hands out exactly its net, for any allocation whose parts sum to
the whole (rules.md B-13). Since P3 this is the run rule closes
the whole (BS-partner-1). Since P3 this is the run rule closes
journaled `"cumulative"` replay under (`CloseTo::MembersRun`).
- Lean `runPart_telescopes`, `closePart_total` · property
`each_member_stays_within_a_cent_of_their_share`
The P3 odd cent (defect 17; rules.md B-13; D-10, D-38) adds three laws:
The P3 odd cent (defect 17; BS-partner-1; D-10, D-38) adds three laws:
20. **A cumulative members close hands out exactly its net, and leaves each
member's running total one allocation of everything the count closed**,
@@ -267,7 +267,7 @@ The P3 odd cent (defect 17; rules.md B-13; D-10, D-38) adds three laws:
`allocate_cumulative_agrees_with_the_integer_model`
21. **Bounded drift: no member's running total is ever a minor unit from
their exact share.** With shares w_i / W (exact decimals) and every
amount a whole number of minor units (B-3), after every cumulative
amount a whole number of minor units (BS-ledger-1), after every cumulative
close |(given_i + part_i)·W − T·w_i| < W, whatever earlier closes gave.
The precondition is the code's: `periods::allocate_cumulative` refuses a
product Decimal would round, so the remainders it ranks are exact, and
@@ -285,7 +285,7 @@ The P3 odd cent (defect 17; rules.md B-13; D-10, D-38) adds three laws:
`Apportion.allocW_cumulative_drift` (the two together): any number of
members, any amounts
- property `members_capital_never_drifts_a_cent_from_their_share`
- the tax-basis K-1's running split (B-36 with D-38, 2026-10-22),
- the tax-basis K-1's running split (BS-partner-4 with D-38, 2026-10-22),
whose splits each carry their own weights, so the exact running
share is a sum of quotients and Decimal's division can leave it a
hair under the cent it is (`tax_capital::RunningSplit` takes it to
@@ -319,7 +319,7 @@ The P3 odd cent (defect 17; rules.md B-13; D-10, D-38) adds three laws:
the money and property in it each carry the whole's sign and never
exceed it; a money target is all cash; a contribution counts all of
itself; a distribution counts no more money than it paid and no more
property than it gave, the rest still owed (rules.md B-35).
property than it gave, the rest still owed (BS-partner-3).
- Kani `party_target_direction_is_its_sign` · bridge
`party_target_agrees`
24. **A reversal is the exact opposite of what it reverses**: the target
@@ -330,7 +330,7 @@ The P3 odd cent (defect 17; rules.md B-13; D-10, D-38) adds three laws:
engine never reads those off a reversal's lines: its reversal arm
takes the original's target), reversing twice gives the original
back, and a reversal's movement over any accounts is the original's
negated (B-9).
negated (BS-ledger-5).
- Kani `party_target_is_odd`, `reverse_target_is_an_involution` ·
Lean `partyTarget_odd`, `capitalTarget_odd` (with `cashIsMoney`
shown satisfiable), `reverseTarget_involutive`,
@@ -340,7 +340,7 @@ The P3 odd cent (defect 17; rules.md B-13; D-10, D-38) adds three laws:
### 1099 payments
25. **A payment to a vendor is split, never lost or counted twice**:
each payment line goes in the bucket rules.md B-19's table names (its
each payment line goes in the bucket BS-1099-1's table names (its
16 cases: with no payment method naming its account, a financing line
never counts and a card account's line is always a card's); the
buckets are each exactly the credits minus debits of their lines; and
@@ -357,8 +357,8 @@ The P3 odd cent (defect 17; rules.md B-13; D-10, D-38) adds three laws:
### Proration by days, catching up, truing up (P3, defects 22 and 9)
Depreciation (rules.md B-15) and daily prepaid and deferred-revenue
schedules (B-16) spread a total over a span of days with one kernel
Depreciation (BS-asset-1) and daily prepaid and deferred-revenue
schedules (BS-prepaid-1) spread a total over a span of days with one kernel
function, `kernel::prorate_by_days` (each month's share through
`kernel::prorated_through`), in exact integer arithmetic over a common
unit, `MONTH_L` = lcm(28, 29, 30, 31) = 377,580 parts of a month, so a day
@@ -461,14 +461,14 @@ out, proved equal to `cum` over `W` = months × MONTH_L and over `W` × the
last month's days, with the two meeting where the last month starts
(`roundUnit_scale`). The one hypothesis is the calendar's: every part
but the last ends short of the span (`e < W`), which a walk from any
in-service date keeps (B-15: a first month of at most one, then whole
in-service date keeps (BS-asset-1: a first month of at most one, then whole
months); an exhaustive test walks the kernel itself over every
1-to-3-month span of two calendar years, and the bridge and the exact
unit tests check the rest.
### An asset's basis figures (P3, defect 13)
The register's tax figures beside book value (rules.md B-25) come from
The register's tax figures beside book value (BS-asset-4) come from
one kernel function, `kernel::basis_figures`, for every rule:
31. **Each figure follows from the rule and the facts, and none
@@ -484,7 +484,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 (rules.md B-37 item 4) is
The "if repaid" figure of work done on spec (BS-statement-5 item 4) is
one kernel function, `kernel::unrecovered_cost`:
32. **Never below zero, the shortfall exactly, and no overflow**: the
@@ -506,7 +506,7 @@ tagged with d and dated on or before D, whatever their entries' standing:
a reversal's mirror carries the same tag and cancels) plus the legacy
untagged lines that still stand. A document never owes less than nothing
or more than its total on any day a payment path or a reversal touches
it. Rule: `docs/spec/rules.md` B-38.
it. Rule: BS-arap-2.
- Kernel: `kernel::running_bounds(total, deltas)` and
`kernel::bounds_kept(total, before, after)` decide, at every date in
@@ -537,7 +537,7 @@ it. Rule: `docs/spec/rules.md` B-38.
### Payment terms and document lines (P4b S4.1)
Payment terms (rules.md B-39) give a due date and a discount date by
Payment terms (BS-arap-3) give a due date and a discount date by
calendar arithmetic in `arap::Terms`, and the two money figures they touch
come from the kernel:
@@ -599,13 +599,13 @@ come from the kernel:
### Bad debts (P4b S7)
A write-off (rules.md B-41) is `Ledger::write_off`: a new command, so a new
A write-off (BS-arap-5) is `Ledger::write_off`: a new command, so a new
Lean step, and no new kernel function (its two lines are one debit and one
credit, and the bounds are the existing date-sum's).
37. **A write-off of at most what is owed leaves nothing owed below
zero.** The step posts the document's control line credited (tagged
with it, so it is the same sum B-38 fixed) and the amount of
with it, so it is the same sum BS-arap-2 fixed) and the amount of
bad-debt expense debited (untagged, off the control accounts).
`through_append` reads the write-off's own two lines through the day
separately; `docSum_writeOffLines` gives the control line's −amount;
@@ -648,7 +648,7 @@ new command, so a new Lean step, and no kernel function.
a period with an open draft can't close, discarded it can, and
every balance and id is as it was).
### A tax category's deductible amount (B-32, D-67)
### A tax category's deductible amount (BS-ledger-11, D-67)
39. **A category's deductible amount is its accounts' exact shares added
and rounded once**, to the cent, half away from zero: round(Σ bookᵢ ×
@@ -878,7 +878,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 (rules.md B-14 rule 2). The Lean model's close step lets a
assets (BS-statement-3 rule 2). 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
@@ -893,17 +893,17 @@ balances, so it added no Kani harness and no Lean theorem; nothing here
was weakened. What it added is checked by tests and properties (listed in
`docs/testing.md`, "P0 guard rails"): the journal format gate (newer is
never called corrupt, damage always is; the envelope and its hash are
frozen across formats, rules.md B-27), the server failing closed after a
frozen across formats, BS-format-1), the server failing closed after a
panic, the import roots' lockdown (a property over generated paths, and a
component walk that refuses a folder swapped for a link; removed with the
import roots in P2 slice 5), files with full
TINs kept out of the books (B-26), and the agent text lint. Out of scope
TINs kept out of the books (BS-partner-2), and the agent text lint. Out of scope
for proof today: the format gate and the walk are I/O, and bookspec's Lean
model stops at the ledger.
### P3: the odd cent (2026-10-20)
The cumulative members close (rules.md B-13) adds a kernel function,
The cumulative members close (BS-partner-1) adds a kernel function,
`kernel::apportion_cumulative`, which Kani proves exact and refusal-safe
for up to three parts and checks against the integer model of
`periods::allocate_cumulative` for bounded drift; Lean proves the drift