docs(spec): claims restore enforcement sites and product rules (review)

B-14 (statement):
- The Pick records the kind order the record now restores: within a
  section, the rest of its kinds, then interest received, then interest
  paid (CONVENTION, as the engine splits it).
- Enforced restores `Ledger::reversal_chain`, rule 6's chains.
- WB-statement-8 is new: the statement's label strings and the
  reconciliation's grouping are wanderbooks product, not accounting
  ("Reversal of #N — …", "Reinstatement of #A (reverses #B)", "Proceeds
  from borrowing — …", "Contributions from members — …", "(Gain) loss and
  other noncash changes in investing assets", "Depreciation", "Noncash:
  through <account>", "Other noncash items", "Increase in"/"Decrease in").

B-37 (statement):
- WB-statement-6 says "a decision" again, not "a choice": a decision is a
  record kind the books have.
- WB-statement-9 is new: a document's entry posts one line per project in
  the order each is first named, the untagged sum as one line, a document
  naming none posting exactly the one line documents always posted; its
  journal events (`entry.line_class_set`, feature
  `document_line_projects`) are recorded.

B-11 (period):
- Enforced says INVARIANT 5 (a close with nothing to close posts no entry
  and still closes, D-73); Checked adds Lean `closingEntry_net` and
  `a_close_with_nothing_to_close_posts_no_entry`, the rule the record now
  states.

B-12 (period): Enforced restores `Ledger::create_period`
(`PeriodsOverlap`); Checked restores
`periods_nest_but_never_partially_overlap` and `periods_nest`.

B-30 (period): Enforced restores `InvalidDateRange` and
`StartAfterToday`, with what each refuses.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
swaitsandDeepSeek V4.1 Flash committed 2026-11-08 12:17:01 -07:00
1 parent 73010c4acb
commit 1349bb478b
2 files changed
+64 -10

No files matched your search

+18 -6
View File
@@ -12,10 +12,14 @@ Rules: B-11, B-12, B-30.
**Claims:** yes
**Enforced:** `Ledger::close_period_to`. **Checked:** Kani
**Enforced:** `Ledger::close_period_to` (INVARIANT 5: a close with
nothing to close posts no entry and still closes the period; the EM's
decision, D-73, 2026-11-08). **Checked:** Kani
`closing_line_zeroes`, `closing_entry_balances`; Lean
`closingEntry_zeroes`, `closingEntry_accepted`, `close_zeroes`,
`close_credits_net_income`; `a_close_sweeps_only_through_the_period_end`.
`closingEntry_zeroes`, `closingEntry_accepted`, `closingEntry_net`,
`close_zeroes`, `close_credits_net_income`;
`a_close_sweeps_only_through_the_period_end`,
`a_close_with_nothing_to_close_posts_no_entry`.
## B-12 A closed period takes no new postings; periods close in order
@@ -26,9 +30,12 @@ Rules: B-11, B-12, B-30.
**Pick:** periods nest and never partially overlap (the owner, 2026-10-13).
**Enforced:** `closed_period_containing`,
`CloseOutOfOrder`, `Store::rehearse`. **Checked:** Lean `Steps.frozen`;
`CloseOutOfOrder`, `Ledger::create_period` (`PeriodsOverlap`),
`Store::rehearse`. **Checked:** Lean `Steps.frozen`;
store property `refused_commands_never_reach_the_journal` (no draft in a
closed period).
closed period); `periods_nest_but_never_partially_overlap`
(`crates/ledger-core/tests/invariants.rs`) and `periods_nest`
(`crates/ledger-core/tests/spec_ledger.rs`).
### Product rules
@@ -51,7 +58,12 @@ untouched.
**Enforced:** `ledger_core::calendar` (`period_defaults`,
`PeriodDefaults::statement`, `statement_range`, `as_of`,
`calendar_year`, `fiscal_year_start_on`, `PeriodKind::describe`,
`START_DOC`, `END_DOC`, `AS_OF_DOC`, `YEAR_DOC`); `ledger_package`
`START_DOC`, `END_DOC`, `AS_OF_DOC`, `YEAR_DOC`), whose refusals are
`LedgerError::InvalidDateRange` (both dates given, start after end) and
`LedgerError::StartAfterToday` (only a start, after today, the end an
omitted end would mean; the message says the end was defaulted: pass
end); a resolved start after the resolved end is never swapped or
clamped to fit. `ledger_package`
`statement_range`, `as_of_date`, `pnl_statement`, `bs_statement`,
`cash_flow_statement`, `build_package`; `ledger-mcp` `BooksServer::periods`,
`statement_range`, `as_of`, every report tool, `books.show`, the
+46 -4
View File
@@ -32,11 +32,12 @@ Lean `trial_balance_iff`, `Reachable.trial_balance`,
**Claims:** partly (bookspec's record states rules 1-12; the picks and the product surface are below)
**Pick:** the direct method; an entry's cash allocated to its sections in the order operating, investing, financing (CONVENTION, the ASC silent, disclosed); what a member or a lender pays or receives for the company presented as constructive cash, borrowed (or contributed) and spent (the owner, D-42, 2026-10-20, revising D-35's first point); a payment shared between a government and others split by their resolved shares, the government's part rounded half to even to the base currency's places and the rest exact (CONVENTION); payroll entries keep their (d) class whoever they name (CONVENTION).
**Pick:** the direct method; an entry's cash allocated to its sections in the order operating, investing, financing (CONVENTION, the ASC silent, disclosed); within a section, the cash split among its kinds in the order the rest of the section's kinds, interest received, interest paid (CONVENTION, as the engine splits it); what a member or a lender pays or receives for the company presented as constructive cash, borrowed (or contributed) and spent (the owner, D-42, 2026-10-20, revising D-35's first point); a payment shared between a government and others split by their resolved shares, the government's part rounded half to even to the base currency's places and the rest exact (CONVENTION); payroll entries keep their (d) class whoever they name (CONVENTION).
**Enforced:** `profit_and_loss_for_period`; `cashflow::cash_flow` (with
`kernel::entry_flows`, `apply_cash`, `constructive`, `exchanged`),
`role_problems`, `foot`; `ledger_package::cash_flow_for` (the server, the
`role_problems`, `foot`; `Ledger::reversal_chain` (rule 6's chains);
`ledger_package::cash_flow_for` (the server, the
package and the viewer). **Checked:** Lean `statements_add_up`,
`cashflow_sections_sum_to_cash_change`, `entry_flows_sum`,
`flows_reversal`, `constructive_nets`, `constructive_neg`,
@@ -269,8 +270,8 @@ replay_set_project}`, `Store::{add_project, set_project}`.
**WB-statement-6** Links and notices: a line is tagged with a project
(its class); a receipt or document is linked to a project (attachment
subject `project`); a choice recorded in the books names the projects it
is about. Whether to link is the company's convention
subject `project`); a decision names the projects it is about. Whether
to link is the company's convention
(`link-to-projects`). Finished and abandoned projects still take lines,
and `books.add_line`, `books.record_payout`, `books.create_invoice` and
`books.create_bill` say so when one is tagged. An invoice line naming an
@@ -308,3 +309,44 @@ contribution_margin_pct}`, `ProjectToDate::margin_pct`. **Checked:**
`prop_project_contribution_is_the_net_to_date`,
`prop_snapshot_contribution_is_the_net_to_date`, Kani
`unrecovered_cost_laws`.
**WB-statement-8** The statement's words and groupings are
wanderbooks' product strings, not accounting (the accounting is
BS-statement-3's rules 4, 6 and 8): a reversal shown alone reads
"Reversal of #N — <N's description>" and a reinstatement "Reinstatement
of #A (reverses #B)", both listed under the original's kind; a
financing inflow under a borrowing reads "Proceeds from borrowing —
<account>" and a contribution "Contributions from members — <member>";
the rule-4 gain or loss line reads "(Gain) loss and other noncash changes
in investing assets"; and the reconciliation's noncash items read
"Depreciation" (the entry's investing and financing balance-sheet lines
all accumulated depreciation), "Noncash: through <account>" (all on that
account, accumulated depreciation aside) or "Other noncash items", with
each operating balance-sheet account's line reading "Increase in
<account>" or "Decrease in <account>". The engine builds these strings in
one place so every surface agrees.
**Enforced:** `cashflow::cash_flow` (`label`, `reconcile`). **Checked:**
`a_reversal_of_a_reversal_is_shown_and_foots`,
`a_reversal_three_levels_down_is_labelled_a_reversal`,
`a_payment_made_for_the_company_and_its_reversal_net`,
`an_expense_a_member_paid_is_borrowed_and_spent`,
`defect1_two_member_llc_first_year_regression`,
`a_disposals_depreciation_credit_back_is_depreciation`.
**WB-statement-9** A document's entry posts one revenue or expense line
per project its lines name, in the order each is first named, each the
sum of that project's lines, and the untagged lines' sum as one line
(`arap::document_parts`); a document naming none posts exactly the one
line every document posted before. The receivable or payable line and
the payments against it take no project. Journaled as the line's
`class_id` in `invoice.created` or `bill.created` and an
`entry.line_class_set` right after its revenue or expense line's
`entry.line_added`, behind the journal feature `document_line_projects`
(B-27).
**Enforced:** `arap::document_parts`, `Ledger::{create_invoice,
create_bill}`, `Store::{create_invoice, create_bill}` (feature
`document_line_projects`). **Checked:** `tests/spec_document_projects.rs`,
`tests/document_projects.rs`, proptest
`prop_document_parts_partition_the_total`.