The tab, the sidebar's header and the Overview's heading all said the
company's name side by side. Now the tab is the company's identity (badge
and name); the sidebar header and the Overview heading are gone (the
summary sentence leads the page, at the theme's heading size); and the
status card at the foot of the sidebar opens with a heading row, the
badge and the name (the rail shows the badge alone, the name on hover), so
"these are this company's books: verified, live" is on every page, at the
opposite corner from the tabs. The top of the sidebar is an empty
`top_slot` for the assistant's connection state, a later unit.
Each company has one of eight badge hues (theme::BADGE_HUES, light and
dark) chosen by FNV-1a of the id of its books: a function of the id alone,
so it is the same on its tab and its card, after a restart, in any order of
opening and on every machine. A test computes the contrast of every hue in
both themes: letter 4.5:1, badge 3:1 on each surface it sits on.
No figure, date or amount changed. Regenerated: the tall sidebar's shapes
and pixel goldens (header gone, links moved up, card heading row, hue) and
the eight tabs_* snapshots (hue, Overview lead, the rail's badge).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A newer wanderbooks writes its lines one at a time, and the viewer may look
between two of them. With the unknown line last, nothing can check it, so the
viewer says "newer or damaged" (BS-format-1); once the next line lands it
says "update". Both are right. The test took the first error it saw and held
it to the "update" wording, so a look that fell between the test's two
appends failed it. The loader is unchanged by the fault: the test read the
first of two correct messages. The loader path is the same on main (0 of 30
runs failed there, 0 of 30 on the branch: the natural failure is rare, and
shows on a loaded machine); the branch's load only makes the gap likelier.
Seen deterministically by pausing the test 300 ms between its two appends.
The test now waits for the "update" and holds every message before it to the
"newer or damaged" one; a new test pins the between-the-lines look by waiting
on the viewer's first error before it writes the second line.
The same shape was in the background-tab test: it waited for the tab's seq to
move, which an entry's first journal line does, then asserted the posted
cash. It now waits for the cash itself.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A tab is the top level (D-78): the sidebar, with its badge, pages and
status, is the company in the tab, so the bar now runs across the whole
window above it. The bar's height (tabs::BAR_H) is taken from the window:
the four sidenav tests that size a window for the sidebar add it, through
that constant, and the smallest window is 400 points plus the bar. The
sidebar below the bar is pixel for pixel the old 1440x920 golden image;
only its shapes hash moved, with the shapes lower by the bar.
Tabs are as wide as badge plus name between a least and a greatest width,
the name elided with the full name in the hover; the one in front is the
lit surface with the accent bar, open at its foot. Room is left before the
close control for a later state mark. The + follows the last tab (at the
right edge, whole, when the tabs scroll), says 'Open a company' on hover,
and lists companies by remembered name with the id beside it; a name is
remembered when a company's books load (company.<id>.name) and titles a
tab before its books load.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
architecture.md: what a CompanyView owns, how ids are scoped, what a tab
behind keeps doing, how start-up restores tabs. testing.md: a record for
each new test, what it can't reach, mutation targets for P12, and why the
bar runs beside the sidebar (the owner's 519-point window).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A refactor that compiles and passes the old tests can still share state
between tabs, so these look for exactly that, on scratch data roots made
by Root::setup:
- two companies with different cash and rent show their own on the
overview, the profit and loss and a register; a search, page, period,
columns and comparison set in one leave the other's state and every
text it paints as they were;
- a sidebar scrolled in one tab is at the top in the other (fails, as
checked, when the view is not drawn inside push_id);
- a journal change in the tab behind is read while another is in front
and is on screen on the first frames after it is shown; books.show
moves its own tab only and brings nothing forward;
- closing a tab releases its viewer lock, ends its loader's thread and
its dock's agent process (a stand-in agent on a real PTY, the tab's own
owner), while the other tab's lock and loader are held;
- "+" lists only companies not open, none opens twice, the last tab
closed leaves the empty window in plain words;
- start-up restores tabs, their order, the front one, and each one's page
and period; a company that is gone or listed twice is skipped; the old
per-app keys are still written;
- read-only: the demo's two companies made read-only on disk, one
following live behind the other, every page rendered in it, the tabs
shown in turn, every file's bytes, size and time as they were;
- pictures of the bar with one, two and ten tabs, of "+" open and of the
empty window, light and dark.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The viewer was a window on one company: App mixed what is one company's
(loader, books, page, filters, receipts, dock, menus) with what is the
app's (the color scheme). Two companies in two tabs need those apart, or
a filter set in one tab shows in the other.
- company.rs: CompanyView owns everything per company, including its own
loader, its own handle to the Owner (the process-wide set_owner stays
the program's default, each view takes a handle when made and a test can
give a view another), its own dock and so its agent process.
- app.rs: App holds the per-app state, the views and which is in front.
A view not in front still reads its loader every frame and takes the
agent's books.show for its own page, so showing it later is current at
once and the loader's channel never piles up Books behind it.
- Every egui id a view makes is scoped by the view's own id (push_id around
the view; the owner dialogs' and the palette's modals, the pages' split
widths, the sidebar's footer memo and links memo take it too; the
projects' figure cache is keyed by the books). Otherwise egui's memory
(a scrolled sidebar) carries from one tab into the next.
- data.rs: dropping a Loader wakes its thread at once and the thread
stops, so a closed tab lets go of its watcher and its viewer presence
now and not at the thread's next look (up to 3 s); Loader::watch tells
a test the thread has ended.
- tabs.rs: the tab bar. One tab per company (the books' name, else their
id), the front one marked by a heavier name, an accent bar and
"selected" to assistive technology, not colour alone; a close control
on each (middle click too); "+" lists the data root's companies not
open; overflow scrolls with a step control at each end. It runs beside
the sidebar, not above it: above it the owner's 1479x519 window makes
the sidebar's links scroll (sidenav.rs), with a bar of 36, 28 or 24
points alike, so the sidebar keeps the window's whole height.
- lib.rs/app.rs: a company named on the command line is the only tab;
otherwise the companies open at the last close come back, in order,
with the same one in front and each one's page and report period; a
company that is gone is skipped, none left opens the data root's first.
The old per-app keys keep their names; open_companies, active_company
and company.<id>.* are new. The window's title names the company in
front.
- scheme_menu.rs: the scheme button and its state moved out of App as they
are (one scheme for the window).
A new tab's dock opens closed with the front tab's agent chosen, so
opening a company never starts an agent nobody asked for.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The owner wants Let's Encrypt swappable. Every candidate speaks ACME,
so the app knows the protocol only and takes the authorities to try
from the relay service; a swap is a server-side change, and the tests
fail over between two configurations.
docs/routing.md: Muse Code lists muse-ember-1.0 as of today, so
run-only tasks go to it, as the owner asked on 2026-11-09.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The relay answers for wanderbooks.link itself: every name is at the
relay, and a proof code is the one an app just handed in, so nothing is
stored per user. The owner doubted that a certificate per installation
is what Let's Encrypt is for; the plan now carries what Tailscale, Home
Assistant Cloud, Plex and Let's Encrypt's own pages say, the one denial
found, and the fallback authorities.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Decided 2026-11-20: the app is its own sign-in server and a new web
assistant is approved in its window (D-83); a web assistant reads and
drafts but does not post until the owner allows it for that connection
(D-86); each app holds its own certificate (D-87). D-84 and D-85 stay
the lead's engineering proposals.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The owner asked whether one wildcard certificate at the relay, with our
own encryption behind it, could replace a certificate per user. It
cannot be end to end, because the vendor's server speaks only HTTPS to a
trusted name, so whoever holds the certificate reads the traffic. He
kept the certificate per app. The plan now says what that leaves open
(we control the DNS, so a taken-over relay could get a certificate; the
app watches the public logs for one) and names a second authority as
the fallback.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A design, nothing built. The detached host is what makes packaging hard
on each system, and the people the product is for use chat products in a
browser. So the app's window becomes the host (a tab per open company,
agents reach a company only while it is open), and web assistants reach
the app through a relay on wanderbooks.link that routes by name and
cannot read traffic, the app holding its own certificate.
The owner's decisions of 2026-11-20 are D-77 to D-82; D-83 to D-86 are
proposed and wait for him. The bookkeeping rules do not change: the
window still only reads, and every entry still goes through the tools.
The delegation log gains the nine research and reading tasks behind it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The five-part check ran on CI for the first time (the slowest part done
43 minutes after the push, where the one job took 72), with deny,
notices-check and kernel-only in its lint part.
Co-Authored-By: Claude <noreply@anthropic.com>
just prove on 0178809a3 and just check on 3bc198594, the latter in two
runs since a two-hour limit stopped the first with nothing failed. What
is still unseen: CI on the push, and a built AppImage with the new rule.
Co-Authored-By: Claude <noreply@anthropic.com>
The AppImage launcher sets APPIMAGE (the image's file) and APPDIR (where
it is mounted) for the program it starts, and every program that one
starts inherits both: a terminal, an editor, an agent's app. The host's
start, the agent's pointer file, the host's check for a replaced program
and `update` each read APPIMAGE and believed it whenever it named a file.
So a wanderbooks run from inside another app's AppImage took that app's
image for its own:
- it started that image as the host, and the books never opened ("the
books server keeps failing to start");
- `connect` would have written that image into the agent's pointer file;
- `wanderbooks update` replaced that app's file with wanderbooks.
Found by the batch's gate: the_host_outlives_the_app_scope_that_started_it
passes its own environment on (the other tests clear it), and this gate
ran in a session started from an AppImage app. The first and the third
are reproduced by two new tests, which fail without this change (the
update test read an ELF header where the other app's file had been).
The rule now (start.rs INVARIANT 6, from the AppImage documentation's
"Environment variables"): the image is this program's own only when
APPIMAGE is an absolute file, APPDIR an absolute folder, and the running
executable's file is inside APPDIR, compared as resolved paths. One
function decides (`own_appimage`), and all four readers ask it. The host
is handed APPDIR beside APPIMAGE, and neither unless both are its own.
No books and no figure are touched. The tests that pretend to be an
AppImage now set APPDIR as a launcher does; translocation.rs used a bare
APPIMAGE to stand in for a macOS path, the very thing this closes, and
names the program's folder as the mount.
The failing test's message now lists the lines that did arrive, which is
what showed the host was refused rather than slow.
Not checked against a built AppImage (none has been built with this
change): the first trial of one shows `update` and a restart find the
image.
Co-Authored-By: Claude <noreply@anthropic.com>
STATUS gets a section for 2026-11-10: what the evaluation batch landed,
what is not verified yet (the one gate, CI, a package build), and what
is next. The roadmap said the parity floor was 21 rows enforced by
review; it is 36, enforced by a test and by CI, and its "Next" described
units that have all landed. The hand-off described `just check` and
`just prove` as they were before the five parts, the supply-chain and
notices gates, the kernel-only gate and the per-harness cap.
Co-Authored-By: Claude <noreply@anthropic.com>
The audit allows a member's running total (n-1)/2 units of drift, floored
at a unit, until the first close under the cumulative rule trues it up.
That figure is derived for one last-absorbs close. Books that made
several before their first cumulative close can carry more, each close
having rounded on its own, and the audit raises it. That is the safe
direction (a finding to read, which the next close that posts removes),
but the spec block did not say the bound stops at one close. It does now.
A comment only: no code changes.
Co-Authored-By: Claude <noreply@anthropic.com>
The viewer was the last crate with arithmetic of its own on amounts. With
it at zero, `just kernel-only` runs the detector over all eleven crates,
and it now fails when a folder under crates/ is not in its list, so a new
crate cannot do money arithmetic of its own from the day it is added.
Why it matters for the books: the proofs (Kani, Lean) are about the
kernel. A sum or a product computed anywhere else is one they say nothing
about, and rust_decimal's own operators either panic or round without
saying so. Bar item 1 of AGENTS.md is now a property the compiler checks
for the whole workspace, not a rule to remember.
Checked on main after the merge: the detector reads 0 places and 0
waivers for ledger-gui, the crate's whole test suite passes in one run
(300 passed, 0 failed, 1 ignored), clippy with warnings denied and fmt
are clean.
docs/proofs/k-u12.md is the account: the 183 places by crate, the rule
each kind followed, and the decision for every site that was not a plain
sum or sign.
Co-Authored-By: Claude <noreply@anthropic.com>
The viewer was the last crate with arithmetic of its own on amounts: 123
places in books.rs, the demo books and the pages. Each now calls the
kernel or money.rs's helpers over it, so a sum of posted figures is exact
(BS-entry-3, BS-entry-4), a quotient or a share is the kernel's, and a
figure exact arithmetic cannot hold is a blank cell or a refusal where a
raw operator panicked.
No figure moves. Three places name a rounded product, since one factor is
a quotient or the old code relied on rust_decimal's product: a party's
cash scaled by its fraction of an entry, a member's share times a hundred
for display, and the "running hot" limit of 1.25 times an average. The
demo books round to a step of 25 or 50 through the kernel, a half to the
even step, as Decimal::round did.
Read line by line against the per-site table before merging.
Co-Authored-By: Claude <noreply@anthropic.com>
The detector (scripts/raw-decimal-arith.sh ledger-gui) counted 123 places
in the viewer that did Decimal arithmetic outside the kernel; it counts 0
now. No figure the viewer shows changes: a raw operator panicked when the
exact answer did not fit, and add_in_range / sub_in_range / neg panic in
exactly that case; rust_decimal's checked_* methods, which round past 96
bits, became the kernel's Amount::checked_* (exact or None), with the
existing None handling untouched.
Places that are not plain sums or differences, and what each became:
- Sums of balances and posted lines (receivables, due to members, a
disposal's true-up, a statement row across columns, cleared total):
kernel::total / total_of; a refused sum is an expect where the figure
is drawn from the books, and a blank cell in the cash-flow keyed rows
(which already blank a refused statement).
- The share split (books.rs): share_of(v, share, net), the same multiply
then divide; the scaled parts use checked_mul_rounded because the
fraction is a quotient, truncated to cents on the next line.
- Percents of a share (capital, company, reports): checked_mul_rounded
by 100, exactly what * did.
- Averages and runway (monthly burn, cash runway, net per month, a
third of an amount, build-in pct): Amount::checked_div, a None joins
the None or "can't compute" the code already has.
- The 125% watch threshold: checked_mul_rounded and is_some_and.
- Rescale to one place (pct): rescale_exact, keeping the value when it
would round.
- The demo's rounding to a step ((x / 50).round() * 50): to_step, the
same half-to-even rounding through round_places.
- f32 widths and usize counts: plain folds, no allow.
Co-Authored-By: Claude <noreply@anthropic.com>
ledger-import, ledger-package and ledger-mcp join kernel_only_crates:
the detector reads 0 for each on main, their suites pass and clippy is
clean, so the lint part of `just check` now refuses a new raw Decimal
operator or rust_decimal method in ten of the eleven crates. ledger-gui
is the one left.
The delegation log has the task's line.
Co-Authored-By: Claude <noreply@anthropic.com>
Fifty places in ledger-mcp (19), ledger-import (18) and ledger-package
(13), now zero. Signs come from money::neg, signed_amount and on_side;
sums of posted figures from the kernel's exact total and add_in_range /
sub_in_range; the checked sums that already had a "too large" outcome
keep it and now get it from the exact operation, where rust_decimal's
own would have rounded and gone on.
No figure changes. What is not a plain sign or sum:
- A template's equal shares (100 / n, to two places, the last taking the
remainder) are the same three steps through the kernel; no owners now
gives no shares where the raw division panicked (no caller can ask).
- The exports' money and share text padded to two places with
Decimal::rescale, which can round; kernel::rescale_exact cannot.
- The tools' own profit and loss by class signs each line with
money::on_side, one statement of the rule the two matches spelled out.
- The payment summary adds what was deposited after the engine has
accepted the settlement (on the books or on a probe), so those figures
are in range.
Worker: Claude Sonnet 5.5, high effort, from a per-site table. The diff
was read line by line against the table; the detector and the three
suites were run again here before the crates joined kernel_only_crates.
Co-Authored-By: Claude <noreply@anthropic.com>
The raw-decimal-arith detector counted 19 places in ledger-mcp before
and counts 0 after. No figure changes.
Sides become signs through money::on_side and money::signed_amount
(server delta, report movement, the P&L-by-class normal-side figure,
which collapses two matches into one call); sums and differences of
books figures through add_in_range and sub_in_range; the checked sums in
helpers and documents through Amount::checked_add with their error
handling untouched. The count of withdrawn attachments (a usize, not a
Decimal) is the length of the flattened withdraw lists instead of an
Iterator::sum of their lengths: the same number.
Co-Authored-By: Claude <noreply@anthropic.com>
Ten places, now zero, and both crates join kernel_only_crates so the lint
part of `just check` holds them there.
ledger-store (8): a disposal's preview adds the asset's posted runs and
takes book value and gain or loss by subtraction; an attested receipt is
compared with the entry's debits; an older settlement's remainder is the
document's total less what was recorded. Each called rust_decimal's own
checked_add or checked_sub, which rounds where the exact answer needs
more than 96 bits and says nothing. They call the kernel's now
(kernel::total_of, Amount::checked_add and checked_sub): exact, or the
refusal each of these places already had (too_large, or no figure to
compare). Two unary minuses go through money::neg. Posted lines are
bounded (BS-entry-3, BS-entry-4), so no figure in real books changes.
ledger-config (2): a member's "50%" is divided by a hundred through
Amount::checked_div (the raw `/` computed the same quotient), and the
members' shares are added by kernel::total_of. Shares that cannot be
added exactly are refused with a sentence saying to write them with
fewer places, where the raw sum would have rounded them and then
compared the rounded figure with one. ledger-core's own check of the
same setting already did this.
Checked: the detector reads 0 for both; both crates' suites pass (682
tests); clippy with -D warnings.
Co-Authored-By: Claude <noreply@anthropic.com>
The raw-decimal-arith detector counted 13 places in ledger-package
before and counts 0 after. No figure changes.
Negations go through money::neg; the two differences of books figures
(attention, k1_tax) through sub_in_range; the checked sums in the
attention checks through Amount::checked_add / checked_sub with their
"cannot compute" handling untouched.
Not a plain sum or sign: text.rs padded a number to two places with
rescale (which rounds when 96 bits do not hold the padded digits); it
now uses rescale_exact and keeps the number as it was if padding would
round, so the printed text never rounds.
Co-Authored-By: Claude <noreply@anthropic.com>
The raw-decimal-arith detector counted 18 places in ledger-import before
and counts 0 after. No figure changes.
Signs (bank_csv, iif, invoice_pdf, report) go through money::neg and
money::signed_amount; sums and differences of figures from the books
(report, xlsx) through total_of, add_in_range and sub_in_range, which
are exact and panic only where the raw operator panicked.
Not a plain sum or sign: equal_shares (templates) now divides through
Amount::checked_div, rounds half-to-even to two places through
round_places, and gives the last owner a hundred minus the shares
given. Same numbers as before for every n >= 1; for n = 0 it returns no
shares where the raw division panicked (its one caller passes the
owners of a partnership, at least two).
Co-Authored-By: Claude <noreply@anthropic.com>
The kernel rule holds in ledger-core and is held by the lint part for
five crates; the six outer crates with places left are K-U12. The
traceability gate's counts are 62 functions and 16 listed exceptions
(kernel::rescale_exact is the sixteenth).
Co-Authored-By: Claude <noreply@anthropic.com>
The crates around the core (the store, the tools, the viewer, the
exports) negate amounts, sign a line by its side and add figures drawn
from posted lines, each with a raw Decimal operator of its own: 183
places the kernel's proofs say nothing about. K-U12 routes them through
the kernel, and they need the same five helpers ledger-core uses for
that: neg, signed_amount, on_side, add_in_range, sub_in_range. They were
crate-private; they are public now, so a sign or a sum of posted figures
is still said once.
No behaviour changes.
Co-Authored-By: Claude <noreply@anthropic.com>
AGENTS.md's bar item 1 says money arithmetic lives in kernel/ and nowhere
else. The compiler-driven detector listed 210 places in ledger-core that
broke it: raw operators that panic when a result does not fit, and
rust_decimal's own methods, which round silently past 96 bits. All 210
now go through the kernel, and `just kernel-only` in the lint part of
`just check` holds ledger-core and the four outer crates already at zero
(ledger-cli, ledger-host, ledger-reader, ledger-vault) there.
No figure moves. What changes is the edge: a result exact arithmetic
cannot hold is refused where it panicked or was rounded.
What the unit found: once K-U10 made the kernel's sum exact, the K-1
worksheet's running total of 28-digit shares refused every split by
thirds. That sum is a rounded figure by construction, so the kernel now
names it (Amount::checked_add_rounded, checked_sub_rounded), with a
bridge property; every other maker of a long figure outside the kernel
was read for the same fault. Four places that changed a figure's written
places through Decimal::rescale, which can round, now call
kernel::rescale_exact, which cannot.
Checked on the branch: the detector at 0 for the five crates, the whole
ledger-core suite (1362 passed), clippy with -D warnings, and the
workspace compiles. docs/proofs/k-u11.md is the account.
Co-Authored-By: Claude <noreply@anthropic.com>
AGENTS.md's bar says money arithmetic lives in the kernel and nowhere
else, because the proofs are about the kernel only and because a raw
operator panics where rust_decimal's own methods round silently. Nothing
checked it, and 210 places in ledger-core broke it.
`just kernel-only` runs scripts/raw-decimal-arith.sh over the crates
named in kernel_only_crates and fails on the first place found; the lint
part of `just check` runs it. The list is ledger-core, now at zero, and
the four outer crates that never had a place (ledger-cli, ledger-host,
ledger-reader, ledger-vault). The other six join as K-U12 brings each to
zero.
docs/proofs/k-u11.md is the unit's account: what was measured, what each
group of sites became, what exact arithmetic refused and why, and what
the detector does not show (that a site calls the right kernel function;
the tests and a reading of every long figure carry that).
Co-Authored-By: Claude <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
cargo-about is run with --offline so the notices text is the same on
every machine: it reads only the files each crate was packaged with, and
never looks in a crate's repository for a licence file the package left
out. Today the two give the same text, byte for byte. The cost is that
every crate in Cargo.lock has to be in the local registry, every
platform's included, so a failure now says to run `cargo fetch --locked`.
The check is not seconds: it reads every crate's files for licence text,
about two minutes of wall clock. docs/testing.md says so.
Co-Authored-By: Claude <noreply@anthropic.com>
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
Every licence the program's dependencies and bundled fonts carry (MIT,
Apache-2.0, BSD, ISC, Zlib, the SIL Open Font License) asks that its
copyright notice and licence text travel with each copy of the binary,
and until now nothing shipped them.
`just notices` (scripts/notices.sh) writes THIRD-PARTY-NOTICES.txt:
cargo-about names every crate the `wanderbooks` binary links, from
ledger-cli's manifest across every feature and platform the program
ships on, with the licence text; the script then adds the embedded
fonts and their licence files. `just notices-check`, in the lint part of
`just check`, regenerates the file and fails when a dependency or font
changed without it, so the committed copy cannot drift.
cargo-about is a build tool used to generate and check the file; it is
not a dependency of the program (no Cargo.toml or Cargo.lock changes).
Its accepted list is deny.toml's allow list word for word.
Co-Authored-By: DeepSeek V4.1 Flash
`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>
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>
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>
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>
The detector, run again on the three crates K-U9 touched: ledger-gui
123 places of money arithmetic outside the kernel (was 137),
ledger-import 18 (was 22), ledger-package 13 (unchanged: its sums are
totals, not display rounding).
Co-Authored-By: Claude <noreply@anthropic.com>