code wiki / (root) / nx_safety_critical_grade.nx

nx_safety_critical_grade.nx

buildroot/runtime/nx_safety_critical_grade.nx

19054 B433 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind librarytopic safety
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_runtime.nx nx_types.nx nx_tier.nx nx_safety_critical_grade.nx nx_safety_critical_grade_test.nx

imports: nx_syscalls.nxnx_runtime.nxnx_types.nxnx_tier.nx

imported by: nx_safety_critical_grade_test.nx

structs

104struct SafetyAxisReport
111struct SafetyCard

consts

84const NX_SC_VERDICT_UNMEASURED: nx_int = 0
85const NX_SC_VERDICT_WIN: nx_int = 1
86const NX_SC_VERDICT_LOSE: nx_int = 2
87const NX_SC_VERDICT_TIE: nx_int = 3
88const NX_SC_VERDICT_WIN_S: nx_int = 4 // unanimous WIN across all 8 axes
92const NX_SC_AXIS_BOUNDED_LOOP: nx_int = 0
93const NX_SC_AXIS_ASSERTION_DENSITY: nx_int = 1
94const NX_SC_AXIS_SEALED_ENUM: nx_int = 2
95const NX_SC_AXIS_SOUP_PURITY: nx_int = 3
96const NX_SC_AXIS_MCDC_BRANCH: nx_int = 4
97const NX_SC_AXIS_FAULT_INJECTION: nx_int = 5
98const NX_SC_AXIS_HAZARD_REGISTER: nx_int = 6
99const NX_SC_AXIS_IV_AND_V_COUNT: nx_int = 7
100const NX_SC_AXIS_N: nx_int = 8

functions

128func _sc_byte_at(src: *u8, i: nx_int) -> nx_int
called by 1: _sc_eq_at
134func _sc_eq_at(src: *u8, src_len: nx_int, off: nx_int, needle: *u8, needle_len: nx_int) -> nx_int
called by 1: _sc_count_substr calls 1: _sc_byte_at
148func _sc_count_substr(src: *u8, src_len: nx_int, needle: *u8, needle_len: nx_int) -> nx_int
181func _sc_axis_bounded_loop(src: *u8, src_len: nx_int) -> nx_int
215func _sc_axis_assertion_density(src: *u8, src_len: nx_int, fn_count_out: *nx_int) -> nx_int
244func _sc_axis_sealed_enum(src: *u8, src_len: nx_int) -> nx_int
270func _sc_axis_soup_purity(src: *u8, src_len: nx_int, tier_present_out: *nx_int) -> nx_int
294func _sc_set_axis(rep: *SafetyAxisReport, axis: nx_int, raw: nx_int, thr: nx_int, verdict: nx_int) -> nx_int
304func nx_safety_critical_scan(src: *u8, src_len: nx_int, card: *SafetyCard) -> nx_int
384func nx_safety_critical_scan_file(path: *u8, card: *SafetyCard) -> nx_int
401func nx_safety_critical_named_improvement(axis: nx_int) -> *u8
429func nx_safety_critical_card_alloc() -> *SafetyCard