nx_degmode_lib.nx
buildroot/runtime/nx_degmode_lib.nx
about
nx_degmode_lib.nx -- GRACEFUL DEGRADATION AS A DECIDABLE FUNCTION, NOT A GROUND STOP.
WHY THIS EXISTS (operator, 2026-09-03, after a day in which every build was refused):
"research as of september 2026 what estates do like the military when functionality is degraded to
still get the best they can get till hardware is avilable and then have it automatically recover".
WHAT THE FIELD DOES, AND WHAT WE WERE DOING INSTEAD. The estate's admission is ONE load bar applied
to ALL work: `ba_verdict` returns GRANT or QUEUE and carries NO priority concept (grepped, absent).
So a one-line restore-capability fix and a 600-domain census sweep received the identical answer.
That is a GROUND STOP, and grounding for every defect is the exact failure mode the field's doctrine
exists to avoid:
- Safety-systems doctrine: graceful degradation means the priorities, triggers and behaviours are
designed UP FRONT and verified, so the degraded state is DELIBERATE AND AUDITABLE, not accidental.
Ours was accidental -- no declared class, no clock, no exercise.
- Aviation's Minimum Equipment List: an aircraft is DISPATCHED with named items inoperative under
named limitations, and every deferral carries a REPAIR CATEGORY WITH A CLOCK (A specified, B 3
days, C 10 days, D 120 days). Permitted dispatch becomes a CONTROLLED DEFERRAL; only an
impermissible one grounds the aircraft. Our defect ran ~a day with no category and nothing
counting, which is how a day passes without anyone deciding.
- Degraded-ops training doctrine: workarounds are learned in an exercise, not on the battlefield.
Our degraded path had never been exercised, which is why that day was archaeology.
THE THREE DECISIONS THIS LIB MAKES, and each is DATA rather than a literal (rules 11 and 17):
dm_admit(class, health) -- shed by ESSENTIALITY instead of shutting the door on everyone
dm_deferral_state(age, limit) -- the MEL clock, so a degraded state cannot run silently forever
dm_recover(samples, ...) -- the automatic re-arm, with the flap guard the field insists on
THE CLASS IS AN EXPLICIT DECLARATION, NEVER A NAME MATCH. This estate has been bitten repeatedly by
classifiers keyed on a name substring (a DAEMON read as a gate because of a `_gate` suffix; a gate
fleet invisible because it is declared `oracle`), and its own conclusion each time was that the fix is
an explicit declaration, never a rename. So dm_class_of reads a declaration table and an UNDECLARED
target gets DM_E3 -- the LEAST essential class -- and that default is ANNOUNCED by dm_class_declared
rather than silently applied. An unknown input must never resolve to the PERMISSIVE value: that is
exactly the live `pr_mode` defect, where a mistyped route mode silently downgrades fail-closed to open.
UNOBSERVABLE ABSTAINS FROM TIGHTENING, IT DOES NOT ACQUIT AND IT DOES NOT BLOCK.
Most hosts have no flashcache at all, so treating IOADM_UNOBS as RED would refuse every build on every
machine that never had the fault -- a false-positive generator that everyone would disable within a
day. This axis therefore contributes NOTHING when it cannot see: dm_admit returns admit for every
class, and the CALLER'S EXISTING LOAD BAR IS UNCHANGED AND STILL APPLIES. The axis declining to
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_degmode_gate.nx
structs
| none |
consts
| 54 | const DM_H_GREEN: i64 = 0 |
| 55 | const DM_H_RED: i64 = 1 |
| 56 | const DM_H_AMBER: i64 = 2 |
| 57 | const DM_H_UNOBS: i64 = 3 |
| 60 | const DM_E1: i64 = 1 // restore-capability: fixes to the fault itself, safety fixes, the rollback path |
| 61 | const DM_E2: i64 = 2 // in-flight work: the rung a seat is currently closing |
| 62 | const DM_E3: i64 = 3 // bulk: censuses, sweeps, fleet campaigns |
| 63 | const DM_E_UNDECLARED: i64 = DM_E3 // fail-safe: an undeclared target is the LEAST essential |
| 65 | const DM_ADMIT: i64 = 1 |
| 66 | const DM_DEFER: i64 = 0 |
| 68 | const DM_CONF: *u8 = "knowledge/degmode.conf" |
| 69 | const DM_CONF_ALT: *u8 = "../knowledge/degmode.conf" |
| 70 | const DM_CONF_CAP: i64 = 65536 |
| 71 | const DM_NAMEMAX: i64 = 256 |
| 74 | const DM_CAT_B_S: i64 = 259200 // 3 days |
| 75 | const DM_CAT_C_S: i64 = 864000 // 10 days |
| 76 | const DM_CAT_D_S: i64 = 10368000 // 120 days |
| 79 | const DM_RECOVER_CONSECUTIVE: i64 = 3 // consecutive clear samples required before re-arming |
| 80 | const DM_RECOVER_MIN_SAMPLES: i64 = 4 // minimum observations before the question may be answered |
| 192 | const DM_CLOCK_UNSET: i64 = 0 - 1 |
| 193 | const DM_CLOCK_LIVE: i64 = 0 |
| 194 | const DM_CLOCK_EXPIRED: i64 = 1 |
functions
| 82 | func dm_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 86 | func dm_admit(class: i64, health: i64) -> i64 called by 1: main |
| 103 | func dm_conf_read(buf: *u8, cap: i64) -> i64 |
| 126 | func dm_starts(buf: *u8, n: i64, at: i64, s: *u8) -> i64 |
| 137 | func dm_field_eq(buf: *u8, n: i64, at: i64, s: *u8) -> i64 |
| 155 | func dm_class_declared(buf: *u8, n: i64, target: *u8) -> i64 |
| 182 | func dm_class_of(buf: *u8, n: i64, target: *u8) -> i64 |
| 195 | func dm_deferral_state(age_s: i64, limit_s: i64) -> i64 called by 1: main |
| 213 | func dm_recover(samples: *i64, n: i64, need: i64, min_n: i64) -> i64 called by 1: main |