build(check): every crate is held at zero Decimal arithmetic outside the kernel (K-U12)

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>
This commit is contained in:
swaitsandClaude committed 2026-11-10 01:55:11 -07:00
1 parent e444a41071
commit ef86f7820a
7 files changed
+129 -16

No files matched your search

+12 -3
View File
@@ -59,9 +59,11 @@ check-shard shard:
;;
esac
# The crates with no Decimal arithmetic outside the kernel. A crate joins
# this list when its count reaches zero (K-U12) and never leaves it.
kernel_only_crates := "ledger-core ledger-cli ledger-host ledger-reader ledger-vault ledger-store ledger-config ledger-import ledger-package ledger-mcp"
# The crates with no Decimal arithmetic outside the kernel: every crate of
# the workspace, since K-U12. None leaves the list, and `kernel-only`
# fails when a folder under crates/ is not in it, so a new crate joins it
# on the day it is added.
kernel_only_crates := "ledger-core ledger-cli ledger-host ledger-reader ledger-vault ledger-store ledger-config ledger-import ledger-package ledger-mcp ledger-gui"
# Money arithmetic lives in the kernel and nowhere else (AGENTS.md, bar
# item 1). The compiler is asked (scripts/raw-decimal-arith.sh): a raw
@@ -72,6 +74,13 @@ kernel_only_crates := "ledger-core ledger-cli ledger-host ledger-reader ledger-v
kernel-only:
#!/usr/bin/env bash
set -euo pipefail
for dir in crates/*/; do
crate=$(basename "$dir")
case " {{kernel_only_crates}} " in
*" $crate "*) ;;
*) echo "kernel-only: $crate is not in kernel_only_crates (justfile): add it, and bring it to zero" >&2; exit 1 ;;
esac
done
for crate in {{kernel_only_crates}}; do
scripts/raw-decimal-arith.sh "$crate"
done