build(check): no Decimal arithmetic outside the kernel, held by the lint part (K-U11a)

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>
This commit is contained in:
swaitsandClaude committed 2026-11-09 23:27:24 -07:00
1 parent 34f5275ec4
commit a7b6ed0304
4 files changed
+191 -5

No files matched your search

+18
View File
@@ -37,6 +37,7 @@ check-shard shard:
cargo clippy --workspace --all-targets -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --quiet
just server-only
just kernel-only
just check-shards-agree
just deny
just notices-check
@@ -58,6 +59,23 @@ 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"
# 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
# operator on a Decimal, one of rust_decimal's own arithmetic or rounding
# methods, or an Iterator::sum outside `src/kernel/` fails. Those panic or
# round where the kernel's operations are exact or refuse (K-U10), and the
# proofs are about the kernel only.
kernel-only:
#!/usr/bin/env bash
set -euo pipefail
for crate in {{kernel_only_crates}}; do
scripts/raw-decimal-arith.sh "$crate"
done
# What every dependency must be (deny.toml): free of known vulnerabilities
# (the RustSec database, fetched now), not yanked, under a licence that
# fits MIT OR Apache-2.0, and from crates.io or the bookspec repository.