code wiki / (root) / nx_maint_ledger.nx

nx_maint_ledger.nx

buildroot/runtime/nx_maint_ledger.nx

4566 B137 linesdepth 2pulls 7 transitivereach 11 importersview sourcekind librarytopic maint
docsdependenciesstructsconstsfunctions

about

nx_maint_ledger.nx -- R4: the additive maintenance ledger (#13, history is sacred). Append-only record of every asset's health results over time. Its value is PREDICTIVE: a worsening severity trend warns BEFORE failure, and a past SAFETY event is NEVER forgotten even after the asset recovers. Operator (2026-06-23): build "from the hardware rung up each rung" -- this is R4 on top of R3's unified MaintResult. CLAUDE.md #13: additive-only, never DELETE; history enables debugging, rollback, and degradation analysis. (Pure-buffer ledger LOGIC + trend; durable seg-store backing is a thin next layer, same append-to-store pattern as nx_ciq_field_maintenance.) NEVER-BRICK (#26): append + query; no syscalls, no device writes, NO delete. genealogy_id: project-maintenance-platform-sclass-2026-06-23 (R4 ledger) license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_maint_unify.nx nx_maint_ledger.nx nx_maint_action.nx nx_maint_ledger_test.nx

imports: nx_maint_unify.nx

imported by: nx_maint_action.nxnx_maint_ledger_test.nx

structs

33struct LedgerEntry
42struct Ledger

consts

21const NX_TREND_NODATA: i64 = 0
22const NX_TREND_IMPROVING: i64 = 1
23const NX_TREND_STABLE: i64 = 2
24const NX_TREND_WORSENING: i64 = 3
25const NX_TREND_N: i64 = 4

functions

27func nx_trend_is_valid(t: i64) -> i64
called by 1: main
47func nx_ledger_init(led: *Ledger, cap: i64) -> i64
called by 1: main
55func nx_ledger_append(led: *Ledger, entries: *LedgerEntry, asset_id: i64, ts: i64,
called by 1: main
71func nx_ledger_count_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64) -> i64
called by 1: main
83func nx_ledger_worst_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64) -> i64
called by 1: main
96func nx_ledger_latest_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64, out: *LedgerEntry) -> i64
called by 1: main
115func nx_ledger_trend_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64) -> i64
called by 1: main