FA-58303 / Double-entry ledger accounting / Member archive
Payroll journal entry: withholding liability · case 03
The payroll entry does not balance; employer taxes have no liability.
Case contract
x = {'gross': [[employee, cents]] (an employee may appear twice), 'ytd': prior year-to-date gross, 'wage_base', 'ss_bp', 'med_bp', 'itax_bp', 'benefit': {employee: pre-tax deduction per paycheck}}. Per paycheck: social wages = min(gross, max(0, wage_base - ytd)), ytd then increases by gross; social tax = round(social wages * ss_bp / 10000), medicare = round(gross * med_bp / 10000) (no cap), income tax = round((gross - benefit) * itax_bp / 10000), all half-up; net = gross - social - medicare - income tax - benefit. The employer matches social and medicare. Return {'wage_expense', 'tax_expense', 'cash', 'withholding', 'benefits'} where withholding holds employee and employer taxes.
Why this case matters
Ledger software must keep debits equal to credits and apply normal-balance, period and cutoff rules exactly; small sign or boundary slips silently misstate financial statements.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: withholding liability | {"benefits": 22345, "cash": 652864, "tax_expense": 32025, "wage_expense": 783333, "withholding": 108124} | {"benefits": 22345, "cash": 652864, "tax_expense": 32025, "wage_expense": 783333, "withholding": 140149} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗