code wiki / (root) / nx_printer_census.nx

nx_printer_census.nx source

↩ module page · 53 lines · 2490 B

1// nx_printer_census.nx -- R7 organ-graded S-class census (the grader). Per [[feedback-no-wave-measured- 2// exceed]]: a capability's grade is COMPUTED from evidence flags, never asserted -- and "EXCEEDS" is 3// reserved for a MEASURED head-to-head that actually beats the incumbent. This is the liar-kill: you cannot 4// reach a grade without the full contiguous evidence chain beneath it. 5// 6// Maturity ladder (monotonic, contiguous): ABSENT < SPEC'D < BUILT < GATED < LIVE < MEASURED-EXCEEDS. 7// - LIVE requires it actually ran on real hardware (has_live). 8// - MEASURED-EXCEEDS requires has_measure AND beats_baseline (a measured number that beats a measured 9// incumbent baseline). No measurement -> caps at LIVE. Measured but ties/loses -> caps at LIVE. 10// 11// PURE arithmetic, no syscalls -> never-brick. Sovereign. license_tier: ORIGINAL 12// genealogy_id: project-printer-management-ipp-sclass-2026-06-20 ; [[feedback-author-by-organ-not-claude]] 13 14const NX_CEN_ABSENT: i64 = 0 15const NX_CEN_SPEC: i64 = 1 16const NX_CEN_BUILT: i64 = 2 17const NX_CEN_GATED: i64 = 3 18const NX_CEN_LIVE: i64 = 4 19const NX_CEN_EXCEEDS: i64 = 5 20const NX_CEN_N: i64 = 6 21 22func nx_census_is_valid(g: i64) -> i64 { 23 if g < 0 { return 0 } 24 if g >= NX_CEN_N { return 0 } 25 return 1 26} 27 28func nx_census_grade_name(g: i64) -> *u8 { 29 if g == NX_CEN_ABSENT { return "ABSENT" as *u8 } 30 if g == NX_CEN_SPEC { return "SPEC'D" as *u8 } 31 if g == NX_CEN_BUILT { return "BUILT" as *u8 } 32 if g == NX_CEN_GATED { return "GATED" as *u8 } 33 if g == NX_CEN_LIVE { return "LIVE" as *u8 } 34 if g == NX_CEN_EXCEEDS { return "MEASURED-EXCEEDS" as *u8 } 35 return "?" as *u8 36} 37 38// Compute the honest grade from the contiguous evidence chain. Each level requires every level beneath it. 39// EXCEEDS additionally requires a measurement that beats the baseline (the liar-kill). 40func nx_census_grade(has_spec: i64, has_built: i64, has_gate: i64, 41 has_live: i64, has_measure: i64, beats_baseline: i64) -> i64 { 42 if has_spec != 1 { return NX_CEN_ABSENT } 43 var g: i64 = NX_CEN_SPEC 44 if has_built != 1 { return g } 45 g = NX_CEN_BUILT 46 if has_gate != 1 { return g } 47 g = NX_CEN_GATED 48 if has_live != 1 { return g } 49 g = NX_CEN_LIVE 50 if has_measure != 1 { return g } // no measurement -> stays LIVE (cannot self-score EXCEEDS) 51 if beats_baseline != 1 { return g } // measured but doesn't beat -> stays LIVE 52 return NX_CEN_EXCEEDS 53}