code wiki / _hdl_build / nx_cron_reconcile_gate.nx
nx_cron_reconcile_gate.nx
buildroot/runtime/_hdl_build/nx_cron_reconcile_gate.nx
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
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
structs
| none |
consts
| 48 | const CRG_DIR: *u8 = "/tmp/nx_cron_reconcile_gate" as *u8 |
| 49 | const CRG_CT: *u8 = "/tmp/nx_cron_reconcile_gate/crontab" as *u8 |
| 50 | const CRG_REG_BIG: *u8 = "/tmp/nx_cron_reconcile_gate/reg.big" as *u8 |
| 51 | const CRG_REG_SMALL:*u8 = "/tmp/nx_cron_reconcile_gate/reg.small" as *u8 |
| 52 | const CRG_REG_EMPTY:*u8 = "/tmp/nx_cron_reconcile_gate/reg.empty" as *u8 |
| 53 | const CRG_REG_TAINT:*u8 = "/tmp/nx_cron_reconcile_gate/reg.taint" as *u8 |
| 54 | const CRG_REG_GONE: *u8 = "/tmp/nx_cron_reconcile_gate/reg.does-not-exist" as *u8 |
| 58 | const CRG_OLD_CAP: i64 = 16384 |
| 61 | const CRG_OLD_READ: i64 = 16383 |
| 62 | const CRG_ROWS: i64 = 140 |
| 65 | const CRG_CUT_MARGIN:i64 = 8 |
| 66 | const CRG_SPACE: i64 = 32 |
| 67 | const CRG_DIR_MODE: i64 = 493 |
| 68 | const CRG_MODE_644: i64 = 420 |
| 69 | const CRG_BUF: i64 = 262144 |
| 70 | const CRG_OUT: i64 = 65536 |
| 71 | const CRG_TIMEOUT_MS:i64 = 30000 |
| 72 | const CRG_ARGV_SLOTS:i64 = 64 |
| 73 | const CRG_ASCII_0: i64 = 48 |
| 74 | const CRG_ASCII_9: i64 = 57 |
| 75 | const CRG_B10: i64 = 10 |
| 76 | const CRG_NL: i64 = 10 |
| 77 | const CRG_HASH: i64 = 35 |
| 79 | const CRG_EXIT_OK: i64 = 0 |
| 80 | const CRG_EXIT_REGREF: i64 = 3 |
| 81 | const CRG_EXIT_TAINT: i64 = 5 |
functions
| 83 | func crg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 84 | func 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 } |
| 85 | func crg_catn(d: *u8, o: i64, v: i64) -> i64 |
| 97 | func crg_contains(buf: *u8, n: i64, needle: *u8) -> i64 |
| 113 | func crg_num_after(buf: *u8, n: i64, marker: *u8) -> i64 |
| 141 | func crg_catn3(d: *u8, o: i64, v: i64) -> i64 called by 1: crg_row |
| 149 | func crg_mark_end(row: *u8, n: i64) -> i64 |
| 164 | func crg_hdr(d: *u8, h: i64) -> i64 |
| 173 | func crg_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 184 | func crg_slurp(path: *u8, dst: *u8, cap: i64, outlen: *i64) -> i64 |
| 202 | func crg_row(d: *u8, o: i64, idx: i64) -> i64 |
| 210 | func crg_run(subject: *u8, ctpath: *u8, regpath: *u8, out: *u8, outlen: *i64) -> i64 |
| 218 | func crg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 220 | func main(argc: i64, argv: *i64) -> i64 |