code wiki / (root) / nx_rigfloor_gate.nx

nx_rigfloor_gate.nx

buildroot/runtime/nx_rigfloor_gate.nx

25843 B525 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_rigfloor_gate.nx -- THE GATE FOR THE DERIVED ASSET FLOOR. SUBJECT: the nx_rigfloor ELF, forked for real. The organ's whole contract is its FOUR-STATE EXIT (0 OK / 1 OUT-OF-BAND / 2 usage / 3 UNOBSERVABLE), and /api/gate_run derives its verdict from an exit code, so a gate that inspected only stdout would test the least load-bearing half. Every tooth here asserts an EXIT CODE, and the content teeth additionally read the conf that was actually written. FIXTURES ARE ASSEMBLED AT RUNTIME, IN /tmp/nx_rigfloor_gate/. Two reasons, both measured in this estate: a detector that scans source will find its own test fixture (writing the pattern in a COMMENT re-arms the trap), and a gate that shares scratch with a production beat reports on the FIXTURE rather than the code -- segguard folded a real store mid-run and the gate blamed the subject. Scratch is created by sys_mkdir at SETUP, because a teardown does not run when a run crashes. THE ANTI-VACUITY TOOTH IS T2, AND IT IS THE POINT. T1 only proves the organ exited 0. A floor organ that wrote a hardcoded conf and exited 0 would pass T1 forever. T2 asserts the fixture REACHED THE CONDITION (n_read equals the rows the roster declared) and T3 asserts the emitted band actually SPANS the fixture values -- i.e. that the number was MEASURED, not emitted. A green here without T2/T3 would be the gates-green-on-garbage class. THE NEGATIVE CONTROL IS T5, PAIRED WITH T4 THROUGH gv_bite: an asset inside the band must score IN-BAND and an asset outside it must score OUT-OF-BAND. A guard that refuses everything passes every deny-test, so the ALLOW case is not decoration -- it is the half that catches it. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_rigfloor_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_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_puts ↻ sys_mkdir sys_unlinkat rg_write_nxa sys_mmap ↻ rg_wr64 rg_tag sys_openat_wr sys_write ↻ sys_close rg_write_text sys_openat_wr ↻ sys_write ↻ sys_close ↻ gv_check gv_puts ↻ rg_exists sys_mmap ↻ sys_read_file sys_openat_rd

structs

none

consts

32const RG_SUBJECT_DEFAULT: *u8 = "_offc/nx_rigfloor.elf"
35const RG_EXIT_OK: i64 = 0
36const RG_EXIT_OUT_OF_BAND: i64 = 1
37const RG_EXIT_UNOBSERVABLE: i64 = 3
40const RG_HDR_BYTES: i64 = 32
41const RG_SECHDR_BYTES: i64 = 32
42const RG_SEC_OFF_FIELD: i64 = 8
43const RG_NSEC_FIELD: i64 = 16
44const RG_VERSION_FIELD: i64 = 8
45const RG_WORD_BYTES: i64 = 8
46const RG_TAG_BYTES: i64 = 4
47const RG_NXA_VERSION: i64 = 1
48const RG_SECTIONS: i64 = 3 // VERT, TRIS, SKEL -- the three this organ measures
49const RG_BYTE_RADIX: i64 = 256
50const RG_BYTE_MASK: i64 = 255
55const RG_A_VERTS: i64 = 5000
56const RG_A_TRIS: i64 = 9000
57const RG_A_JOINTS: i64 = 50
58const RG_B_VERTS: i64 = 7000
59const RG_B_TRIS: i64 = 13000
60const RG_B_JOINTS: i64 = 60
61const RG_C_VERTS: i64 = 9000
62const RG_C_TRIS: i64 = 17000
63const RG_C_JOINTS: i64 = 70
65const RG_IN_VERTS: i64 = 7000
66const RG_IN_TRIS: i64 = 13000
67const RG_IN_JOINTS: i64 = 60
69const RG_OUT_VERTS: i64 = 900000
70const RG_OUT_TRIS: i64 = 1700000
71const RG_OUT_JOINTS: i64 = 65
73const RG_CAPTURE_CAP: i64 = 262144
74const RG_PATH_CAP: i64 = 4096
75const RG_ARGV_SLOTS: i64 = 8
76const RG_MODE_DIR: i64 = 493 // 0755
77const RG_ASCII_NL: i64 = 10
78const RG_ASCII_EQ: i64 = 61
79const RG_ASCII_ZERO: i64 = 48
80const RG_ASCII_NINE: i64 = 57
81const RG_DECIMAL: i64 = 10
82const RG_MISS: i64 = 0 - 999999
84const RG_DIR: *u8 = "/tmp/nx_rigfloor_gate"
85const RG_A: *u8 = "/tmp/nx_rigfloor_gate/a.nxa"
86const RG_B: *u8 = "/tmp/nx_rigfloor_gate/b.nxa"
87const RG_C: *u8 = "/tmp/nx_rigfloor_gate/c.nxa"
88const RG_IN: *u8 = "/tmp/nx_rigfloor_gate/in.nxa"
89const RG_OUT: *u8 = "/tmp/nx_rigfloor_gate/out.nxa"
90const RG_ROSTER_OK: *u8 = "/tmp/nx_rigfloor_gate/ok.roster"
91const RG_ROSTER_ONE: *u8 = "/tmp/nx_rigfloor_gate/one.roster"
92const RG_ROSTER_BAD: *u8 = "/tmp/nx_rigfloor_gate/bad.roster"
93const RG_CONF: *u8 = "/tmp/nx_rigfloor_gate/floor.conf"
94const RG_CONF_ONE: *u8 = "/tmp/nx_rigfloor_gate/one.conf"
95const RG_CONF_BAD: *u8 = "/tmp/nx_rigfloor_gate/bad.conf"
96const RG_CONF_HOLED: *u8 = "/tmp/nx_rigfloor_gate/holed.conf"
97const RG_NOSUCH: *u8 = "/tmp/nx_rigfloor_gate/no_such_roster_at_all"
98const RG_ROSTER_SAME: *u8 = "/tmp/nx_rigfloor_gate/same.roster"
99const RG_CONF_SAME: *u8 = "/tmp/nx_rigfloor_gate/same.conf"
100const RG_CONF_XCONT: *u8 = "/tmp/nx_rigfloor_gate/xcont.conf"
102const RG_U32_BYTES: i64 = 4
103const RG_MSH_MAGIC_LEN: i64 = 6 // "NXMSH2"; bytes +6/+7 stay zero
104const RG_MSH_HDR: i64 = 16
105const RG_MSH_LAYROW: i64 = 24
106const RG_MSH_TRIREC: i64 = 84 // 21 float32: 9 position + 9 normal + 3 per-tri colour
107const RG_MSH_NLAY_OFF: i64 = 8
108const RG_MSH_NTRI_OFF: i64 = 12
109const RG_MSH_LAY_OFF_FIELD: i64 = 16
110const RG_MSH_LAY_CNT_FIELD: i64 = 20
111const RG_MSH_A_TRIS: i64 = 400
112const RG_MSH_A_LAYS: i64 = 4
113const RG_MSH_B_TRIS: i64 = 900
114const RG_MSH_B_LAYS: i64 = 9
115const RG_MSH_Z_TRIS: i64 = 500 // the ZERO-LAYER case
116const RG_MSH_A: *u8 = "/tmp/nx_rigfloor_gate/m_a.nxmesh"
117const RG_MSH_B: *u8 = "/tmp/nx_rigfloor_gate/m_b.nxmesh"
118const RG_MSH_Z: *u8 = "/tmp/nx_rigfloor_gate/m_zero.nxmesh"
119const RG_ROSTER_MSH: *u8 = "/tmp/nx_rigfloor_gate/msh.roster"
120const RG_ROSTER_ZERO: *u8 = "/tmp/nx_rigfloor_gate/zero.roster"
121const RG_ROSTER_MIX: *u8 = "/tmp/nx_rigfloor_gate/mix.roster"
122const RG_CONF_MSH: *u8 = "/tmp/nx_rigfloor_gate/msh.conf"
123const RG_CONF_ZERO: *u8 = "/tmp/nx_rigfloor_gate/zero.conf"
124const RG_CONF_MIX: *u8 = "/tmp/nx_rigfloor_gate/mix.conf"

functions

126func rg_wr32(b: *u8, off: i64, v: i64) -> i64
called by 1: rg_write_msh
137func rg_wr64(b: *u8, off: i64, v: i64) -> i64
called by 1: rg_write_nxa
148func rg_tag(b: *u8, off: i64, t: *u8) -> i64
called by 1: rg_write_nxa
154func rg_write_nxa(path: *u8, nv: i64, nt: i64, nj: i64) -> i64
188func rg_write_msh(path: *u8, nlay: i64, ntri: i64) -> i64
212func rg_write_text(path: *u8, s: *u8) -> i64
223func rg_run(subject: *u8, verb: *u8, a2: *u8, a3: *u8, out: *u8, outlen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
234func rg_conf(buf: *u8, n: i64, key: *u8) -> i64
called by 1: rg_conf_of
274func rg_conf_of(path: *u8, key: *u8) -> i64
called by 1: main calls 3: sys_mmapsys_read_filerg_conf
280func rg_exists(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
287func main(argc: i64, argv: *i64) -> i64