code wiki / (root) / nx_sol_lib.nx

nx_sol_lib.nx

buildroot/runtime/nx_sol_lib.nx

5090 B97 linesdepth 0pulls 0 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_sol_lib.nx -- STATUTE OF LIMITATIONS deadline engine. Exact calendar arithmetic, fail-closed. Missing a limitations deadline is the single most common legal-malpractice claim. The hard part is not the subtraction -- it is CORRECT CALENDAR ARITHMETIC: 'two years from the accrual date' means the same civil date two years later, and naive day-counting (period * 365) drifts by a day per leap year and mishandles a Feb-29 accrual. This organ computes deadlines on exact proleptic-Gregorian day numbers (Howard Hinnant's algorithm: days since 1970-01-01, valid for any year), so leap years and the Feb-29 -> Feb-28 clamp on year addition are handled by construction. *FAIL-CLOSED ON MISSING DATA (the flagship): if the accrual date or the period is unknown, the deadline is SOL_UNKNOWN and sol_status returns UNDETERMINED-FOR-REVIEW -- it will NEVER tell a client a claim is still open or already time-barred on data it does not have. A confident wrong answer here ends a career. Models the two doctrines that move the clock: TOLLING (the clock pauses -- defendant absent, plaintiff a minor -- so tolled days push the deadline OUT) and the DISCOVERY RULE (for a latent harm the clock starts at discovery, not the wrongful act). Day numbers are signed integers; no float, no wall-clock read. license_tier: ORIGINAL No hw writes (Rule 26). LIB.

dependencies 0 imports · 3 importers

nx_sol_lib.nx nx_damages_lib.nx nx_legal_svc.nx nx_sol_gate.nx

imports: none

imported by: nx_damages_lib.nxnx_legal_svc.nxnx_sol_gate.nx

structs

none

consts

19const SOL_UNKNOWN: i64 = 0 - 2000000002 // deadline uncomputable (missing accrual or period)
20const SOL_OPEN: i64 = 1 // as-of date is on or before the deadline
21const SOL_EXPIRED: i64 = 0 // as-of date is past the deadline (time-barred)
22const SOL_UNDETERMINED: i64 = 0 - 1 // fail-closed: cannot determine (missing data)

functions

25func sol_is_leap(y: i64) -> i64
34func sol_days_from_civil(y0: i64, m: i64, d: i64) -> i64
49func sol_add_years_civil(y: i64, m: i64, d: i64, add_years: i64) -> i64
63func sol_deadline_years(has_accrual: i64, y: i64, m: i64, d: i64, years: i64, tolled_days: i64) -> i64
73func sol_effective_accrual(act_daynum: i64, discovery_daynum: i64, uses_discovery: i64) -> i64
called by 1: main
81func sol_status(deadline_daynum: i64, as_of_daynum: i64) -> i64
called by 2: leg_sol_assessmain
88func sol_days_remaining(deadline_daynum: i64, as_of_daynum: i64) -> i64
called by 2: leg_sol_assessmain
93func sol_status_str(s: i64) -> *u8
called by 2: leg_sol_assessmain