code wiki / (root) / nx_clm_lib.nx

nx_clm_lib.nx

buildroot/runtime/nx_clm_lib.nx

5219 B117 linesdepth 7pulls 12 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_matter_lib.nx nx_clm_lib.nx nx_clm_gate.nx

imports: nx_matter_lib.nx

imported by: nx_clm_gate.nx

structs

none

consts

17const CLM_MAGIC_1048576: i64 = 1048576
19const CLM_OPEN: i64 = 0 // notice window still open -- you can still cancel
20const CLM_MISSED: i64 = 1 // past the notice deadline, before expiry -- it WILL auto-renew
21const CLM_RENEWED: i64 = 2 // past expiry -- already auto-renewed into a new term
22const CLM_UNKNOWN: i64 = 0 - 1 // insufficient data -- FLAG FOR REVIEW (fail-closed), never "safe"
23const CLM_COLON: i64 = 58

functions

26func clm_notice_deadline(expiry_day: i64, notice_days: i64) -> i64
called by 1: main
32func clm_renewal_state(expiry_day: i64, notice_days: i64, today_day: i64) -> i64
called by 2: mainclm_is_safe
42func clm_days_to_act(expiry_day: i64, notice_days: i64, today_day: i64) -> i64
called by 1: main
47func clm_is_safe(expiry_day: i64, notice_days: i64, today_day: i64) -> i64
called by 1: main calls 1: clm_renewal_state
53func clm_obligation_put(prefix: *u8, contract_id: *u8, obl_id: *u8, due_day: i64, otype: *u8) -> i64
75func clm_overdue(prefix: *u8, contract_id: *u8, today_day: i64) -> i64