Commit Graph
613 Commits
Author SHA1 Message Date
swaitsandClaude 34f5275ec4 fix(core): a running total of rounded shares adds by the rounding sum (K-U11a)
After K-U10 made the kernel's Decimal sum exact or refused, the K-1
worksheet refused every split by thirds with "a member's tax-basis
capital is too large to compute". Two tests caught it
(thirds_summed_are_the_cents_they_are, a_running_split_never_drifts_a_cent);
it never reached main, where the worksheet still called rust_decimal's
own sum.

A member's running total in RunningSplit is a sum of shares, each
whole x weight / sum of weights: a quotient of 28 significant digits. Two
thirds of 28 digits do not add to a number 96 bits hold. The total they
stand for was never an exact figure, and INVARIANT 4 of that type was
written for exactly that: the total is rounded to ten places before a
cent is taken from it. So the fault was in the routing, not the
arithmetic: K-U11a's script mapped that sum to the exact operation.

A sum of rounded quotients is a rounded figure by construction, as a
share's product is (checked_mul_rounded, K-U10). The kernel now names
that sum too: Amount::checked_add_rounded and checked_sub_rounded,
rust_decimal's own for Decimal and the plain operation for a machine
integer. RunningSplit::split and unsplit call them and nothing else does;
every sum of amounts stays exact or refused. So the K-1 worksheet
computes what it computes on main, to the digit.

The bridge property checks, over Decimal's whole range: the rounding sum
is rust_decimal's figure to the digit and the scale, it is the exact
figure wherever exact arithmetic gives one, and where it rounds it is
within half a unit of the last place it keeps. The seed proptest shrank
the failure to is kept.

Every other place outside the kernel that makes a figure of more than
ten places was read for the same fault (docs/proofs/k-u11.md lists
them); none adds such a figure before rounding it.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 23:27:24 -07:00
swaitsandClaude 7d525d392e refactor(core): the last eleven Decimal sites go through the kernel (K-U11a)
The detector now reads zero for ledger-core. These eleven waited for
K-U10's exact operations, since each needed a decision the first 199 did
not:

- The frozen close rules (periods::try_allocate and
  try_allocate_last_absorbs) and Ledger::member_close_split multiply a
  share by a total. That product is a rounded figure by construction (a
  share of 27 places), and posted closes replay through the first two, so
  not a digit may move: they call Amount::checked_mul_rounded, the product
  they have always computed, by name.
- The audit's check of a close (check_split) computes its bound and each
  member's drift through Amount. A bound or a drift that exact arithmetic
  cannot hold is raised as a finding, never passed as clean.
- Four places changed how many decimal places a figure is written with
  (a contribution margin's one place, a schedule's months at the
  currency's places, Money's step count). Each called Decimal::rescale,
  which rounds half away from zero when asked for fewer places than the
  value has. None of them asked for that, and only a debug assertion said
  so. kernel::rescale_exact adds or drops trailing zeros and returns None
  for anything else, so a figure's written places can change and its
  value cannot.

rescale_exact has no Kani harness and no Lean theorem: whole-number money
has no places, so there is nothing for an i64 harness or a law over the
rationals to state. It is the sixteenth listed exception of the
traceability gate, and two bridge tests carry it instead: a property over
Decimal's whole range against whole-number arithmetic that shares no code
with it (None exactly when the amount is no whole multiple of the step;
a result is the same number with the same sign), and a table of the
figures the four call sites print.

No figure moves. The full ledger-core suite passes.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 23:27:23 -07:00
swaitsandClaude 3918151794 merge: main into k-u11a (K-U10's exact operations)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 22:41:45 -07:00
swaitsandClaude c5c57aaf4b docs(plan): K-U10 landed: the triage, the status and the log say so
The triage marked exact Decimal arithmetic and the tie rule as in
flight; both are on main. It now says what each closed, the one figure
a new foreign line can book differently (the exact product's cent,
10500000099.89 where the double rounding booked .90; posted lines are
not recomputed), and what the checks found that the workers' own runs
did not: an exact division that accepted a rounded quotient, the six
review findings, and the Kani cover the tie change made unreachable.

The comment in add_line_fx said a 20-place product past 7.9e8 rounds
twice; since K-U10 the kernel holds that product in 256 bits and rounds
once. The K-U1 note's open edge points at the unit that closed it.

Three lines in the delegation log: the two hard implementations and the
review.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 22:41:34 -07:00
swaitsandClaude 5e9591725a merge: a tie between shares goes to the earlier part, exactly (K-U10b, D-76)
The rule (BS-partner-1, bookspec's Apportion) is that leftover cents go
to the largest remainders, ties to the earlier part. The engine ranked
the difference of quotients rounded at Decimal's 28th digit, so an exact
tie went where that digit sent it: 20.00 by 4/1/1 came out 13.33 / 3.34 /
3.33. It now ranks the exact remainder, whole x weight - part x total,
and gives 13.34 / 3.33 / 3.33. The owner decided for the exact ranking on
2026-11-09 (D-76, recorded here).

What moves: no golden, nothing between two parts or by equal weights, at
most a cent a part elsewhere (tests/kernel_bridge/ties.rs measures it).
Of the engine's splits only the K-1 worksheet's share of contributed
property divides by a total that is not one; a convention's split and the
frozen close rule already ranked exactly. Posted splits are not
recomputed.

Changed in the merge:
- The ranking's two products are the rounding ones (checked_mul_rounded).
  The kernel's checked_mul is exact or refused since K-U10a, and would
  refuse a split by weights of 27 places; the split is made, ranked by
  the nearest figures Decimal holds. A test splits by thirds, sevenths,
  ninths and elevenths at 27 and 28 places, both signs.
- Kani failed the unit as it came: with the exact ranking a part whose
  share is exact never takes a leftover unit (5 by 2/3/5 is 1, 2, 2, where
  i64's truncated quotients gave 2, 1, 2), so the cover "a part exactly
  one step above its truncated share" could not be reached. The harness
  split_by_weights_within_one_step now asserts the strict bound and that
  an exact share takes no unit; both covers are reached.
- docs/verification.md also takes K-U10a's account (sums and products
  exact or refused), which closes the edges it listed as pinned.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 22:39:13 -07:00
swaitsandClaude e632855f13 merge: Decimal sums and products are exact or refused (K-U10a)
rust_decimal rounds a sum or a product whose exact figure needs more than
its 96-bit mantissa or 28 places, and says nothing. The kernel's Amount
for Decimal now refuses instead: checked_add, checked_sub and checked_mul
return the exact figure or None. Two products keep their meaning under
their own names: checked_mul_rounded (a proportional share by a weight of
many places, a rounded figure by construction) and
checked_mul_round_to_step (a foreign amount at a rate: the exact product,
held in 256 bits, rounded once). checked_div_exact no longer accepts a
rounded quotient that happens to multiply back.

Within the line cap (10^15, ten places) sums and differences are the old
ones to the character, and no golden moves. One figure a new line can
book does move, the one the old double rounding got wrong: a foreign
amount at a rate whose exact product passes 96 bits (1050000010.0000000001
x 9.9999999999) books 10500000099.89, the exact product's cent, where it
booked 10500000099.90. A line already posted is not recomputed: replay
reads the booked amount.

Reviewed before merging by a second model, which sampled the 256-bit
arithmetic (no wrong figure) and found the properties proved soundness
only. They now prove the other direction too, from the rational alone:
nothing Decimal could hold is refused. One refusal is new and stated: a
product that is not exact, rounded to a step of 27 or 28 places.
docs/proofs/k-u10.md has the whole account.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 22:39:13 -07:00
swaitsandClaude 5777787b69 test(core): exact Decimal arithmetic refuses nothing it could hold
The independent review of K-U10 found the bridge properties proved one
direction only. They compared the kernel with an expectation built from
rust_decimal's own result, so they showed a figure returned is exact, and
could not show that an exact figure is never refused. Each of add,
subtract, multiply and exact division is now also Some exactly when the
rational result is a Decimal (a mantissa under 2^96 at a scale of 0 to
28), decided from the rational alone. All hold: no change to the kernel.

Also from the review:
- the FX product rounded once is checked at steps of every scale, not 0 to
  3 places, and a None is accepted only at the two bounds the code states;
- one refusal the docs did not state is now stated and pinned: a product
  that is not exact, at a step of 27 or 28 places, is None though its
  rounded figure can be a Decimal (the one rounding needs two places
  below the step and Decimal ends at 28). No currency's step is near it;
- running totals are checked over thousands of lines, and the first
  refusal is pinned (line 7,923 of the largest ten-place amount, where
  rust_decimal drops a place and rounds);
- three stale sentences: percent_of's product is exact or refused since
  this unit (only its division rounds), the header of allocate.rs, and
  the table in docs/proofs/k-u10.md, which now records the review.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 22:18:54 -07:00
swaitsandClaude 3bbef05cb7 build(packaging): the Linux packages carry the third-party notices as a file
The .deb, the .rpm and the Arch tarball install THIRD-PARTY-NOTICES.txt
under /usr/share/doc/wanderbooks/, where a distribution's reader looks
for it; the program prints the same text (`wanderbooks licenses`), and
the package test compares the two after the upgrade. The AppImage, the
.dmg and the Windows program carry the text compiled in.

Not checked by a package build: the first `just package-linux` and
`test-linux-packages.sh` run does that.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 22:00:44 -07:00
swaitsandClaude 7568bca7b0 build(notices): a crate's own licence file where the generator gave a placeholder
MIT, BSD and ISC ask that the copyright notice itself travel with a copy,
not only the licence's words. For 70 of the crates the program links,
cargo-about could give only the licence's standard text, whose copyright
line is a placeholder ("Copyright (c) <year> <copyright holders>"):
the crate's own licence file is a compound one it cannot match (chrono
and libm put two licences in one file, aws-lc's is 316 lines of several,
the windows crates indent theirs), or the crate was packaged with no
licence file at all (egui, objc2, wasmi and 32 more).

scripts/notices-packaged.py reads cargo-about's output, finds every
section with such a placeholder, and adds a part to the file: the licence
files those crates were packaged with, whole, each distinct text once
under the crates that carry it, and for the 35 packaged with none the
repository their manifest names. It reads the crates where cargo has them
(cargo metadata, locked and offline), so the text still depends on
Cargo.lock alone; two runs are byte-identical. The file grows from 551 KB
to 707 KB. The test for `wanderbooks licenses` now asks for a copyright
line that only a compound file holds.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 22:00:44 -07:00
swaitsandClaude 9d1cb28f22 merge: third-party licence notices, generated, checked and printed by the program (checked, small rework)
Every MIT, Apache, BSD and ISC crate and every bundled font asks that its
notice travel with a copy of the binary. THIRD-PARTY-NOTICES.txt is
generated from the lock file (cargo-about) and the font licences, compiled
into the program and printed by `wanderbooks licenses`; the lint part of
`just check` fails when it is out of date.

Checked before merging: the accepted list equals deny.toml's; two runs are
byte-identical; the check exits 1 on a changed file and 0 after
regenerating; no path or user name in the text; the three ledger-cli test
files pass (licenses 4, hostile_args 6, one_executable 9); fmt and clippy
clean.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 21:46:23 -07:00
swaitsandDeepSeek V4.1 Flash 9baf71b2a5 feat(cli): wanderbooks licenses prints the notices compiled into the program
The notices must reach the person holding the binary, not only the
repository: THIRD-PARTY-NOTICES.txt is compiled in with include_str!,
so `wanderbooks licenses` prints the program's version line and then
every crate's and font's licence without opening books or reading a
file. A closed pipe (`| head`) is ignored, not a panic.

Tests check the version line, the notices required in the output, that
the bytes after the header are exactly the repository's file, and that
the mode takes no arguments and must come first like every other.

Docs: the testing table says what `just notices` writes and how
`notices-check` fails on a stale file; the architecture's list of modes
names licenses.

Co-Authored-By: DeepSeek V4.1 Flash
2026-11-09 21:17:56 -07:00
swaitsandClaude e46fa4fc6e fix(core): an exact division refuses a rounded quotient
`Amount::checked_div_exact` promises the exact quotient or nothing: "never
a rounded share". On Decimal it checked the quotient by multiplying back,
but with rust_decimal's own product, which rounds. A rounded quotient
times the divisor rounds back to the dividend (10 / 3 is 3.333...3 at 28
places, and 3.333...3 x 3 is held as 10), so a third, a seventh and a
ninth all passed as exact.

No figure in the books was wrong: the one caller divides a basis-point
product by 10,000, which is always exact. The contract was broken for
the next caller. The check now multiplies back exactly (K-U10's
`exact_mul`), so a rounded quotient is refused.

The bridge gets the property (a quotient returned, times the divisor, is
the dividend as a rational) and the named cases. The FX rounding
property also takes steps of 5 and 25 units, whose half steps sit one
place below the step: the wide product keeps that digit real.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 21:05:43 -07:00
swaitsandClaude c09f492c46 docs(verification): every Ledger command, and the step of the Lean model it is
bookspec proves its laws (the trial balance, the accounting equation,
posted is forever) for every state its steps reach. The engine has 119
public commands and the model 14 steps, and nothing said which command is
which step, so "every reachable state" read wider than it was.

docs/command-steps.md is that map, command by command: 71 are the
`record` step (they change how the books are kept and no figure), 11 are
one step, 19 are several steps run as one, 17 are the doors a journal is
replayed through, and one, `renumber_account`, is no step at all.

What the map shows that was not written down before:

- A renumber changes the chart's codes and the model has no step for it.
- Four doors apply a journaled change without a check the model's step
  requires (a draft dated in a closed period, a period overlapping
  another, a reversal dated before its original). Books replayed from an
  old journal can therefore be outside the model's reachable states. The
  laws resting on distinct codes, acceptable entries and known accounts
  still hold by reading their proofs; no theorem says so yet.
- The registers (assets, schedules, recurring entries, payroll runs) have
  proved arithmetic and no model of how they change over time.
- No proof ties a Rust command to its step: bookspec's examples and the
  differential test do, and the page lists what that test does not reach.

Each closes with Lean in bookspec; the triage (P2.5) lists them.

tests/command_steps.rs keeps the map whole: a command with no row, a row
with no command, a step the model does not have, or a new command marked
as no step without being added to the pinned list fails the build.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 21:00:11 -07:00
swaitsandClaude Sonnet 5.5 786e503858 test(core): the Decimal edges are refused, not rounded
The bridge compares impl Amount for Decimal's add, subtract and multiply
with rust_decimal's own result and with an independent BigRational
reference over every mantissa to 2^96 - 1 and every scale 0 to 28: a Some
is the exact result; an exact old result is returned unchanged, compared
as strings; a rounded one is None; an overflow stays None. Over the posted
range (line cap, ten places, any raw scale) sums, differences, running
totals and FX products are identical to the old to the character, and the
FX product is checked rounded once from the exact one in all four
rounding modes. Unit tests check the private 256-bit helpers against
num_bigint.

The pinned findings now assert the law holding:
finding_decimal_add_rounds_dust_at_the_edge and
finding_decimal_add_rounds_scale_near_the_top become
a_sum_past_exact_arithmetic_is_refused,
the_mantissa_edge_is_outside_the_precondition_and_pinned becomes
the_mantissa_edge_books_the_exact_products_cent (10500000099.89, which the
reference gives; the old 99.90 was a double rounding). Expectations that
moved are all outside what a posted line carries: 599 parts of 1.3e26 at
the cent sum past 96 bits (schedule::the_edges), the 26-place product now
rounds once to 0.00, and the replaced-chain comparison refuses a step
rust_decimal rounded. No golden changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 20:46:19 -07:00
swaitsandClaude Sonnet 5.5 38da08b2c2 fix(core): Decimal sums and products are exact or refused
rust_decimal's checked_add and checked_mul return None only when the
integer part overflows. When the exact result needs more than 96 bits of
mantissa, or a scale past 28, they round it and return Some: MAX + 0.4 is
Some(MAX) (K-U4), 0.01 + 792281625142643375935439503.35 is ...503.4
(K-U8), 1050000010.0000000001 x 9.9999999999 is 10500000099.895 where the
exact product is 10500000099.89499999999999999999 (K-U1), and
123456789.0123456789 squared loses its last digits (K-U3). The kernel's
contract is exact or None, and BS-ledger-1 says a product the arithmetic
cannot hold MUST be refused.

impl Amount for Decimal now runs rust_decimal's operation and checks, in
256-bit integers (kernel/decimal_exact.rs), that the figure equals the
exact sum or product as a rational; otherwise None. It builds no rounded
figure of its own, and an exact result is returned as rust_decimal gave
it, scale and all, so nothing exact moves. Comparing values is complete
where the K-U10 row's "result scale fell below the operands'" test is not:
100 x 0.3333333333333333333333333333 is exact with a full-scale mantissa
past 96 bits (trailing zeros), and percent_of computes it for every
ratio. checked_sub is rust_decimal's subtraction under the same check
(the trait default gave -0 for 0 - 0). Money::checked_add and
checked_sub go through Amount; sum_exact*, add_exact and sub_exact already
did.

Two products could not simply become exact, and the suite found both:
- Shares multiply a cent amount by a many-place percent
  (33.333333333333333333333333333, 27 places) and then divide, which
  rounds anyway (spec_cash_flow's government payment). They use the new
  Amount::checked_mul_rounded, rust_decimal's own product, so every share
  is the figure it always was.
- A foreign amount at a rate (fx_booked) rounds once, from the exact
  product: Amount::checked_mul_round_to_step holds it in 256 bits, cuts it
  only as far as Decimal needs with a sticky digit for what was cut, and
  rounds with round_step. The one posted-range figure that moves is the
  one the old double rounding got wrong: 1050000010.0000000001 x
  9.9999999999 books 10500000099.89, the exact product's cent, not
  10500000099.90.

checked_div and checked_div_exact are unchanged. Inherent
Decimal::checked_* calls outside the kernel are listed in
docs/proofs/k-u10.md and not converted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 20:46:19 -07:00
swaitsandClaude 0e9990f111 merge: one rounding for display, percentages in Decimal (K-U9; checked, one fix)
Three crates each rounded an amount for display in their own way, and
the viewer computed its percentages in f64. Money is never a float, not
for a ratio either (AGENTS.md's first rule), and a figure shown should
not depend on which renderer drew it.

- `ledger_import::format::round_display(amount, places)`: half away
  from zero through the kernel's `round_places`, never a negative zero.
  The reports' text, the PDFs, the spreadsheet, the CPA package's text
  and the viewer's formatting all call it.
- The viewer's percentages (`fmt::pct_change`, the Profit page, the
  reports' change and share-of-income columns) are the kernel's
  `percent_of` on Decimals.

What a reader sees differently, by principle and not by accident:
- `compact` rounds half away from zero like every other figure:
  1,250,000 reads $1.3M (was $1.2M), 10,500 reads $11k (was $10k).
- A change against a base that is zero or negative shows no percentage
  ("—"), where it used to show one with a misleading sign: from a loss
  of 100 to a loss of 50 is not "50% down".

No booked figure moves and no golden changed. One fix on merge: the
demo books' platform fee is a booked amount, so it uses the kernel's
rounding with the rule it always had (a half to the even cent), not the
display rounding the branch had put there; the demo books are unchanged.

Shown on main: clippy clean on the three crates; ledger-import's unit
tests 44 passed and spec_import, labels, templates 91 passed;
ledger-package 49 passed; the viewer's unit tests 62 passed, and
display_rounding, view_model, sidenav, spec_gui, odd_cent 59 passed;
ledger-core's bookspec checks 78 passed (the worker's one failure there
was its old base, which lacked the pin at bookspec 79cb439).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 20:43:00 -07:00
swaitsandClaude 1726c8b6dd build(deny): a supply-chain gate: advisories, licences, sources (cargo-deny)
Nothing checked what the program is built from. `just deny` now does, in
the lint part of `just check` and weekly in scheduled.yml (an advisory
is published when it is, not when we push), from one file, deny.toml:

- advisories: no crate in the lock file with a known vulnerability
  (RustSec), none yanked; an unmaintained crate is refused when it is
  one of our own direct dependencies. Two advisories are lived with,
  each with its reason and date: the quick-xml 0.38 that typst's
  citation reader brings, which no XML from outside reaches.
- licences: the permissive ones, plus MPL-2.0 for one unchanged crate
  (option-ext) and CDLA-Permissive-2.0 for Mozilla's root certificates.
  No font licence is allowed, so a crate that carries fonts is refused
  and every font we ship is a file here beside its licence. A crate
  offering only a copyleft licence is refused.
- sources: crates.io and the bookspec repository, nothing else.
- bans: no dependency by wildcard version.

The crates are marked `publish = false` (one line in the workspace,
inherited by all eleven): they are parts of one program, not libraries
for crates.io, and with that cargo-deny accepts their path dependencies
on each other.

cargo-deny 0.20.2 is a build tool pinned in mise.toml, not a dependency
of the program.

Shown: `just deny` prints advisories ok, bans ok, licenses ok, sources
ok on this tree.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 20:03:51 -07:00
swaitsandClaude 9ad6f89816 fix(deps): 23 known vulnerabilities closed; the XLSX reader keeps & in a cell
The first run of cargo-deny on the lock file (2026-11-09) listed 23
RustSec advisories, one unsound crate and two yanked ones. This closes
all but two by upgrading; the two are a second copy of quick-xml that
typst brings and that reads nothing from outside (the gate's file,
next commit, says so with its reason and date).

A wrong answer found on the way. quick-xml 0.42 reports a character or
entity reference (`&amp;`, `&#38;`) as an event of its own, where 0.38
handed it over inside the text. The reader's first build on 0.42 took
only the text events, so a cell holding `AT&amp;T` read as `ATT`: a
payee's name, changed without a word, on its way into an import. The
reader now turns each reference into its character (the five XML names,
decimal and hexadecimal numbers) in shared strings and in inline cell
text, and refuses a file whose reference names no character rather than
dropping it. Two new tests: a reference in a cell is its character; a
reference to no character is refused.

What moved, and the advisory each closes:
- quick-xml 0.38 -> 0.42 in ledger-reader, the copy that parses files
  from outside (RUSTSEC-2026-0194, -0195: a slow or memory-hungry parse
  of hostile XML).
- rusqlite 0.32 -> 0.41, with `fallible_uint` so a u64 past i64::MAX
  is an error and never a wrapped number (libsqlite3-sys,
  RUSTSEC-2026-0459). One test's use of `column_names` follows the new
  signature.
- rust_xlsxwriter 0.90 -> 0.102, which drops the old zip 4
  (RUSTSEC-2026-0367, -0368, -0369, -0429).
- In the lock file only: rustls (-0346 to -0349), rustls-webpki
  (-0382), webpki-root-certs (-0383), ctutils (-0385), tokio (-0386),
  zstd, zstd-safe and zstd-sys (-0391, -0398, -0403, -0410),
  pulldown-cmark (-0433), rmcp 3.5 -> 3.9 (-0457, -0461, -0462), and the
  yanked async-executor and clipboard-win.
- fuzz/Cargo.lock in step, so the fuzz targets build what ships.

No new dependency of ours: rsqlite-vfs and sqlite-wasm-rs enter the
lock file as rusqlite's own, for a target (wasm) we do not build.

Shown: `cargo check --workspace --all-targets` clean; `cargo test` of
ledger-reader (4 passed), ledger-import (145 passed, 2 ignored) and
ledger-store (579 passed, 2 ignored, exit 0). The store run kept its
scratch files in memory (TMPDIR on tmpfs): on the loaded disk a synced
write took 30 ms and the refusal law alone ran past half an hour.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 20:03:28 -07:00
swaitsandClaude b66dff899d fix(viewer): every font the viewer ships is named, with its licence beside it
egui's default font set (the crate epaint_default_fonts, switched on by
the `default_fonts` feature) includes Ubuntu Light under the Ubuntu Font
Licence 1.0. Debian and Fedora class that licence as non-free, so a
package of wanderbooks carrying it could not go into either. The viewer
never drew a letter with it (all text is Inter), but the file was
compiled into the program all the same.

The feature is now off, on eframe and on egui, and epaint_default_fonts
leaves the lock file. The viewer names its whole font set in theme.rs:

- Inter (InterTab, as before) for all text: SIL OFL 1.1.
- Hack for fixed-width text: MIT, with the Bitstream Vera licence.
- Noto Emoji for symbols: SIL OFL 1.1.
- emoji-icon-font for the few symbols Noto Emoji lacks: MIT.

The last three are the files egui's set held, copied byte for byte
(SHA-256 in assets/fonts/README.md), each now beside its licence text.
They are files in this repository, not new dependencies. The OFL stays:
it is Inter's own licence, it allows bundling with software under any
licence, and Debian, Fedora, the FSF and the OSI accept it.

Without the default set a missing glyph is an empty box, and nothing
said so. A new test lays out every symbol the viewer's source draws and
fails on one no bundled font has. It compares what is drawn with what is
drawn for a code point no font has, since egui's `has_glyph` answers no
for every character of the font that holds the replacement glyph. The
test checks itself on a Cherokee letter, which no bundled font covers.

Shown: `cargo test -p ledger-gui --lib theme` 2 passed; the side
navigation's snapshot is unchanged (12 passed); the 33 screenshots of
the demo books (tests/screens.rs) show Inter, Hack in the journal's
hashes and JSON, and every arrow, check mark and icon drawn.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 19:50:19 -07:00
swaitsandMuse Wonder 1.0 2463c10af9 test: display rounding and percent rules (K-U9)
Tests encode the display rules: half away from zero, no negative zero, no percent of a zero or negative base, plus a scoped source check that no round_dp or float conversion remains in the money display paths. view_model's pct_change(-100, -50) expectation moves from Some(50.0) to None under the new rule. docs/proofs/display.md is the unit note (no Kani, no Lean for display, per the audit).

Co-Authored-By: Muse Wonder 1.0
2026-11-09 18:54:30 -07:00
swaitsandMuse Wonder 1.0 a7d0c7f2d3 fix(viewer): percentages are Decimal, never f64
fmt::pct_change divided money amounts in f64 (a money path, AGENTS.md rule 1) and fmt::compact shortened amounts through f64; both are now Decimal via kernel::percent_of and round_display. profit::pct, the reports change and share columns follow the one percent rule: no percent of a zero or negative base (shown as nothing or an em dash). Every pages round_dp call goes through round_display; books' cent truncations keep their toward-zero leftover policy through kernel::round_places.

Co-Authored-By: Muse Wonder 1.0
2026-11-09 18:54:24 -07:00
swaitsandMuse Wonder 1.0 a414462be7 refactor(display): one rounding for presentation
Move format_amount's rounding half (half away from zero, never a negative zero) into ledger-import::format::round_display, through the kernel's round_places. format_amount, amount_parts, the PDF percent column, xlsx's exact_f64 and ledger-package's text padding all call it, so a display change never changes a booked figure.

Co-Authored-By: Muse Wonder 1.0
2026-11-09 18:54:17 -07:00
swaitsandClaude 09a8707e20 test(core): the legacy close bound is held a tenth of a unit past it
V-D3's test checked the bound B(n) = max(u, (n-1)u/2) at the bound and
one whole unit past it, so a bound a unit too wide would have passed.
It now refuses a drift a tenth of a unit past the bound, on both signs,
for two, three, four and five members: the bound is exactly the one
derived from BS-partner-1 statement 6, not something near it.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 17:32:57 -07:00
swaitsandClaude 32725fb669 fix(core): Decimal arithmetic in ledger-core goes through the kernel (K-U11a)
Bar item 1: money arithmetic lives in kernel/ and nowhere else.
scripts/raw-decimal-arith.sh listed 210 places in ledger-core that did
not: raw +, -, * and unary minus (which panic past Decimal's range), and
checked_add / checked_sub / checked_mul / checked_div calls that
resolved to rust_decimal's inherent methods (which round silently past
28 digits) and not to the kernel's Amount. 199 of them now call the
kernel: Amount's methods by their full path, total / total_of for the
hand-rolled sums, normal_balance, and money.rs's sign and in-range
helpers.

The rewrite was done by a script from the compiler's own line and
column for each site, so no site was copied by hand; the few that
needed a decision are explicit:
- a balance sheet that cannot add liabilities and equity is not
  balanced (it panicked);
- a template's shares, a party's percents, a reconciliation's book and
  cleared balances and a reversal's document movements refuse with
  TooLargeToCompute or their own message where they panicked;
- tax_capital's split refuses where a product by the sign could not be
  taken, and collects its remainders as Options.
No figure moves: every site computes what it computed, by the same
operations in the same order.

Left, each for a named reason (the detector prints these 11):
money.rs 139 and 150 and periods.rs 149 and 202 (K-U10a rewrites them),
audit.rs 355 and 511 (V-D3 is in them), ledger.rs 4048 (a share times
the closed total: checked_mul_rounded, with K-U10a), and four rescale
calls (money.rs 302, reports.rs 637, schedules.rs 370 and 377) that
need a kernel function of their own.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 17:22:17 -07:00
swaitsandClaude e0c78a783b refactor(core): a line's sign and an in-range sum, said once over the kernel
Twenty modules each wrote 'debit plus, credit minus' and 'a + b' for
themselves, on raw Decimal operators. Five helpers in money.rs say them
once, over the kernel's signed, flip and Amount: neg, signed_amount (a
line's amount as a movement), on_side (plus on an account's normal side,
minus on the other), and add_in_range / sub_in_range for sums of posted
lines, which the line cap keeps far inside Decimal's range.

Two tests hold them to the raw operators bit for bit, the scale and the
sign of a zero included. The second fails today, and it is right to:
the kernel's default checked_sub is an add of the negation, and
rust_decimal answers 0.00 + (-0.00) with -0.00 where 0.00 - 0.00 is
0.00. K-U10a gives Decimal its own exact_sub (rust_decimal's own
difference, checked for exactness); the test passes once it is merged
under this branch.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 17:22:16 -07:00
swaitsandClaude abafa94a53 merge: the audit checks a close's split at the allocation's unit, and a legacy close by its member count (V-D3)
The audit took a cent for every currency, so a JPY close (split in whole
yen) was checked a hundred times too finely, and a code with no minor
unit too coarsely. The unit now comes from the one helper the split
itself uses. Before the true-up, a last-absorbs close's last member may
carry half a unit for each of the others (BS-partner-1 statement 6), so
the bound is max(u, (n-1)u/2), derived and marked so, not one unit.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 17:02:26 -07:00
swaitsandClaude Sonnet 5.5 b810e6102b test(core): what exact tie ranking moves
Keeps the old ranking (the rounded quotient's remainder, built from the
kernel's own share_of, round_places and apportion) as a reference and
measures, over realistic inputs (whole-cent amounts to 1,000,000.00, two
to five parties, whole-percentage or small-integer weights), how often it
differs from the exact ranking. Run with --nocapture for the table.

What it shows: the rankings part only at an exact tie between unequal
parts over a total whose division does not terminate. Equal weights never
differ (every remainder is equal, so both give the leftover cents to the
earlier parts); two parties never differ (a tie leaves each share ending
in exactly half a cent, a terminating quotient); percentages summing to
100 never differ (the quotient is exact). A difference is at most one
cent a part and the parts still sum to the whole. The tests assert that
structure and print the rates.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 16:39:12 -07:00
swaitsandClaude 129a90dcf1 fix(test): recorded failures are replayed again; a seed file no test reads fails the build
A failure a property test once found is kept as a seed and replayed on
every run: that is what makes a fixed bug stay fixed. Proptest finds
the seed file from the test's source path and says nothing when the
file is not there, so a seed file left behind by a moved test is never
read again, silently.

Four findings, one cause:

- The kernel bridge's three recorded failures (the constructive split
  with a short remainder, and two cash-application cases) sat in
  tests/kernel_bridge.proptest-regressions. Since 0cf013b57 the bridge
  is a folder (tests/kernel_bridge/main.rs), and a folder test reads
  tests/proptest-regressions/main.txt. The three had not been replayed
  since. Moved there.
- K-U8 found a control-total case (a sum that touches Decimal's top,
  f = [0, -1, -79228162514264337593543950335, 0, 5]) and the seed was
  never checked in; it lay untracked in the unit's worktree. Added as
  tests/proptest-regressions/control.txt, where control.rs reads it.
- ledger-mcp's proptest-regressions/local_files.txt recorded failures
  of a module removed in b26c099a6 (files reach the books as uploads
  by hash now). No test can read it. Removed.
- Nothing checked any of this. tests/seed_files.rs walks every crate
  and fails when a seed file has no property test that reads it.

How the reading rule was established, not assumed: a marker line in
each candidate file, and proptest's "unparsable line" warning names
the file it really opens.

With the seeds back, the bridge passes whole (101 tests), so nothing
had regressed behind the gap. The guard was red before the move (it
named both orphans) and is green after: 21 seed files, each read by a
property test.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 16:02:06 -07:00
swaitsandClaude 0ef1ef2c22 build: pin bookspec at 79cb439, the payroll and control laws
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
K-U7 moved payroll's net pay into the kernel and K-U8 moved the control,
aging and reconciliation identities there. Their laws were written once,
in bookspec's Lean: law 45 (net pay is gross less every deduction, and a
payroll plan balances at any number of employees) and law 46 (the control
difference, the aging total and the reconciliation total). The checker and
the Lean package move to that rev together, so the pin test holds.

Proved at this pin: the Kani fast set, 97 harnesses, none failed and every
cover reached; Lean, 212 theorems on the standard axioms only. The Kani
set was verified in two runs (93, then the 4 the whole-set time cap cut
off on a loaded machine), and the Lean half in a shell of its own.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 15:48:40 -07:00
swaitsandClaude Sonnet 5.5 294cb99a58 fix(core): a tie between shares goes to the earlier part, exactly (held for the owner's decision)
split_by_weights_into's largest-remainder policy ranked the leftover
cents by the rounded quotient's remainder (Decimal keeps 28 significant
digits), so an exact tie was decided by the quotient's last digit, not
given to the earlier part as apportion's docs and bookspec's Lean model
(Apportion.lean: remW = x*w % W, ties to the earlier member) say.
20.00 by 4/1/1 over 6 gave 13.33, 3.34, 3.33 where the exact tie of
remainders (0.02 over 6 each) belongs to the first: 13.34, 3.33, 3.33.

It now ranks the exact integer remainder whole x weight - part x total
(the quantity share_floor_with returns), sign-flipped for a negative
total so the order stays the share's own. The parts still sum to the
whole and each is within one step; only which part takes a tied cent
changes. Stored entries never move (posted is forever); a report
recomputed for a past period can move a cent between parties.

The finding test is flipped into the law (ties_go_to_the_earlier_part),
the bridge's ranking property now includes ties, and the spec block,
k-u3.md and verification.md say ties go to the earlier part, exactly.

This branch is held: the owner decides whether the cents may move
(see tests/kernel_bridge/ties.rs for what it moves).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 15:37:06 -07:00
swaitsandClaude 5cad55023f fix(test): the backup folder test names a folder the host calls rooted; the portable jobs report every failure
The portable-windows gate has been red on main for four pushes
(7a5cb6873 to 652f9da87). The settings test V-D2 added set
backup.folder to /mnt/backup/books. A backup folder is a folder on the
server's own computer, so the key is checked by the host's path rules,
and on Windows that path names no disk: the check refused it, rightly,
and the test's unwrap panicked. The rule and the code are unchanged;
the test now names a folder the host takes (D:\backup\books there).

cargo test stops at the first failing test binary, so that one test hid
whatever fails after it. The two portable jobs take most of an hour
each; they now run with --no-fail-fast, so one red run shows every
failure.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-09 15:17:30 -07:00
swaitsandMuse Wonder 1.0 02087ef3fb fix(core): a legacy close's drift before its true-up is the rule's, not one unit
Before a count is trued up, check_split flagged any drift beyond one unit. BS-partner-1 statement 6 allows a legacy last-absorbs close more than that with four or more members, so the audit raised a false finding on legitimate legacy books.

The rule does not state an audit bound; this bound is DERIVED from statement 6's per-member facts, and the derivation is in check_split's spec block: with n members and unit u, each member but the last was rounded to within u/2, and the last absorbed the sum of those roundings, so |e_last| <= (n-1)*u/2. Floored at u (statement 6's allowance for each run break and each per-close close), the pre-true-up bound is B(n) = max(u, (n-1)*u/2): 1.5 units with four members, 2 with five. A drift of exactly B(n) is legitimate and not flagged; past it is. After the true-up, statement 5's strict bound still holds: a drift of a unit or more is flagged.

WB-ledger-16 invariant 8 now states B(n) and marks it derived.

Tests: a_legacy_last_absorbs_close_drifts_by_member_count_before_its_true_up (BS-partner-1 statement 6 before the true-up, statement 5 after it; WB-ledger-16 invariant 8): four- and five-member closes at their largest legitimate drift are not flagged, one unit past it they are, and after the true-up the strict >= unit bound holds.

Co-Authored-By: Muse Wonder 1.0
2026-11-09 14:50:38 -07:00
swaitsandMuse Wonder 1.0 5b1596f977 fix(core): the audit checks a close's split at the allocation's unit
audit::closes took its unit as minor_units().unwrap_or(2), while the members allocation splits at allocation_places() (minor_units().unwrap_or(MAX_LINE_SCALE)). For a currency code with no minor unit the audit therefore checked a split made at the finest a line carries against a cent: far looser than the split it checks, so real drift passed.

Add Currency::allocation_unit(), the one helper that turns allocation_places() into an amount, and take the audit's unit from it, so the split and its check cannot drift apart (BS-partner-1 statement 4: the allocation is the split to the base currency's smallest unit). A JPY close is now checked at a whole yen.

Test: a_jpy_close_is_checked_at_the_allocations_unit (BS-partner-1 statement 4, WB-ledger-16 invariant 8).

Co-Authored-By: Muse Wonder 1.0
2026-11-09 14:48:59 -07:00
swaitsandClaude Opus 5.5 4da1c5b30f fix(proofs): K-U7's overflow harness takes i64::MIN, with the native subtraction
K-U7 and K-U8 found the same thing from two sides: the integer model's
subtraction negated the subtrahend first, so x - i64::MIN was refused
where it fits. K-U7 assumed the minimum away and asserted the refusal;
K-U8 made i64 and i32 subtract natively. With both merged the
assumption goes: the harness ranges over the whole i64 domain, minimum
included, and asserts -1 - i64::MIN = i64::MAX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:52:41 -07:00
swaitsandClaude Opus 5.5 8aa0ed985d merge: the control, aging and reconciliation identities in the kernel (K-U8; reviewed, fixes applied)
Three identities the books rest on are kernel functions now, proved
rather than only summed: an aging's five buckets add to the document
total (aging_total), a control account's difference from its documents
and unattached lines (control_difference), and the K-1 reconciliation's
total (reconciliation_total). Kani proves each, None exactly on
overflow; bridge properties check them against an exact integer
reference and the replaced chains on 20,000 cases, scale included; law
46 in bookspec's Lean. The CPA package's aging now refuses a total past
exact arithmetic instead of panicking. The harnesses found the integer
model's subtraction negating first, so x - MIN was refused where it fits;
i64 and i32 now use the native subtraction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:52:10 -07:00
swaitsandClaude Opus 5.5 a37612d07c merge: payroll's net pay in the kernel (K-U7; reviewed, fixes applied)
Net pay is gross less the withholdings and deductions, now one kernel
fold (net_pay) with the plan's totals through the kernel's checked
totals; payroll_remit_plan refuses a total past exact arithmetic instead
of panicking. Proved: Kani (net pay equals gross less the deductions,
None exactly when a running difference overflows, the plan balances for
an employee), bridge properties against an exact integer reference at
every prefix, and law 45 in bookspec's Lean for any number of employees.
No figure moves; every golden unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:52:02 -07:00
swaitsandClaude Sonnet 5.5 b31824b2ca test(core): K-U7 review: None-iff-overflow proof, covers that can fail, a sharper bridge
- Kani net_pay_none_iff_a_prefix_overflows proves what the doc claimed:
  None exactly when some running difference leaves the i64 range, else
  the exact i128 result. It found that i64's Amount::checked_sub negates
  first, so a deduction of i64::MIN (no negation) is refused where the
  difference would fit (-1 - i64::MIN). Conservative, and Decimal's range
  is symmetric, so the engine is unaffected; the harness assumes it away
  and asserts the refusal at the fixed case; the kernel doc says so.
- payroll_plan_balances: covers that the assumes did not already force
  (net of one unit, payables holding employer shares alone, federal or
  state posted); the harness doc says it rebuilds the plan on i64 rather
  than calling payroll_entry_plan, and what that does and does not prove.
- Docs name the Lean theorems that carry any number of employees
  (payroll_run_net_eq, payroll_run_plan_balances) where they had
  claimed it.
- Bridge: compare to_string as well as value (Decimal equality ignores
  scale); a strategy near Decimal::MAX/MIN where the reference also
  returns None, which required the reference to check every running
  difference as the kernel's fold does, not only the last.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 13:50:54 -07:00
swaitsandClaude Sonnet 5.5 46dccd5d76 fix(core): payroll_remit_plan refuses past exact arithmetic instead of panicking
The remittance plan totalled the payables with a raw `total +=`, which
panics on Decimal overflow, on a pub fn returning a bare plan. Its
callers refused first through sum_exact_of, but that was an unenforced
precondition (BS-entry-4: every derived figure is checked arithmetic).
It now returns Result<_, LedgerError>, totalling through
kernel::total_of and refusing TooLargeToCompute; Ledger and the store
propagate it and keep their pre-checks. A test shows payables past the
range, up and down, are refused, not a panic.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 13:50:54 -07:00
swaitsandClaude Sonnet 5.5 80c93179b5 test(core): bound the rounded figures against the exact value
A rounded step can later return to scale 2, so the bound is four whole
units in cents, not one unit at the final scale.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 13:17:12 -07:00
swaitsandClaude Sonnet 5.5 c8cfd32723 test(core): the control harnesses prove None only on overflow; i32/i64 checked_sub is native
The tightened harnesses assert Some whenever every i128 prefix fits in i64.
That found the default Amount::checked_sub refusing x - MIN on i32/i64 where
the difference fits; both now use the native subtraction. The bridge pins
aging_total(0,0,0,0,MAX) to Some(MAX), bounds the rounded figures to one
unit of the exact value, and covers scales 0..=28. Two smaller worksheet
harnesses (nine terms on i32, seven on i32) found no verdict in 400 s and
300 s: recorded, no harness.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 12:53:09 -07:00
swaitsandClaude Opus 5.5 652f9da877 build: pin bookspec at ed6e379, payouts, tags, prepaid contributions
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
check / check (push) Canceled after 0s
bookspec main now carries X-H1e2: the last examples slice, two rules left
without one (BS-asset-9, BS-partner-16, which the engine does not do).
112 of 139 examples run and pass, the other 27 are for options
wanderbooks did not pick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:51:31 -07:00
swaitsandClaude Sonnet 5.5 632a1a543c fix(package): the agings refuse a total past exact arithmetic instead of panicking
The CSV total and the statement's column totals used raw Decimal += and a
five-term sum, which panic at the edge. They now go through
kernel::total_of and kernel::aging_total and return TooLargeToCompute as an
error (BS-entry-4). Only the error path changes; no golden moves.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 12:39:11 -07:00
swaitsandClaude Sonnet 5.5 b4b233e486 test(core): Kani and bridge for the kernel control identities
Kani proves, on arbitrary i64s with an exact i128 specification, that
aging_total is the sum of its five buckets, control_difference is
balance - documents - unattached and vanishes exactly when the account
agrees with its subledger, and reconciliation_total is beginning + gain
+ without - distributed; in-range figures always total (law 45). The
book/tax worksheet statement did not finish in the solver (500 s at nine
terms, 110 s at seven), so Lean's reconciliation_identity carries it and
a bridge property checks it on i64 and Decimal; written down in
docs/proofs/k-u8.md rather than weakened.

The bridge compares i64 against Decimal and Decimal against an
independent exact i128 reference over the whole mantissa range, pins the
Decimal edges (each overflowing step is None, never a panic), and checks
the kernel against the three hand-written chains it replaced, as strings
including scale, on 20,000 random Decimals: identical. The reference
also shows rust_decimal rounds an add to a coarser scale wherever the
exact result needs more than 96 bits at the operands' scale (K-U4's
finding, wider than the MAX edge); pinned as a canary for K-U10.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 12:13:32 -07:00
swaitsandClaude Sonnet 5.5 a87e2d0a7a test(core): the adapter runs a platform's payout, an asset's tag and the K-1's tax-basis note through the engine
The bookspec schema gained a `payout` event, a `tag_asset` event, an
`asset_tag` query and a note on the tax-basis property line (BS-revenue-1,
BS-asset-3, BS-partner-17). The adapter runs each through the engine and
rebuilds none of it: a payout goes through `payouts::payout_plan`, which
refuses unless gross less fee is the deposit to the cent, and its plan's lines
post as one entry; a tag goes through `Store::set_asset_tag`, which refuses a
tag of a wrong form and one another asset holds or ever held; the tax-basis
line's note is `Note::PrepaidAtBook` read off the worksheet. The engine's
InvalidPayout, InvalidAssetTag and AssetTagTaken are worded as the examples
word them.

Thirteen examples were added and every one the engine's picks reach passes:
five are for options wanderbooks did not pick (no-tags, every-prepaid-is-cash,
every-prepaid-is-property, left-open, whole-payment-to-each) and are skipped,
so the skipped count is 22 + 5 = 27 and 112 of 139 run. A prepaid contract
credited straight to capital is property (1,500.00 each) and a service paid
through Due to Members is cash (1,000.00 each); the contract enters the tax
capital at its book amount with the note; a 1,000.00 check naming Dana Studio
at 600.00 counts 600.00 toward Dana's 1099.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 12:05:15 -07:00
swaitsandClaude Sonnet 5.5 0df463b703 refactor(core): the control, aging and reconciliation identities in the kernel
Three identities were still hand-written chains at their call sites:
an aging row's five buckets summing to what is owed (BS-arap-1), the
control check's difference, balance less documents less unattached
lines (BS-arap-2), and the K-1 reconciliation total, beginning plus
built-in gain plus property without a basis less property distributed
(BS-partner-4). They move to kernel::aging_total, control_difference
and reconciliation_total, generic over Amount, returning None on
overflow, so each is a named law with a harness and a Lean theorem
rather than a sum.

Behaviour is identical: the same checked steps in the same order, so
figures, scales and TooLargeToCompute refusals are unchanged; every
golden passes untouched. The next commit's bridge compares the old
chains and the kernel as strings on 20,000 random Decimals of any scale.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 11:48:10 -07:00
swaits 90d34585fd Merge branch 'main' into t3/payroll-net-pay-kernel 2026-11-09 11:44:50 -07:00
swaitsandClaude Opus 5.5 e45c62348a build: pin bookspec at 6d85d8b, schedules that take the pick and the books' own facts
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
bookspec main now carries X-H1e1: a schedule may leave its method to the
engine, yen schedules, the IIF export's choices, settings, role
assignments and the tax summary in the schema; eight rules remain
without an example. Lean audits standard axioms only; 104 of 126
examples run and pass, the other 22 are for options wanderbooks did not
pick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:23:56 -07:00
swaitsandMuse Wonder 1.0 2295d15be8 test(core): the payroll plan harness carries one employee
The two-employee payroll_plan_balances timed out in CBMC: over 80
minutes at full CPU, killed with no result (sixteen symbolic figures
into eight totals and check_lines). The earlier note's 297.6s figure
came from a misattributed background result and is withdrawn here;
the harness as committed had never verified.

One employee reaches every plan line, both FICA shares on both sides,
net_pay and check_lines, and verifies in 62.0s (65.6s wall). Lean's
payroll_plan_balances carries the plan at its totals for any number
of employees, since a run's totals are sums of the same eight
figures. The bound and why are written in the harness and the note.

Co-Authored-By: Muse Wonder 1.0
2026-11-09 11:22:13 -07:00
swaitsandClaude Opus 5.5 1add7df419 merge: the adapter runs schedules that take the pick, yen schedules, the IIF's options and the books' own facts (X-H1e1's wanderbooks half; reviewed, re-checked)
Wanderbooks passes every bookspec example for its picks: 104 run, 104
passed, 22 for options it did not pick. A schedule plan is answered as
the engine holds it (a yen month 333, a dollar month 33.33); the IIF
line ending is cr-lf only when every line ends so; bookspec's setting
keys map to the engine's in one place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:18:25 -07:00
swaitsandClaude Sonnet 5.5 e49b6d3427 test(core): the adapter maps bookspec's setting keys to the engine's
Bookspec now closes its setting keys (fiscal_year_start); the engine's key is
company.fiscal_year_start. The event and the query both go through one map
(BS-ledger-9).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 11:17:14 -07:00