refactor(mcp): previews and totals refuse oversized sums instead of panicking
preview_lines_for (balance before + line), the disposal preview's debits, the depreciation run's catch-up difference, the digest's account movement and the payroll remittance total used raw + / - / .sum() on stored or replayed figures; they now go through ledger_core::money's checked helpers and return the tool's string error (TooLargeToCompute). Unchanged for ordinary input. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
afc7c545da
commit
e6104b49d6
4 files changed
+46
-27
No files matched your search
@@ -1348,7 +1348,9 @@ fn preview_lines_for(
|
||||
} else {
|
||||
-amount.amount
|
||||
};
|
||||
let after = before + delta;
|
||||
let after =
|
||||
ledger_core::money::add_exact(before, delta, "the account's balance after the line")
|
||||
.map_err(|e| e.to_string())?;
|
||||
out.push(PreviewLine {
|
||||
account_id: *account_id,
|
||||
code: account.code.clone(),
|
||||
|
||||
Reference in new issue
Block a user