nx_maint_ledger.nx
buildroot/runtime/nx_maint_ledger.nx
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
imports: nx_maint_unify.nx
imported by: nx_maint_action.nxnx_maint_ledger_test.nx
structs
| 33 | struct LedgerEntry |
| 42 | struct Ledger |
consts
| 21 | const NX_TREND_NODATA: i64 = 0 |
| 22 | const NX_TREND_IMPROVING: i64 = 1 |
| 23 | const NX_TREND_STABLE: i64 = 2 |
| 24 | const NX_TREND_WORSENING: i64 = 3 |
| 25 | const NX_TREND_N: i64 = 4 |
functions
| 27 | func nx_trend_is_valid(t: i64) -> i64 called by 1: main |
| 47 | func nx_ledger_init(led: *Ledger, cap: i64) -> i64 called by 1: main |
| 55 | func nx_ledger_append(led: *Ledger, entries: *LedgerEntry, asset_id: i64, ts: i64, called by 1: main |
| 71 | func nx_ledger_count_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64) -> i64 called by 1: main |
| 83 | func nx_ledger_worst_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64) -> i64 called by 1: main |
| 96 | func nx_ledger_latest_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64, out: *LedgerEntry) -> i64 called by 1: main |
| 115 | func nx_ledger_trend_for(led: *Ledger, entries: *LedgerEntry, asset_id: i64) -> i64 called by 1: main |