test: totals past exact arithmetic are refused, never a panic

ledger-core/tests/exact_totals.rs: the engine's sum/add/sub helpers, arap's
document_total, audit::check_articulation (current_earnings + closed was a
raw + that panicked for a public caller's MAX figures) and the frozen
close splits' try_ twins refuse at Decimal::MAX with TooLargeToCompute,
and give the infallible rules' exact result for ordinary input.
ledger-store/tests/exact_totals.rs: an invoice or a bill of enormous
lines is refused and journals nothing. (A posted entry's lines are capped
when it posts, restored or new, so report sums over posted lines cannot
reach the edge; documents are the figures that can.)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-08 12:26:05 -07:00
1 parent 5230585e53
commit 5ae26f1288
5 files changed
+199 -14

No files matched your search

+4 -2
View File
@@ -525,8 +525,10 @@ fn schedules(ledger: &Ledger, through: NaiveDate) -> Vec<Finding> {
}
};
if let Some((first, _)) = months.first() {
let total = crate::kernel::total_of(&months, |&(_, a)| a)
.map_or_else(|| "a sum too large to compute".to_string(), |t| t.to_string());
let total = crate::kernel::total_of(&months, |&(_, a)| a).map_or_else(
|| "a sum too large to compute".to_string(),
|t| t.to_string(),
);
out.push(Finding::new(
"schedule_behind",
Subject::Schedule(s.id),