code wiki / _hdl_build / nx_gatescan.nx
nx_gatescan.nx
buildroot/runtime/_hdl_build/nx_gatescan.nx
about
nx_gatescan.nx -- FIND THE ORGANS NOTHING IS CHECKING.
===== WHY THIS EXISTS ============================================
Two defects were found by luck in this ecosystem within one session:
nx_pow10 -- no gate of its own. Its header claimed an interpolation
error of <=0.3%; measured, it is 0.66%. That figure had
been inherited into a FOOD-SAFETY margin note.
nx_arrhenius -- no gate AND nothing imported it. It returned exactly 1.0
for every input, i.e. "temperature does not affect
reaction rate", from a file whose own comment claimed it
carefully managed precision across the reciprocal step.
Both were caught because someone happened to look. That is not a control.
A session must remember; a tool cannot forget. This organ turns
"no gate + no callers = an unverified intention" from a law into a scan.
===== THE MEASUREMENT ============================================
Composes the existing graph engine rather than rebuilding it: the whole-
tree walk and accurate import edges already exist and are proven, so this
adds exactly one idea on top of them.
HAS_GATE -- a node named <base>_test.nx or <base>_gate.nx exists.
CONSUMERS -- importers that are NOT that organ's own gate.
★THE SECOND HALF IS THE LOAD-BEARING ONE. Raw fan-in (Ca) counts the gate
as an importer, so the moment you write a gate for a dead organ its Ca
becomes 1 and a naive orphan check calls it "used". That is exactly what
would have hidden nx_arrhenius the instant it was gated. Consumers are
therefore counted with gate/test importers EXCLUDED.
===== RISK IS RANKED, NOT LISTED =================================
A flat list of ungated files invites working the easy end. The two classes
are not equally dangerous and the ranking says so:
UNGATED-LOAD-BEARING (no gate, N consumers) -- an error here propagates
into N callers and is attributed to whichever one notices first.
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_eco_graph.nxnx_import_scan.nxnx_gatelib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 59 | const GS_MAGIC_4096: i64 = 4096 |
| 60 | const GS_MAGIC_1024: i64 = 1024 |
| 62 | const GS_MAXNODE: i64 = 24000 |
| 63 | const GS_MAXEDGE: i64 = 300000 |
| 64 | const GS_ARENA: i64 = 4194304 |
| 65 | const GS_HASH: i64 = 65536 |
| 66 | const GS_FILECAP: i64 = 262144 |
| 91 | const GS_DEAD_FLOOR: i64 = 3 |
functions
| 93 | func gw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 94 | func gn(v: i64) -> i64 { let b: *u8 = sys_mmap(24); var m: i64 = v; if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } let t: *u8 = sys_mmap(24); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { b[i] = t[k - 1 - i]; i = i + 1 } sys_write(1, b, k); return 0 } |
| 105 | func gs_make_gate_name(name: *u8, n: i64, suffix: *u8, out: *u8) -> i64 |
| 137 | func main(argc: i64, argv: *i64) -> i64 |