code wiki / _hdl_build / nx_discovery_selfheal_beat.nx
nx_discovery_selfheal_beat.nx
buildroot/runtime/_hdl_build/nx_discovery_selfheal_beat.nx
about
nx_discovery_selfheal_beat.nx -- makes the discovery-selfheal check ACTUALLY self-heal.
THE DEFECT THIS EXISTS TO KILL (measured 2026-07-30): the sweep row ran `nx_toolreg_reconcile heal`,
a verb named "heal" that only DIAGNOSES -- it prints `no-schema-residue=N needs-author-schema: ...`
and exits 1. Closing it needs a THREE-COMMAND MANUAL SEQUENCE (schema_backfill -> reconcile ->
heal), so every time any lane shipped a tool without a schema header the row went RED and STAYED
red until a human noticed. It sat red for 24+ consecutive cycles at 0 permille. Clearing the
backlog by hand does NOT fix it: within one hour of clearing 14, five MORE arrived
(nx_meshprofile, nx_routeguard, nx_wirecensus, nx_arousal_skin_gate, nx_arousal_mesh_gate) from
other lanes shipping normally. A treadmill is not a defect in the lanes -- it is a missing loop.
So this beat RUNS the loop the check was only ever reporting on:
1. ./nx_schema_backfill.elf harvest schemas from source headers (idempotent)
2. ./nx_toolreg_reconcile.elf publish them into the registry
3. ./nx_toolreg_reconcile.elf heal judge, and EXIT WITH ITS CODE
Step 3's rc is the beat's rc, so the rail still judges the real invariant -- we heal first, then
report honestly. If a residue SURVIVES the backfill (an organ whose source has no header at all)
the beat still goes RED and NAMES it, because that one genuinely needs a human to author it.
Rule 10 idempotent: backfill is idempotent by contract; reconcile skips already-registered rows.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_tool_run.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
| 25 | const DB_OUTCAP: i64 = 65536 |
| 26 | const DB_AVCAP: i64 = 40 |
| 27 | const DB_STDOUT: i64 = 1 |
| 28 | const DB_BACKFILL: *u8 = "./nx_schema_backfill.elf" as *u8 |
| 29 | const DB_RECONCILE: *u8 = "./nx_toolreg_reconcile.elf" as *u8 |
| 30 | const DB_HEAL: *u8 = "heal" as *u8 |
| 31 | const DB_STEP_MS: i64 = 120000 |
functions
| 33 | func db_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: db_puts |
| 34 | func db_puts(s: *u8) -> i64 { sys_write(DB_STDOUT, s, db_len(s)); return 0 } |
| 35 | func db_putn(v: i64) -> i64 |
| 47 | func db_tail(out: *u8, n: i64) -> i64 |
| 63 | func main(argc: i64, argv: *i64) -> i64 |