code wiki / (root) / nx_bright_rewrite_gate.nx

nx_bright_rewrite_gate.nx

buildroot/runtime/nx_bright_rewrite_gate.nx

17955 B239 linesdepth 11pulls 39 transitivereach 0 importersview sourcekind gate/prooftopic bright
docsdependenciesstructsconstsfunctions

about

nx_bright_rewrite_gate.nx -- the referee for nx_bright_rewrite_lib (search R0l, 2026-09-16): the remote engine door, the idempotent re-run, the per-split lease and the split verdict, driven IN-PROCESS on a /tmp fixture tree (no model, no network peer: the engine under test is 127.0.0.1:1, a port nothing listens on, so the ENGINE-DOWN path is reached for real and never a passthrough row is manufactured from it). Scratch lives in /tmp/nx_bright_rewrite_gate/ (fixture-ratchet law), created at setup, and every fixture file is truncate-written or unlinked first so the gate is idempotent run after run. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_bright_rewrite_lib.nx nx_gate_verdict.nx nx_bright_rewrite_gate.nx

imports: nx_bright_rewrite_lib.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 ↻ bg_mkdir bg_split_path br_path br_cat bg_write br_write_all sys_write ↻ br_slen bg_rm br_eng_alloc sys_mmap ↻ br_engine_parse gv_check gv_puts ↻ gv_check_eq gv_check ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

11const BG_DIR: *u8 = "/tmp/nx_bright_rewrite_gate" as *u8
12const BG_ROOT: *u8 = "/tmp/nx_bright_rewrite_gate/root" as *u8
13const BG_LEASE_ROOT: *u8 = "/tmp/nx_bright_rewrite_gate/lease/" as *u8
14const BG_OUT: *u8 = "gatefix" as *u8
15const BG_MODE_DIR: i64 = 493
16const BG_CAP: i64 = 65536
17const BG_ENGINE_DEAD: *u8 = "127.0.0.1:1" as *u8
18const BG_TTL: i64 = 60 // a crashed gate run frees its own fixture lease within a minute
20const BG_ORACLE_TOK_PRED: i64 = 301
21const BG_ORACLE_PRED_MS: i64 = 2210
22const BG_PERMIL_ONE: i64 = 1000
23const BG_PERMIL_ZERO: i64 = 0

functions

25func bg_mkdir(p: *u8) -> i64 { return sys_mkdir(p, BG_MODE_DIR) }
called by 1: main
26func bg_write(p: *u8, s: *u8) -> i64
called by 1: main calls 2: br_write_allbr_slen
33func bg_exists(p: *u8) -> i64 { let fd: i64 = sys_openat_rd(p); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: main
34func bg_rm(p: *u8) -> i64 { return sys_unlinkat(p) }
called by 1: main
36func bg_crlf(dst: *u8, o: i64) -> i64 { dst[o] = 13 as u8; dst[o + 1] = 10 as u8; return o + 2 }
called by 1: bg_http
37func bg_http(dst: *u8, code: i64, body: *u8) -> i64
called by 1: main calls 4: br_catbr_catnbg_crlfbr_slen
46func bg_split_path(dst: *u8, split: *u8, tail: *u8) -> i64 { return br_path(dst, BG_ROOT, split, tail) }
called by 1: main calls 1: br_path
48func main(argc: i64, argv: *i64) -> i64