code wiki / (root) / nx_sync_promote_gate.nx

nx_sync_promote_gate.nx

buildroot/runtime/nx_sync_promote_gate.nx

8702 B173 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_sync_promote_gate.nx -- proves the PROMOTABLE sync lane (2026-08-22). The defect it guards: the synchronous MCP lane, at its deadline, forked a WATCHDOG that SIGKILLed the worker -- DESTROYING THE ANSWER of every call that outran the 15s edge window while the work itself ran on and its side effects landed. The fix (tr_run_capture_deadline) instead PROMOTES the still-running worker: it returns TR_PROMOTE plus the live pid and read end, and the caller adopts it onto the job lane. This gate drives that function IN-PROCESS against a real fixture ELF (nx_slowtick), so it needs no daemon and no socket -- and it proves the window-pair SSOT (edge_window.conf vs the compiled fallback). SUBJECT for the bite: buildroot/runtime/nx_tool_run.nx (tr_run_capture_deadline) + the fixture _offc/nx_slowtick.elf. The 4th nx_gate_bite arg is MANDATORY (this fork/execs a deployed fixture). BITE-PROVEN 2026-08-22: the targeted incumbent-revert mutation (the promotion arm `if pr == 0 { promoted = 1 }` -> `nx_kill(pid, TR_SIGKILL)`) flipped T1/T2/T3 RED (6/9) while T4-T9 stayed GREEN, and the pristine restore rebuilt byte-identical (b53a887a). The auto-bite was INCONCLUSIVE (generic mutations do not reach the promote/kill decision); the targeted mutation is the real non-vacuity proof and it is recorded here so the next reader need not re-derive it. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_tool_exec_allow.nx nx_gate_verdict.nx nx_sync_promote_gate.nx

imports: nx_tool_exec_allow.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main 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 ↻ gv_head gv_puts sys_write ↻ gv_need gv_puts ↻ spg_has gv_check gv_puts ↻ spg_drain spg_write tea_edge_window_ms_from tea_conf_read tea_conf_int tea_sync_promote_ms_from tea_edge_window_ms_from ↻ tea_reply_reserve_ms_from tea_conf_read ↻ tea_conf_int ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n

structs

none

consts

19const SPG_FIX: *u8 = "_offc/nx_slowtick.elf" as *u8
20const SPG_CAP: i64 = 65536
21const SPG_DEADLINE_MS: i64 = 150 // < the fixture's 600ms sleep, so it is genuinely mid-run at the deadline
22const SPG_LONG_MS: i64 = 5000 // > any fixture runtime, so the fast path finishes inline
23const SPG_DRAIN_MS: i64 = 4000 // upper bound on how long we wait for the promoted tail
24const SPG_POLLFD_BYTES: i64 = 8
25const SPG_POLLIN: i64 = 1
26const SPG_PF_EV_OFF: i64 = 4
27const SPG_PF_FD_BYTES: i64 = 4
28const SPG_BITS: i64 = 8
29const SPG_MASK: i64 = 0xff
31const SPG_FIXCONF_DIR: *u8 = "/tmp/nx_sync_promote_gate" as *u8
32const SPG_FIXCONF_OK: *u8 = "/tmp/nx_sync_promote_gate/edge_window.conf" as *u8
33const SPG_FIXCONF_BAD: *u8 = "/tmp/nx_sync_promote_gate/edge_window_bad.conf" as *u8
34const SPG_FIXCONF_NONE: *u8 = "/tmp/nx_sync_promote_gate/edge_window_absent.conf" as *u8
35const SPG_MODE_DIR: i64 = 493 // 0755
36const SPG_MODE_644: i64 = 420
37const SPG_OTRUNC: i64 = 0x241 // O_WRONLY|O_CREAT|O_TRUNC
38const SPG_AT_FDCWD: i64 = 0 - 100
39const SPG_SYS_OPENAT: i64 = 257

functions

42func spg_has(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main
57func spg_write(path: *u8, content: *u8) -> i64
called by 1: main
66func spg_drain(rfd: i64, out: *u8, cap: i64, deadline_ms: i64) -> i64
called by 1: main
91func main() -> i64