nx_roundtrip_gate.nx
buildroot/runtime/nx_roundtrip_gate.nx
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
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
| 32 | const RG_SUBJECT_DEFAULT: *u8 = "/volume1/homes/elderwesto/nishihost/_offc/nx_roundtrip.elf" |
| 35 | const RG_EXIT_IDENTICAL: i64 = 0 |
| 36 | const RG_EXIT_LOSSY: i64 = 1 |
| 37 | const RG_EXIT_UNOBSERVABLE: i64 = 3 |
| 38 | const RG_EXEC_NOT_FOUND: i64 = 127 |
| 41 | const RG_NLAY_OFF: i64 = 8 |
| 42 | const RG_NTRI_OFF: i64 = 12 |
| 43 | const RG_HDR_BASE: i64 = 16 |
| 44 | const RG_LAYER_STRIDE: i64 = 24 |
| 45 | const RG_LAYER_NAME_LEN: i64 = 16 |
| 46 | const RG_LAYER_OFF_FLD: i64 = 16 |
| 47 | const RG_LAYER_CNT_FLD: i64 = 20 |
| 48 | const RG_TRI_STRIDE: i64 = 84 |
| 49 | const RG_MAGIC_LEN: i64 = 6 // "NXMSH2" |
| 50 | const RG_U32_BYTES: i64 = 4 |
| 51 | const RG_BYTE_RADIX: i64 = 256 |
| 52 | const RG_BYTE_MASK: i64 = 255 |
| 53 | const RG_COORDS: i64 = 3 |
| 54 | const RG_VERTS_PER_TRI: i64 = 3 |
| 55 | const RG_VERT_BYTES: i64 = 12 // x,y,z as three float32 |
| 56 | const RG_NRM_OFF: i64 = 36 // normal block begins after the three positions |
| 57 | const RG_NRM_Z: i64 = 8 // z within a normal triple |
| 73 | const RG_F32_ZERO: i64 = 0 |
| 74 | const RG_F32_1000MM: i64 = 1148846080 // 1000.0f |
| 75 | const RG_F32_1800MM: i64 = 1155596288 // 1800.0f -- a human-scale height, in band, scale factor 1 |
| 77 | const RG_TRIS_GOOD: i64 = 2 // one layer, two non-degenerate triangles |
| 78 | const RG_TRIS_PARTS: i64 = 3 // three layers, one triangle each -- the segmentation case |
| 79 | const RG_LAYERS_ONE: i64 = 1 |
| 80 | const RG_LAYERS_THREE: i64 = 3 |
| 83 | const RG_TRIS_DECLARED_BUT_ABSENT: i64 = 100 |
| 85 | const RG_CAPTURE_CAP: i64 = 262144 |
| 86 | const RG_PATH_CAP: i64 = 4096 |
| 87 | const RG_ARGV_SLOTS: i64 = 8 |
| 88 | const RG_MODE_DIR: i64 = 493 // 0755 |
| 89 | const RG_WORD: i64 = 8 |
| 101 | const RG_DIR: *u8 = "/tmp/nx_roundtrip_gate" |
| 102 | const RG_GOOD: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/rtfixture_1layer.nxmesh" |
| 103 | const RG_PARTS: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/rtfixture_9layer.nxmesh" |
| 104 | const RG_GOOD_LAYERS: i64 = 1 |
| 105 | const RG_PARTS_LAYERS: i64 = 9 |
| 106 | const RG_TRUNC: *u8 = "/tmp/nx_roundtrip_gate/trunc.nxmesh" |
| 107 | const RG_ABSENT: *u8 = "/tmp/nx_roundtrip_gate/no_such_input.nxmesh" |
| 108 | const RG_MID: *u8 = "/tmp/nx_roundtrip_gate/rt_mid.glb" |
| 109 | const RG_BACK: *u8 = "/tmp/nx_roundtrip_gate/rt_back.nxmesh" |
functions
| 111 | func rg_wr32(b: *u8, off: i64, v: i64) -> i64 |
| 122 | func rg_name(b: *u8, off: i64, s: *u8) -> i64 called by 1: rg_write_msh |
| 136 | func rg_tri(b: *u8, off: i64, which: i64) -> i64 |
| 163 | func rg_write_msh(path: *u8, nlay: i64, ntri: i64, declared_tris: i64) -> i64 |
| 203 | func rg_run(subject: *u8, inp: *u8, dir: *u8, out: *u8, olen: *i64) -> i64 |
| 214 | func rg_layers(path: *u8) -> i64 |
| 221 | func rg_size(path: *u8) -> i64 |
| 228 | func main(argc: i64, argv: *i64) -> i64 |