code wiki / (root) / nx_roundtrip_gate.nx

nx_roundtrip_gate.nx

buildroot/runtime/nx_roundtrip_gate.nx

17557 B338 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_roundtrip_gate.nx -- THE GATE FOR THE SELF-ORACLE. SUBJECT: the nx_roundtrip ELF, forked for real. Its contract is a FOUR-STATE EXIT (0 IDENTICAL / 1 LOSSY / 2 usage / 3 UNOBSERVABLE) and /api/gate_run derives its verdict from an exit code, so every tooth here asserts an EXIT CODE. A gate whose exit does not carry its verdict silently blesses every failure it finds. THE FIXTURES ARE MIXED ON PURPOSE, AND THE REASON IS MEASURED. The two POSITIVE fixtures are real pipeline artifacts (nx_gltf2mesh's own conversion of two donor GLBs), copied to a durable knowledge/ path and byte-verified. Three hand-authored containers were tried first and every one went RED for a reason unrelated to fidelity -- metre-scale coordinates were rescaled on the return leg, millimetre ones were refused outright, unit normals changed nothing -- because a synthetic container cannot reliably reproduce the canonical regime the pipeline emits, and a fixture the subject rejects tests the fixture rather than the subject. The NEGATIVE fixture stays synthetic and IS built at runtime, because a container truncated BY CONSTRUCTION is the one thing no real artifact can supply. THE BITE PAIR IS T1/T2 AND IT IS THE POINT. A checker that returned IDENTICAL for everything would pass any single positive test; a checker that returned LOSSY for everything would pass any single negative test. Only the PAIR discriminates. The two fixtures differ in exactly one property -- layer count -- so the pair isolates the one axis under test. THE FIXTURES' SHAPE IS ASSERTED BEFORE ANY OUTCOME IS. The positive fixtures are read, not written, so their presence AND their layer counts (1 and 9) are proven at setup: a missing fixture, or one that is not actually multi-layer, would make T1/T3 report on something other than the property they name. A NAMED absence, never a silent skip. 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_roundtrip_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_msh sys_mmap ↻ rg_wr32 rg_name rg_tri rg_wr32 ↻ sys_openat_wr sys_write ↻ sys_close gv_check gv_puts ↻ rg_layers sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻

structs

none

consts

32const RG_SUBJECT_DEFAULT: *u8 = "/volume1/homes/elderwesto/nishihost/_offc/nx_roundtrip.elf"
35const RG_EXIT_IDENTICAL: i64 = 0
36const RG_EXIT_LOSSY: i64 = 1
37const RG_EXIT_UNOBSERVABLE: i64 = 3
38const RG_EXEC_NOT_FOUND: i64 = 127
41const RG_NLAY_OFF: i64 = 8
42const RG_NTRI_OFF: i64 = 12
43const RG_HDR_BASE: i64 = 16
44const RG_LAYER_STRIDE: i64 = 24
45const RG_LAYER_NAME_LEN: i64 = 16
46const RG_LAYER_OFF_FLD: i64 = 16
47const RG_LAYER_CNT_FLD: i64 = 20
48const RG_TRI_STRIDE: i64 = 84
49const RG_MAGIC_LEN: i64 = 6 // "NXMSH2"
50const RG_U32_BYTES: i64 = 4
51const RG_BYTE_RADIX: i64 = 256
52const RG_BYTE_MASK: i64 = 255
53const RG_COORDS: i64 = 3
54const RG_VERTS_PER_TRI: i64 = 3
55const RG_VERT_BYTES: i64 = 12 // x,y,z as three float32
56const RG_NRM_OFF: i64 = 36 // normal block begins after the three positions
57const RG_NRM_Z: i64 = 8 // z within a normal triple
73const RG_F32_ZERO: i64 = 0
74const RG_F32_1000MM: i64 = 1148846080 // 1000.0f
75const RG_F32_1800MM: i64 = 1155596288 // 1800.0f -- a human-scale height, in band, scale factor 1
77const RG_TRIS_GOOD: i64 = 2 // one layer, two non-degenerate triangles
78const RG_TRIS_PARTS: i64 = 3 // three layers, one triangle each -- the segmentation case
79const RG_LAYERS_ONE: i64 = 1
80const RG_LAYERS_THREE: i64 = 3
83const RG_TRIS_DECLARED_BUT_ABSENT: i64 = 100
85const RG_CAPTURE_CAP: i64 = 262144
86const RG_PATH_CAP: i64 = 4096
87const RG_ARGV_SLOTS: i64 = 8
88const RG_MODE_DIR: i64 = 493 // 0755
89const RG_WORD: i64 = 8
101const RG_DIR: *u8 = "/tmp/nx_roundtrip_gate"
102const RG_GOOD: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/rtfixture_1layer.nxmesh"
103const RG_PARTS: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/rtfixture_9layer.nxmesh"
104const RG_GOOD_LAYERS: i64 = 1
105const RG_PARTS_LAYERS: i64 = 9
106const RG_TRUNC: *u8 = "/tmp/nx_roundtrip_gate/trunc.nxmesh"
107const RG_ABSENT: *u8 = "/tmp/nx_roundtrip_gate/no_such_input.nxmesh"
108const RG_MID: *u8 = "/tmp/nx_roundtrip_gate/rt_mid.glb"
109const RG_BACK: *u8 = "/tmp/nx_roundtrip_gate/rt_back.nxmesh"

functions

111func rg_wr32(b: *u8, off: i64, v: i64) -> i64
called by 2: rg_trirg_write_msh
122func rg_name(b: *u8, off: i64, s: *u8) -> i64
called by 1: rg_write_msh
136func rg_tri(b: *u8, off: i64, which: i64) -> i64
called by 1: rg_write_msh calls 1: rg_wr32
163func rg_write_msh(path: *u8, nlay: i64, ntri: i64, declared_tris: i64) -> i64
203func rg_run(subject: *u8, inp: *u8, dir: *u8, out: *u8, olen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
214func rg_layers(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
221func rg_size(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
228func main(argc: i64, argv: *i64) -> i64