fix(core): payroll_remit_plan refuses past exact arithmetic instead of panicking
The remittance plan totalled the payables with a raw `total +=`, which panics on Decimal overflow, on a pub fn returning a bare plan. Its callers refused first through sum_exact_of, but that was an unenforced precondition (BS-entry-4: every derived figure is checked arithmetic). It now returns Result<_, LedgerError>, totalling through kernel::total_of and refusing TooLargeToCompute; Ledger and the store propagate it and keep their pre-checks. A test shows payables past the range, up and down, are refused, not a panic. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
90d34585fd
commit
46dccd5d76
4 files changed
+36
-8
No files matched your search
@@ -8533,7 +8533,7 @@ impl Ledger {
|
||||
}
|
||||
let entry = self.try_create_entry(date, &format!("Payroll tax remittance {date}"))?;
|
||||
for (account, side, amount) in
|
||||
payroll_remit_plan(&payables, cash_account, self.base_currency)
|
||||
payroll_remit_plan(&payables, cash_account, self.base_currency)?
|
||||
{
|
||||
self.add_line(entry, account, side, amount)?;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user