Merge main into the K-U5 branch: X-H1b, K-U3, S-E2, S-E3, X-H1c

This commit is contained in:
swaits committed 2026-11-09 04:35:21 -07:00
commit 5e4950697e
100 files changed
+1793 -374

No files matched your search

+38 -7
View File
@@ -74,7 +74,12 @@ Kani `bounds_check_matches_definition`, `bounds_kept_is_the_definition_on_books_
Lean `Documents.control_agrees`, `Documents.Step.document_unattached`,
`Documents.Step.reverse_moves`, `Documents.Reachable.unattached_zero`
(through role assignments and releases),
`Documents.Reachable.control_is_documents`. The model's limits: it
`Documents.Reachable.control_is_documents`; bookspec examples
`arap-hand-control-posting-refused` (BS-arap-2 `lines-that-stand`: the
hand line is refused, the line an earlier version wrote still reads right),
run by the adapter, and `arap-a-hand-line-on-receivables-is-taken`
(`documents-kept-apart`), which names the option wanderbooks did not pick
and is skipped for it. The model's limits: it
starts from empty books (legacy lines are covered by the identity
`Documents.control_agrees` alone), it names documents by one id space (an injective
coding of `DocRef`), and an account becoming a control account by its
@@ -179,8 +184,8 @@ behind the feature `documents_v2`. **Checked:**
**Claims:** yes
**Pick:** a vendor's invoice reference is compared after the normalization that drops case and spaces (`Ledger::check_vendor_ref`); the old text names no separate decision for it.
**Pick (BS-arap-10):** `ignore-case-and-spaces`; a vendor's invoice reference is compared after the normalization that drops case and spaces.
**Pick:** a vendor's invoice reference is compared after the normalization that drops case, spaces and hyphens (`Ledger::check_vendor_ref`), so "ACME-123", "acme 123" and "Acme123" are one reference (pinned by `duplicate_vendor_ref_refused_unless_a_reason_is_given`); plan P4b S4 (the owner) specifies it.
**Pick (BS-arap-10):** `ignore-case-spaces-and-hyphens`; a vendor's invoice reference is compared after the normalization that drops case, spaces (any whitespace) and hyphens.
**Enforced:** `Ledger::next_invoice_number`, `Ledger::check_vendor_ref`,
`PartySnapshot::from_party` (the snapshots at issue, D-55);
@@ -195,7 +200,14 @@ every amount through `amount_parts`).
`tests/arap_standing.rs` (`documents_v2_waits_for_the_upgrade`,
`issued_pdf_is_filed_with_the_invoice_or_nothing_is`); over the wire
`crates/ledger-cli/tests/documents.rs` (`an_invoice_from_issue_to_paid`,
`duplicate_vendor_invoice_refused`); the page `ledger-import`
`duplicate_vendor_invoice_refused`); bookspec examples
`arap-invoice-numbers-run-in-order-and-are-kept` (the adapter numbers each
invoice with `Ledger::next_invoice_number` and reads the place back from the
number the engine stored), `arap-a-vendor-invoice-is-entered-once`
(the refusal of a second bill, from `Ledger::check_vendor_ref`) and, for
BS-arap-10, `arap-a-vendor-reference-differing-in-case-spaces-and-hyphens-is-a-duplicate`;
`arap-a-vendor-reference-differing-in-case-spaces-and-hyphens-is-not-a-duplicate`
names `compare-exactly` and is skipped; the page `ledger-import`
`tests/spec_import.rs::invoice_pdf_prints_what_it_should` and the unit tests
`labels_are_data`, `an_invoice_renders_deterministically`,
`two_hundred_lines_paginate`; the viewer
@@ -260,7 +272,14 @@ item.
`tests/arap_props.rs` (`status_is_a_function_of_journal_and_date` with
write-offs); over the wire `crates/ledger-cli/tests/documents.rs`
(`write_off_then_recovery`, `write_off_needs_evidence`); bookspec
`bad-debt-direct-write-off`; Lean `Documents.Step.writeOff_unattached`,
`bad-debt-direct-write-off` (BS-arap-5 `direct-write-off`; the allowance
method has no example yet, it needs a provision event) and, for BS-arap-11,
`arap-a-recovery-reverses-the-write-off-in-its-year` (the adapter reverses
the write-off with `Store::reverse_entry` and takes the money with
`Store::receive_payment` in the write-off's tax year, and posts a plain
entry in a later one);
`arap-a-recovery-is-a-movement-on-the-document` names `recovery-movement`
and is skipped; Lean `Documents.Step.writeOff_unattached`,
`Documents.writeOff_within_bounds`; the viewer
`a_write_off_shows_on_the_timeline`; the item
`a_write_off_is_flagged_for_the_cpa`.
@@ -319,12 +338,24 @@ check_discount}`, `arap::{Application, Fee, SettleParams, SettlementRow}`,
(`bill_on_terms_with_discount`, `late_discount_needs_a_reason`,
`discount_on_an_asset_bill_is_refused_with_the_remedy`,
`a_fee_posts_gross_to_receivables_and_net_to_the_bank`,
`a_settlement_names_its_lines_and_refuses_a_document_twice`),
`a_settlement_names_its_lines_and_refuses_a_document_twice`,
`a_fee_above_the_cash_is_refused_and_changes_nothing`: the refusal is
`LedgerError::FeeAboveCash`, its own variant),
`tests/kernel_bridge/main.rs::settle_agrees`; Kani `settle_is_exact`;
`ledger-store` `tests/arap_standing.rs`
(`a_settlement_names_its_lines_and_replays`, `settlement_waits_for_documents_v2`,
`legacy_payment_events_keep_the_positional_rule`), `tests/arap_props.rs`;
`ledger-cli` `tests/documents.rs`; `ledger-package`'s aging tie-out test.
`ledger-cli` `tests/documents.rs`; `ledger-package`'s aging tie-out test;
bookspec examples `arap-a-settlement-pays-several-documents-and-names-each-line`
and `arap-a-settlement-that-is-not-exact-is-refused` (BS-arap-6, through
`Store::settle`, each refusal read off the engine's own error), and one per
option picked: `arap-a-discount-taken-is-booked-when-it-is-taken` (BS-arap-12),
`arap-a-processors-fee-is-posted-gross` (BS-arap-13) and
`arap-a-discount-on-an-asset-bill-is-refused` (BS-arap-14); the examples
`arap-a-discount-expected-is-booked-with-the-document`,
`arap-a-processors-fee-is-not-shown-against-the-deposit` and
`arap-a-discount-on-an-asset-bill-is-apportioned` name the options not picked
and are skipped.
The Lean step is the document constructor of the Lean documents model, with
every control line tagged (`Documents.settle_unattached`); no new step
constructor.
+2 -2
View File
@@ -78,14 +78,14 @@ dates, `accumulated_posted` and its edges,
### Product rules
**WB-asset-1** The bounds `BS-asset-1` states (rules 25-26: a new link to
**WB-asset-1** The bounds `BS-asset-1` states (statements 25-26: a new link to
an entry dated after the in-service date or the disposal is refused, as is
a new in-service date before the linked entry's date, and a disposal dated
before the acquired date is refused) are the commands', never replay's
(B-28): a journal an earlier version wrote replays as written, whatever
those dates say. (That depreciation starts on the in-service date and that
the register holds the asset from the acquired date are `BS-asset-1`
rules 23-24.)
statements 23-24.)
*Enforced:* `set_asset_acquisition` / `replay_set_asset_acquisition`,
`Ledger::asset_acquired_date`, `dispose_asset`, `Ledger::set_asset_acquisition`.
*Checked:* `ledger-core` `tests/spec_asset_basis.rs` (each bound and its
+22 -2
View File
@@ -21,7 +21,13 @@ more lines, debits = credits exactly); `Ledger::add_line` for the account
check at line-adding time
(`a_line_on_an_unknown_or_placeholder_account_is_refused_when_added`).
**Checked:** Kani `check_lines_is_exact`, `accepted_entry_nets_to_zero`; Lean
`Accepted.net_zero`; property `prop_posted_entries_balance`.
`Accepted.net_zero`; property `prop_posted_entries_balance`; bookspec example
`entry-a-line-on-a-header-is-refused-when-it-is-added` (BS-entry-6, the option
picked: a draft with a line on a header account is refused as the draft is
made, through `Ledger::try_create_entry` and `Ledger::add_line`, and the
refusal read off the engine's `LedgerError::PlaceholderAccount`); the example
`entry-a-line-on-a-header-is-refused-when-the-entry-posts` names the option
not picked and is skipped.
### Product rules
@@ -209,7 +215,21 @@ pinned; every tool over every old book).
(`draft_states_replay_and_project`, `drafts_v2_waits_for_the_upgrade`,
`posted_seq_is_the_posting_lines_seq`); `ledger-cli` `tests/drafts.rs` (`a_draft_waits_for_its_receipt_and_posts`,
`a_reversal_needs_no_receipt_of_its_own`, `gui_and_server_gate_agree`,
`stale_preview_refused`).
`stale_preview_refused`); bookspec examples, through `Store::post_entry_checked`,
`Store::set_draft_state`, `Store::attach_receipt`, `Store::discard_draft` and
`ledger_core::evidence::requirement`, each answer read off the engine:
`entry-a-draft-waits-on-its-evidence-and-posts-once-it-has-it`,
`entry-a-discarded-draft-leaves-the-books-unchanged`,
`entry-a-drafts-state-is-a-note-and-a-posted-entry-has-none`,
`period-a-draft-holds-its-period-open-until-it-is-discarded` (BS-period-2's
`LedgerError::DraftsInPeriod`), `entry-evidence-is-decided-in-one-place` and
`entry-only-a-draft-can-be-posted-or-discarded` (`LedgerError::EntryAlreadyPosted`
and `LedgerError::UnknownEntry`, through `Store::post_entry` and `Store::discard_draft`). An entry the example
says is refused when posted at once is made, lined and posted on a rehearsal:
the books replayed from their journal into a `Store` of their own (the
journal and the blobs copied, `Store::open`), so the refusal, an evidence
refusal included, is `Store::post_entry_checked`'s own and the example's books
keep no draft the engine would have journaled.
### Product rules
+6 -1
View File
@@ -164,7 +164,12 @@ None.
(`a_draft_waits_for_its_receipt_and_posts`,
`a_reversal_needs_no_receipt_of_its_own`); `ledger-store`
`tests/store.rs` (`draft_states_replay_and_project`,
`drafts_v2_waits_for_the_upgrade`).
`drafts_v2_waits_for_the_upgrade`); bookspec example
`ledger-a-reversal-needs-no-evidence-of-its-own` (BS-ledger-17, the option
picked: a reversal of a 40.00 entry under a policy of over 25.00 posts at once
and `ledger_core::evidence::requirement` exempts it as a reversal); the example
`ledger-a-reversal-carries-its-own-evidence` names the option not picked and is
skipped.
### Product rules
+1 -1
View File
@@ -374,7 +374,7 @@ the 1099 worksheet together, labelled, and neither is read for the
other: `books.get_entry` gives each part's `resolved`, `direction`,
`cash` and `in_kind`; `books.party` gives both a party's totals
(`basis` cash or all) and its worksheet figures, labelled; the known
limits of BS-partner-3 rule 7 are stated in the tools' text; the
limits of BS-partner-3 statement 9 are stated in the tools' text; the
viewer's party pages and entry page show the same parts.
**Enforced:** `ledger-mcp` `books.get_entry`, `books.party`,
+1 -1
View File
@@ -327,7 +327,7 @@ contribution_margin_pct}`, `ProjectToDate::margin_pct`. **Checked:**
**WB-statement-8** The statement's words and groupings are
wanderbooks' product strings, not accounting (the accounting is
BS-statement-3's rules 4, 6 and 8): a reversal shown alone reads
BS-statement-3's statements 5, 11 and 13): a reversal shown alone reads
"Reversal of #N — <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 —