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
@@ -4437,7 +4437,7 @@ impl Store {
|
||||
}
|
||||
let entry_id = self.ledger.next_entry_id();
|
||||
let base = self.base_currency;
|
||||
let plan = payroll_remit_plan(&payables, cash_account, base);
|
||||
let plan = payroll_remit_plan(&payables, cash_account, base)?;
|
||||
let description = format!("Payroll tax remittance {date}");
|
||||
let mut journaled = Vec::with_capacity(plan.len() + 2);
|
||||
journaled.push(self.append_journal(
|
||||
|
||||
Reference in new issue
Block a user