FA-57860 / Double-entry ledger accounting / Member archive
Journal posting engine: posting sign by side and normal balance · case 05
Liability and revenue balances come out negative after ordinary credit postings.
Case contract
x = {'chart': {account: type}, 'entries': [[entry_id, [[account, 'D'|'C', cents], ...]], ...]}. Types asset, expense and dividend are debit-normal; liability, equity, revenue and contra_asset are credit-normal. An entry is posted only if its id has not already been posted, it has at least two lines, every account is in the chart, every side is 'D' or 'C', every amount is a positive integer and total debits equal total credits; otherwise the whole entry is rejected and its id appended to 'rejected' (a rejected id may be resubmitted later). Return {'balances': normal-signed balance of every chart account (zero and negative included), 'rejected': ids in order}.
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: posting sign by side and normal balance | {"balances": {"acc_depr": 1200, "capital": 100, "cash": 999, "loan": -2299, "receivable": 999, "rent": -999}, "rejected": ["J2", "J4"]} | {"balances": {"acc_depr": -1200, "capital": -100, "cash": 999, "loan": 2299, "receivable": 999, "rent": -999}, "rejected": ["J2", "J4"]} | 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 ↗