code wiki / _hdl_build / nx_gltf2mesh_units_gate.nx
nx_gltf2mesh_units_gate.nx
buildroot/runtime/_hdl_build/nx_gltf2mesh_units_gate.nx
about
nx_gltf2mesh_units_gate.nx -- THE GATE FOR UNIT DETERMINATION IN THE glTF INGEST.
WHAT IT GUARDS. nx_gltf2mesh used to carry a hardcoded 500-2500mm window and refuse anything
outside it. That window was ANTHROPOMETRY -- "the subject is a HUMAN between 0.5 and 2.5 metres"
-- welded into a FORMAT CONVERTER. Measured 2026-08-22 over the full 18-file GLB population
(corpus_complete=1) it refused 2 of 18 assets, both a legitimate 2.615 m character, for being
115 mm too tall. glTF 2.0 fixes the unit of length as the METRE, so a conformant donor needs no
guessing at all; the sniffing exists only for donors authored in another power of 1000.
THE SUBJECT IS FORKED FOR REAL. The organ's contract is its EXIT CODE (0 convert, 8 refuse-units,
2 usage) and /api/gate_run derives verdicts from exit codes, so every tooth here asserts an exit
code. Output markers are checked only where the exit code alone cannot distinguish two states.
THE NEGATIVE CONTROL IS LOAD-BEARING AND IT IS T4. A guard that ACCEPTS EVERYTHING passes every
accept-test, so proving "the 2.615 m human now converts" is only half a proof. T4 forces the
refusal branch by pointing the organ at a /tmp conf whose floor no scale can clear, and gv_bite
judges T1 and T4 together: it must fire on the bad input AND stay silent on the good one.
FIXTURES ARE /tmp ONLY. The organ's units_conf= override exists precisely so this gate never
edits the production conf -- a gate that shares a fixture with a production beat reports on the
fixture rather than on the code, which is how a RED can track scratch state instead of a defect.
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
| 28 | const UG_SUBJECT_DEFAULT: *u8 = "_offc/nx_gltf2mesh.elf" |
| 31 | const UG_EXIT_OK: i64 = 0 |
| 32 | const UG_EXIT_REFUSE_UNIT: i64 = 8 |
| 37 | const UG_HUMAN: *u8 = "/volume1/homes/elderwesto/nishihost/sites/nishifamily/synth/human.glb" |
| 38 | const UG_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/sites/nishifamily/synth/elf.glb" |
| 40 | const UG_DIR: *u8 = "/tmp/nx_gltf2mesh_units_gate" |
| 41 | const UG_CONF_REAL: *u8 = "/tmp/nx_gltf2mesh_units_gate/real.conf" |
| 42 | const UG_CONF_ABSURD:*u8 = "/tmp/nx_gltf2mesh_units_gate/absurd.conf" |
| 43 | const UG_CONF_NONE: *u8 = "/tmp/nx_gltf2mesh_units_gate/no_such_conf_at_all" |
| 44 | const UG_OUT_HUMAN: *u8 = "/tmp/nx_gltf2mesh_units_gate/human.nxmesh" |
| 45 | const UG_OUT_ELF: *u8 = "/tmp/nx_gltf2mesh_units_gate/elf.nxmesh" |
| 46 | const UG_OUT_NEG: *u8 = "/tmp/nx_gltf2mesh_units_gate/neg.nxmesh" |
| 47 | const UG_OUT_DFLT: *u8 = "/tmp/nx_gltf2mesh_units_gate/dflt.nxmesh" |
| 48 | const UG_BADMAGIC: *u8 = "/tmp/nx_gltf2mesh_units_gate/not_a_glb.bin" |
| 49 | const UG_OUT_BAD: *u8 = "/tmp/nx_gltf2mesh_units_gate/bad.nxmesh" |
| 51 | const UG_ARG_REAL: *u8 = "units_conf=/tmp/nx_gltf2mesh_units_gate/real.conf" |
| 52 | const UG_ARG_ABSURD: *u8 = "units_conf=/tmp/nx_gltf2mesh_units_gate/absurd.conf" |
| 53 | const UG_ARG_NONE: *u8 = "units_conf=/tmp/nx_gltf2mesh_units_gate/no_such_conf_at_all" |
| 59 | const UG_CONF_REAL_TXT: *u8 = "sliver_floor_mm=100\n" |
| 60 | const UG_CONF_ABSURD_TXT: *u8 = "sliver_floor_mm=100000000\n" |
| 61 | const UG_BADMAGIC_TXT: *u8 = "this is definitely not a binary glTF container\n" |
| 63 | const UG_CAPTURE_CAP: i64 = 262144 |
| 64 | const UG_ARGV_SLOTS: i64 = 8 |
| 65 | const UG_MODE_DIR: i64 = 493 // 0755 |
| 66 | const UG_WORD: i64 = 8 |
| 67 | const UG_MIN_MESH_BYTES: i64 = 1000 // a real conversion of a 2530-vertex donor is >100 kB; |
functions
| 70 | func ug_write_text(path: *u8, s: *u8) -> i64 |
| 81 | func ug_size(path: *u8) -> i64 |
| 87 | func ug_unlink(path: *u8) -> i64 { return sys_unlinkat(path) } |
| 90 | func ug_has(buf: *u8, n: i64, lit: *u8) -> i64 called by 1: main |
| 106 | func ug_run(subject: *u8, a1: *u8, a2: *u8, a3: *u8, out: *u8, olen: *i64) -> i64 |
| 116 | func main(argc: i64, argv: *i64) -> i64 |