nx_recon_lib.nx
buildroot/runtime/nx_recon_lib.nx
about
nx_recon_lib.nx -- F983: GENERAL THREE-WAY RECONCILIATION on the sovereign ledger.
nx_trust proves three-way recon for IOLTA specifically. This lifts it to a PRIMITIVE any book can
use -- trust, operating, escrow, payroll -- by composing nx_ledger instead of re-deriving it.
THE THREE LEGS (this is the actual accounting definition, not a simplification):
leg 1 SUBSIDIARY = sum of the individual sub-account balances (per client / per matter / per fund)
leg 2 CONTROL = the general-ledger control account for that book
leg 3 BANK = the bank statement balance, ADJUSTED for timing differences:
adjusted = statement + deposits_in_transit - outstanding_disbursements
A book is reconciled ONLY when all three are EQUAL. Two out of three is not reconciliation.
★FAIL-CLOSED, NEVER ROUNDED (the property that makes this worth having): a variance of ONE CENT is
reported as a variance. There is no tolerance band, no "materiality" threshold, no rounding to the
nearest dollar. Integer minor units end-to-end, so a difference either is zero or it is not. Auditors
and bar examiners do not accept "close enough", and neither does this organ.
The variance SIGN is meaningful and preserved: positive = the first leg exceeds the second.
SCALE ENVELOPE (declared): rec_subsidiary walks the caller's account list and calls led_balance per
account, so it is O(accounts x transfers). Fine for a firm-sized book; a per-account index is the
scale rung, same one declared in nx_ledger_lib.
license_tier: ORIGINAL No hw writes (Rule 26). LIB (no main).
dependencies 1 imports · 2 importers
imports: nx_ledger_lib.nx
imported by: nx_fin_spine_gate.nxnx_recon_gate.nx
structs
| none |
consts
| 27 | const REC_BALANCED: i64 = 0 |
| 28 | const REC_SUB_VS_CTRL: i64 = 1 // leg1 != leg2 |
| 29 | const REC_BOOK_VS_BANK: i64 = 2 // leg2 != leg3(adjusted) |
| 30 | const REC_BOTH: i64 = 3 // both broken |
functions
| 33 | func rec_subsidiary(prefix: *u8, accts: *i64, n: i64) -> i64 |
| 46 | func rec_adjusted_bank(statement: i64, deposits_in_transit: i64, outstanding_disburse: i64) -> i64 called by 1: rec_three_way |
| 54 | func rec_three_way(prefix: *u8, accts: *i64, n: i64, control: *u8, |
| 72 | func rec_is_balanced(prefix: *u8, accts: *i64, n: i64, control: *u8, |