nx_wat_refuse_gate.nx
buildroot/runtime/nx_wat_refuse_gate.nx
about
nx_wat_refuse_gate.nx -- THE REFEREE FOR LN13a: THE WAT LANE MUST REFUSE WHAT IT CANNOT LOWER.
WHAT THIS PROVES, AND WHY A GREEN HERE IS WORTH SOMETHING. Until 2026-09-04 the wat backend answered an
IR opcode it had no arm for with a WAT COMMENT and `return 0`, without storing a result local. The module
assembled, instantiated and RAN, silently computing zero at that instruction. Nothing in the build said a
word. That is the worst shape a compiler defect can take, and it is invisible to every instrument that
reads exit codes or artifact sizes -- the pre-fix compiler exits 0 and emits a perfectly well-formed
module. So the only referee that can see it is one that compiles a KNOWN-UNLOWERABLE construct and
demands a NAMED refusal.
THE SUBJECT IS A BINARY, NOT A SOURCE. argv[1] is the compiler under test, so this gate can be pointed at
a staged build before it is promoted (the nx_cc_equiv_gate / nx_langdiag_gate shape). It judges the
compiler by the BEHAVIOUR of what it emits, never by inspecting its assembly.
THE NEGATIVE CONTROLS ARE THE LOAD-BEARING HALF. A compiler that refused EVERY module would pass every
refusal tooth here and be catastrophically wrong; the estate has bite-proved exactly that class on
nx_langdiag_gate. So the direct-call control must still compile, still emit a module, and still NOT be
refused. Without those three, this gate scores a guard-that-refuses-everything at 100%.
FIXTURES ARE ASSEMBLED AT RUNTIME into a per-RUN directory from gk_fixture_dir. Two reasons, both learned
the hard way: a gate that shares a production fixture tracks the FIXTURE and not the code, and two
concurrent runs of a gate with a hardcoded /tmp path return false SKIPs. The old silent marker is built
from two halves at runtime for a third reason -- written whole it would be a source literal, and a
detector that scans sources finds its own fixture.
license_tier: ORIGINAL. Forks the subject compiler, writes only under its own per-run /tmp dir. No hw
writes (Rule 26).
dependencies 4 imports · 3 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_gatekit_lib.nxnx_tool_run.nx
imported by: nx_compiler_bounds_cli_gate.nxnx_wat_data_artifact_gate.nxnx_wat_type_layout_gate.nx
structs
| none |
consts
| 34 | const WR_CAP: i64 = 262144 |
| 35 | const WR_PATH: i64 = 4096 |
| 36 | const WR_SPAN: i64 = 8 |
| 37 | const WR_ARGV_SLOTS: i64 = 4 |
| 38 | const WR_MARKER_CAP: i64 = 64 |
| 41 | const WR_OPCODE_CALL_INDIRECT: i64 = 144 |
| 42 | const WR_SUBJECT_DEFAULT: *u8 = "_build/nx_compile_wat.sov.elf" |
| 43 | const WR_EXIT_REFUSE: i64 = 3 |
functions
| 48 | func wr_run(subject: *u8, src: *u8, buf: *u8, ln: *i64) -> i64 |
| 61 | func main(argc: i64, argv: **u8) -> i64 |