code wiki / _hdl_build / nx_discovery_selfheal_beat.nx

nx_discovery_selfheal_beat.nx

buildroot/runtime/_hdl_build/nx_discovery_selfheal_beat.nx

4965 B96 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tool_run.nx nx_discovery_selfheal_beat.nx

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

main sys_mmap tr_run_capture_to tr_run_capture sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_dup3 sys_execve_clean sys_close ↻ sys_execve sys_exit sys_read sys_wait4 wait_exit_code sys_mmap ↻ sys_pipe2 ↻ sys_fork ↻ sys_close ↻ sys_default_signal sys_mmap ↻ sys_dup3 ↻ sys_execve_clean ↻ sys_exit ↻ sys_sleep_ms sys_mmap ↻ sys_munmap nx_kill sys_read ↻ sys_wait4 ↻ wait_exit_code ↻ db_puts sys_write db_len db_putn sys_mmap ↻ db_puts ↻ sys_write ↻ db_tail

structs

none

consts

25const DB_OUTCAP: i64 = 65536
26const DB_AVCAP: i64 = 40
27const DB_STDOUT: i64 = 1
28const DB_BACKFILL: *u8 = "./nx_schema_backfill.elf" as *u8
29const DB_RECONCILE: *u8 = "./nx_toolreg_reconcile.elf" as *u8
30const DB_HEAL: *u8 = "heal" as *u8
31const DB_STEP_MS: i64 = 120000

functions

33func 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
34func db_puts(s: *u8) -> i64 { sys_write(DB_STDOUT, s, db_len(s)); return 0 }
called by 2: db_putnmain calls 2: sys_writedb_len
35func db_putn(v: i64) -> i64
called by 1: main calls 3: sys_mmapdb_putssys_write
47func db_tail(out: *u8, n: i64) -> i64
called by 1: main calls 1: sys_write
63func main(argc: i64, argv: *i64) -> i64