nx_safety_critical_grade.nx
buildroot/runtime/nx_safety_critical_grade.nx
about
nx_safety_critical_grade.nx -- Layer-3 safety-critical grader.
8th perspective in the heptagulation -> octagulation, per cardinal
feedback-exceed-jpl-iec-ieee-zero-injuries-while-winning (2026-05-16):
"our nishi stuff should exceed nasas jpl standards and the safety
standards etc as part of our racing crew work, zero injuries in
the workplace while still winning everytime"
Companion catalog: nishi-library/seeds/safety-critical-standards.toml
Eight safety axes scored per source file:
1. bounded_loop_coverage -- JPL Rule 2 + IEC 61508 SIL termination
2. assertion_density -- JPL Rule 5 + DO-178C verification
3. sealed_enum_completeness -- DO-178C formal-method equivalent
4. soup_purity -- IEC 62304 + license-tier wall
5. mcdc_branch_coverage -- DO-178C DAL A (IR-level, queued)
6. fault_injection_survived -- IEC 61508 DC (telemetry corpus, queued)
7. hazard_register_match -- ISO 26262 HARA / MIL-STD-882 (corpus)
8. iv_and_v_perspective_count -- NASA-STD-8719 IV&V (other graders)
First cut implements axes 1-4 via lexical scan. Axes 5-8 require
IR-level / corpus / cross-grader input that this file's scan does
not have; they return NX_SC_VERDICT_UNMEASURED with a clear
named-improvement pointing at what's needed to populate them.
Per cardinal feedback-honest-perf-verdict-no-aspirational-claims:
the verdict explicitly distinguishes WIN (axis passed) from
UNMEASURED (axis not yet evaluable) from LOSE (axis evaluated +
failed). An overall WIN_S requires all 8 axes to be WIN, not
MIX(WIN, UNMEASURED).
license_tier: ORIGINAL
genealogy_id: substrate-native synthesis of NASA-JPL-Power-of-10 +
IEC-61508 + ISO-26262 + DO-178C + IEC-62304 +
NASA-STD-8719.13 + MIL-STD-882E (all OPEN sources
per feedback-nishi-library-open-research-not-paywall-
funding)
nx_safety_envelope: (META -- this is the safety grader itself)
dependencies 4 imports · 1 importers
imports: nx_syscalls.nxnx_runtime.nxnx_types.nxnx_tier.nx
imported by: nx_safety_critical_grade_test.nx
structs
| 104 | struct SafetyAxisReport |
| 111 | struct SafetyCard |
consts
| 84 | const NX_SC_VERDICT_UNMEASURED: nx_int = 0 |
| 85 | const NX_SC_VERDICT_WIN: nx_int = 1 |
| 86 | const NX_SC_VERDICT_LOSE: nx_int = 2 |
| 87 | const NX_SC_VERDICT_TIE: nx_int = 3 |
| 88 | const NX_SC_VERDICT_WIN_S: nx_int = 4 // unanimous WIN across all 8 axes |
| 92 | const NX_SC_AXIS_BOUNDED_LOOP: nx_int = 0 |
| 93 | const NX_SC_AXIS_ASSERTION_DENSITY: nx_int = 1 |
| 94 | const NX_SC_AXIS_SEALED_ENUM: nx_int = 2 |
| 95 | const NX_SC_AXIS_SOUP_PURITY: nx_int = 3 |
| 96 | const NX_SC_AXIS_MCDC_BRANCH: nx_int = 4 |
| 97 | const NX_SC_AXIS_FAULT_INJECTION: nx_int = 5 |
| 98 | const NX_SC_AXIS_HAZARD_REGISTER: nx_int = 6 |
| 99 | const NX_SC_AXIS_IV_AND_V_COUNT: nx_int = 7 |
| 100 | const NX_SC_AXIS_N: nx_int = 8 |
functions
| 128 | func _sc_byte_at(src: *u8, i: nx_int) -> nx_int called by 1: _sc_eq_at |
| 134 | func _sc_eq_at(src: *u8, src_len: nx_int, off: nx_int, needle: *u8, needle_len: nx_int) -> nx_int |
| 148 | func _sc_count_substr(src: *u8, src_len: nx_int, needle: *u8, needle_len: nx_int) -> nx_int |
| 181 | func _sc_axis_bounded_loop(src: *u8, src_len: nx_int) -> nx_int |
| 215 | func _sc_axis_assertion_density(src: *u8, src_len: nx_int, fn_count_out: *nx_int) -> nx_int |
| 244 | func _sc_axis_sealed_enum(src: *u8, src_len: nx_int) -> nx_int |
| 270 | func _sc_axis_soup_purity(src: *u8, src_len: nx_int, tier_present_out: *nx_int) -> nx_int |
| 294 | func _sc_set_axis(rep: *SafetyAxisReport, axis: nx_int, raw: nx_int, thr: nx_int, verdict: nx_int) -> nx_int called by 1: nx_safety_critical_scan |
| 304 | func nx_safety_critical_scan(src: *u8, src_len: nx_int, card: *SafetyCard) -> nx_int |
| 384 | func nx_safety_critical_scan_file(path: *u8, card: *SafetyCard) -> nx_int |
| 401 | func nx_safety_critical_named_improvement(axis: nx_int) -> *u8 |
| 429 | func nx_safety_critical_card_alloc() -> *SafetyCard |