nx_clm_lib.nx
buildroot/runtime/nx_clm_lib.nx
about
nx_clm_lib.nx -- F996: CONTRACT LIFECYCLE -- obligation tracking + auto-renewal-trap detection.
The expensive, silent contract failure is the EVERGREEN AUTO-RENEWAL TRAP: a contract renews for
another (often costly) term unless you give written notice N days before expiry. Miss that window by
a day and you are locked in. Legal teams miss it constantly because nothing computes the deadline and
nothing flags the day it passes. This organ does both, and it is FAIL-CLOSED: a contract whose expiry
or notice period is unknown is flagged FOR REVIEW, never silently reported safe -- because "no action
needed" on a contract you could not evaluate is exactly how you get trapped.
Dates are integer DAY-NUMBERS (deterministic, no float). Converting a YYYYMMDD to a day-number is the
docketing engine's job (nx_docket); this takes day-numbers so the lifecycle math is exact and testable.
SCALE ENVELOPE (declared): clm_overdue scans the obligation index for a contract's key-prefix (the
proven per-key scan). DRY: composes nx_matter_lib (reg_*/mt_*/canon_encode). license_tier: ORIGINAL LIB.
dependencies 1 imports · 1 importers
imports: nx_matter_lib.nx
imported by: nx_clm_gate.nx
structs
| none |
consts
| 17 | const CLM_MAGIC_1048576: i64 = 1048576 |
| 19 | const CLM_OPEN: i64 = 0 // notice window still open -- you can still cancel |
| 20 | const CLM_MISSED: i64 = 1 // past the notice deadline, before expiry -- it WILL auto-renew |
| 21 | const CLM_RENEWED: i64 = 2 // past expiry -- already auto-renewed into a new term |
| 22 | const CLM_UNKNOWN: i64 = 0 - 1 // insufficient data -- FLAG FOR REVIEW (fail-closed), never "safe" |
| 23 | const CLM_COLON: i64 = 58 |
functions
| 26 | func clm_notice_deadline(expiry_day: i64, notice_days: i64) -> i64 called by 1: main |
| 32 | func clm_renewal_state(expiry_day: i64, notice_days: i64, today_day: i64) -> i64 |
| 42 | func clm_days_to_act(expiry_day: i64, notice_days: i64, today_day: i64) -> i64 called by 1: main |
| 47 | func clm_is_safe(expiry_day: i64, notice_days: i64, today_day: i64) -> i64 |
| 53 | func clm_obligation_put(prefix: *u8, contract_id: *u8, obl_id: *u8, due_day: i64, otype: *u8) -> i64 |
| 75 | func clm_overdue(prefix: *u8, contract_id: *u8, today_day: i64) -> i64 |