code wiki / _hdl_build / nx_cron_reconcile_gate.nx

nx_cron_reconcile_gate.nx

buildroot/runtime/_hdl_build/nx_cron_reconcile_gate.nx

22456 B423 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic cron
docsdependenciesstructsconstsfunctions

about

nx_cron_reconcile_gate.nx -- THE REFEREE nx_cron_reconcile NEVER HAD, WHICH IS WHY IT SURVIVED. WHAT IT EXISTS TO CATCH. For at least two weeks this organ applied a PREFIX of its own SSOT and reported it as the whole: cr_read did ONE sys_read of CR_REGCAP-1 = 16383 bytes with no truncation check while cron.reg had grown to 24356, so 11 declared rows were silently inert -- including the estate's only compensating control over a fail-open authentication path. Nothing caught it because nx_catalog nx_cron_reconcile_gate read ABSENT: there was no gate at all. **** THE DECISIVE TOOTH IS T1: A REGISTRY BIGGER THAN THE OLD CAP, EVERY ROW APPLIED. **** THE PRE-FIX BINARY IS THE FREE MUTANT. Point argv[1] at it and T1/T2/T9 must go RED; point argv[1] at the fixed binary and they must go GREEN. A gate whose decisive tooth has only ever seen the fixed binary has not been shown to fire. ⚠TRUNCATION HAS TWO MANIFESTATIONS AND ONLY ONE OF THEM IS THE PRODUCTION ONE. MEASURED HERE 2026-08-20 while building this gate: where the 16383-byte cut lands INSIDE a row decides which. Cut EARLY in a row and the surviving fragment has lost "/nishihost/", so R3 fires and the organ REFUSES exit 5 -- loud, safe, and NOT what happened in production. Cut LATE in a row and the fragment still carries the mark, so the organ counts it, writes a crontab missing every later row, and reports CHANGED with exit 0. THAT is the production shape: a success message over a prefix. The first draft of this fixture hit the refusal by luck and its decisive tooth went RED for the WRONG REASON -- a red that would have read as proof while measuring something else entirely. **** A TOOTH THAT FAILS FOR A DIFFERENT REASON THAN THE ONE IT NAMES IS NOT EVIDENCE. **** So the header pad is now SOLVED FOR, not chosen: rows are uniform length and the comment header is sized by modular arithmetic so the old cut lands CRG_CUT_MARGIN bytes before a row end. T0 asserts that condition arithmetically before any outcome is asserted, and T1 requires exit 0 AND the last row present -- so the broken binary cannot pass by refusing either. THE VACUITY GUARD COMES FIRST AND IT IS NOT DECORATION. A fixture registry that does not actually EXCEED the old 16384-byte cap makes T1 pass against the BROKEN binary too, and the gate would then certify the defect. So T0 asserts the fixture reached the condition -- total bytes over the cap AND the last declared row STARTING past it -- before any outcome is asserted. The estate has shipped four vacuous fixtures in one day before (a 900 B trigger with an 836 B fixture); this is that lesson. SCRATCH IS /tmp/nx_cron_reconcile_gate/ AND THE SUBJECT NEVER SEES A REAL CRONTAB. The organ's own usage line already says "gate runs it on COPIES; prod = /etc/crontab". The fixture rows name nx_gatefixture_*.sh, which does not exist and is never installed anywhere -- they live and die in /tmp. Setup creates and clears; there is no teardown, because a teardown does not run when a run crashes. ⚠ONE HONEST SIDE EFFECT, NAMED RATHER THAN HIDDEN: on a CHANGED result the subject walks /proc and SIGHUPs every `crond`. Running this gate on the NAS therefore reloads the real crond. That reload is of an UNCHANGED /etc/crontab and is the same standard, non-destructive signal the organ already sends

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_cron_reconcile_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.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 gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ crg_exists sys_openat_rd sys_close gv_puts ↻ gv_need gv_puts ↻ sys_mkdir sys_openat_wr sys_close ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap

structs

none

consts

48const CRG_DIR: *u8 = "/tmp/nx_cron_reconcile_gate" as *u8
49const CRG_CT: *u8 = "/tmp/nx_cron_reconcile_gate/crontab" as *u8
50const CRG_REG_BIG: *u8 = "/tmp/nx_cron_reconcile_gate/reg.big" as *u8
51const CRG_REG_SMALL:*u8 = "/tmp/nx_cron_reconcile_gate/reg.small" as *u8
52const CRG_REG_EMPTY:*u8 = "/tmp/nx_cron_reconcile_gate/reg.empty" as *u8
53const CRG_REG_TAINT:*u8 = "/tmp/nx_cron_reconcile_gate/reg.taint" as *u8
54const CRG_REG_GONE: *u8 = "/tmp/nx_cron_reconcile_gate/reg.does-not-exist" as *u8
58const CRG_OLD_CAP: i64 = 16384
61const CRG_OLD_READ: i64 = 16383
62const CRG_ROWS: i64 = 140
65const CRG_CUT_MARGIN:i64 = 8
66const CRG_SPACE: i64 = 32
67const CRG_DIR_MODE: i64 = 493
68const CRG_MODE_644: i64 = 420
69const CRG_BUF: i64 = 262144
70const CRG_OUT: i64 = 65536
71const CRG_TIMEOUT_MS:i64 = 30000
72const CRG_ARGV_SLOTS:i64 = 64
73const CRG_ASCII_0: i64 = 48
74const CRG_ASCII_9: i64 = 57
75const CRG_B10: i64 = 10
76const CRG_NL: i64 = 10
77const CRG_HASH: i64 = 35
79const CRG_EXIT_OK: i64 = 0
80const CRG_EXIT_REGREF: i64 = 3
81const CRG_EXIT_TAINT: i64 = 5

functions

83func crg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
84func crg_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p }
called by 2: crg_rowmain
85func crg_catn(d: *u8, o: i64, v: i64) -> i64
97func crg_contains(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: crg_slen
113func crg_num_after(buf: *u8, n: i64, marker: *u8) -> i64
called by 1: main calls 1: crg_slen
141func crg_catn3(d: *u8, o: i64, v: i64) -> i64
called by 1: crg_row
149func crg_mark_end(row: *u8, n: i64) -> i64
called by 1: main calls 1: crg_slen
164func crg_hdr(d: *u8, h: i64) -> i64
called by 1: main calls 1: crg_slen
173func crg_write(path: *u8, buf: *u8, n: i64) -> i64
184func crg_slurp(path: *u8, dst: *u8, cap: i64, outlen: *i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
202func crg_row(d: *u8, o: i64, idx: i64) -> i64
called by 1: main calls 2: crg_catcrg_catn3
210func crg_run(subject: *u8, ctpath: *u8, regpath: *u8, out: *u8, outlen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture_to
218func crg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: main calls 2: sys_openat_rdsys_close
220func main(argc: i64, argv: *i64) -> i64