code wiki / _hdl_build / nx_atomic_publish_gate.nx
nx_atomic_publish_gate.nx
buildroot/runtime/_hdl_build/nx_atomic_publish_gate.nx
about
nx_atomic_publish_gate.nx -- END-TO-END gate for `nx_atomic_publish landed` (ap_landed, DM4).
THE CORPUS IS THE ESTATE'S OWN RECORD. Every REAL row below reproduces an ambiguous write from
2026-08-15 to 2026-08-20 whose landed-or-not was settled BY HAND at the time, mined out of the lane
memories and CLAUDE.md; the hand answer travels beside it as ground truth. Three rows are labelled
CONSTRUCTED and counted separately: two are grammar guards, and one is the double-insert the CAS guard
AVERTED on 2026-08-20 -- the record describes the outcome it prevented, so the artifact never existed
and claiming it as observed would be a fabrication.
THE BAR, pre-declared in devmgmt.plan: "emits LANDED or NOT per row matching the hand adjudication
with ZERO FALSE LANDED -- wrong only toward NOT". A false LANDED is a lost edit nobody re-applies; a
false NOT-LANDED costs one idempotent retry. false_landed is therefore counted as its own number and
asserted at zero, separately from the overall diff.
THE TWO CONTROLLED PAIRS ARE THE SHARPEST ROWS, and they come straight out of the record:
the SAME 503 reply over a write that HAD landed and three that had NOT, in the same hour;
the SAME bare empty-object reply over a write that had landed and one that had not.
An organ that consults the transport reply gets one of each pair wrong by construction.
The third discriminator is one ARTIFACT adjudicated twice: from a size-only row it must ABSTAIN, from
a content-hash row it must say LANDED. An organ answering from the file rather than from the declared
evidence cannot separate those two.
TEETH THE TRIVIAL WRONG IMPLEMENTATIONS CANNOT PASS, all in ONE run: an always-LANDED organ loses the
NOT-LANDED rows and trips the false-landed bar; an always-NOT-LANDED organ loses the LANDED rows; an
always-UNKNOWN organ -- the guard that refuses everything and thereby passes every negative test --
loses both and cannot reach DECIDED-ALL.
Fixtures are assembled at RUNTIME under /tmp/nx_ap_landed_gate/<epoch>/ -- never beside a production
beat. Idempotent: the epoch-suffixed directory means a second run cannot inherit the first run's state.
usage: nx_atomic_publish_gate [subject-elf]
SUBJECT RESOLUTION, announced on every run because the answer depends on it: argv[1] if given, else
the freshly BUILT candidate buildroot/_build/nx_atomic_publish.sov.elf, else the deployed twin
_offc/nx_atomic_publish.elf, else the serving root, else SKIP. The build-first order is what makes
this gate usable as nx_organ_ship's PROVE stage, which runs seconds after /api/build and is asking
about the CANDIDATE. ★A GATE THAT DOES NOT SAY WHICH COPY IT JUDGED CAN BE READ AS A VERDICT ABOUT
THE WRONG BINARY -- so the resolved path AND its byte count are printed before any tooth runs.
Sovereign: imports nx_gatekit_lib + nx_gate_verdict. license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_gatekit_lib.nxnx_gate_verdict.nxnx_sha256.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
| 43 | const APG_NAME: *u8 = "ATOMIC-PUBLISH-GATE" |
| 44 | const APG_BUILT_ELF: *u8 = "buildroot/_build/nx_atomic_publish.sov.elf" |
| 45 | const APG_OFFC_ELF: *u8 = "_offc/nx_atomic_publish.elf" |
| 46 | const APG_ROOT_ELF: *u8 = "./nx_atomic_publish.elf" |
| 47 | const APG_ROOT: *u8 = "/tmp/nx_atomic_publish_gate" |
| 48 | const APG_CAP: i64 = 262144 |
| 49 | const APG_WLCAP: i64 = 65536 |
| 50 | const APG_PATHCAP: i64 = 1024 |
| 51 | const APG_TAB: i64 = 9 |
| 52 | const APG_NL: i64 = 10 |
| 53 | const APG_SPACE: i64 = 32 |
| 54 | const APG_D0: i64 = 48 // ASCII '0' |
| 55 | const APG_D9: i64 = 57 |
| 56 | const APG_DEC_BASE: i64 = 10 |
| 57 | const APG_MAXCASE: i64 = 64 |
| 58 | const APG_PTRW: i64 = 8 |
| 59 | const APG_HEX: i64 = 80 |
| 60 | const APG_REAL: i64 = 1 |
| 61 | const APG_CONSTRUCTED: i64 = 0 |
| 66 | const APG_RACE_DIVISOR: i64 = 2 |
| 67 | const APG_RACE_FLOOR_MS: i64 = 100 |
functions
| 69 | func apg_eq(a: i64, b: i64) -> i64 { if a == b { return 1 } return 0 } called by 1: main |
| 70 | func apg_gt(a: i64, b: i64) -> i64 { if a > b { return 1 } return 0 } |
| 71 | func apg_zero(a: i64) -> i64 { if a == 0 { return 1 } return 0 } called by 1: main |
| 73 | func apg_hex(dig: *u8, out: *u8) -> i64 |
| 86 | func apg_hash_text(t: *u8, out: *u8) -> i64 |
| 96 | func apg_hash_file(path: *u8, out: *u8) -> i64 |
| 106 | func apg_tab(b: *u8, o: i64) -> i64 { b[o] = APG_TAB as u8; return o + 1 } called by 1: main |
| 111 | func apg_verdict_of(buf: *u8, n: i64, id: *u8, out: *u8) -> i64 |
| 135 | func apg_int_after(buf: *u8, n: i64, key: *u8) -> i64 |
| 154 | func apg_push(ids: *i64, hands: *i64, real: *i64, n: *i64, id: *u8, hand: *u8, isreal: i64) -> i64 |
| 162 | func main(argc: i64, argv: *i64) -> i64 |