code wiki / (root) / nx_recon_lib.nx

nx_recon_lib.nx

buildroot/runtime/nx_recon_lib.nx

4032 B77 linesdepth 8pulls 13 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_ledger_lib.nx nx_recon_lib.nx nx_fin_spine_gate.nx nx_recon_gate.nx

imports: nx_ledger_lib.nx

imported by: nx_fin_spine_gate.nxnx_recon_gate.nx

structs

none

consts

27const REC_BALANCED: i64 = 0
28const REC_SUB_VS_CTRL: i64 = 1 // leg1 != leg2
29const REC_BOOK_VS_BANK: i64 = 2 // leg2 != leg3(adjusted)
30const REC_BOTH: i64 = 3 // both broken

functions

33func rec_subsidiary(prefix: *u8, accts: *i64, n: i64) -> i64
called by 1: rec_three_way calls 1: led_balance
46func rec_adjusted_bank(statement: i64, deposits_in_transit: i64, outstanding_disburse: i64) -> i64
called by 1: rec_three_way
54func rec_three_way(prefix: *u8, accts: *i64, n: i64, control: *u8,
72func rec_is_balanced(prefix: *u8, accts: *i64, n: i64, control: *u8,
called by 1: main calls 1: rec_three_way