FA-58164 / Double-entry ledger accounting / Member archive
Cost pool allocation entry: reversal sides · case 04
Reversing an allocation posts it a second time.
Case contract
x = {'amount': signed cents, 'weights': [[center, non-negative weight]] (some positive), 'source': account}. The pool magnitude is split across positive-weight centers by the largest remainder method: floor shares, then one extra cent to the largest remainders, ties to the earlier-listed center. A non-negative amount credits the source and debits centers; a negative amount (reversal) debits the source and credits centers, all amounts positive. Return lines [[source, side, magnitude]] + [[center, side, share]] for nonzero shares in listing 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: reversal sides | [["pool", "C", 7], ["lab", "D", 1], ["ops", "D", 5], ["mkt", "D", 1]] | [["pool", "D", 7], ["lab", "C", 1], ["ops", "C", 5], ["mkt", "C", 1]] | 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 ↗