code wiki / (root) / nx_organ_ship.nx

nx_organ_ship.nx

buildroot/runtime/nx_organ_ship.nx

69333 B955 linesdepth 6pulls 9 transitivereach 1 importersview sourcekind tooltopic organ
docsdependenciesstructsconstsfunctions

about

nx_organ_ship.nx -- THE SHIP LOOP AS ONE ORGAN (operator 2026-08-18: "i want all of our workflows mined and built and developed and tested and deployed etc i dont want all this grep and shell and ps1 and other bullshit you have been doing except as fallbacks"). This session hand-pecked the ws-cycle phases WORK->PROVE->EXPOSE->PUBLISH->VERIFY-LIVE ~40 times: build, run gate, contentdiff, behaveprobe, promote with expect_sha256, read the artifact back, register, verify. Every step exists as an organ; nothing ran them as ONE loop with the refusals in the right order. This does, in the nx_dr_chain shape: one call, whole loop, every stage's evidence printed, REFUSE at the first RED with the unblock named. STAGES (each composes the incumbent, never re-implements; each announces its evidence line): 1 BUILD /api/build target=X via nx_mgmt_call (the never-brick lane; the response's src_path MUST name X -- the banked wrong-target compile is caught here -- and its sha256 is captured). REFUSE if src_path is not X (exit 11) or the API refused (exit 12; the API's own reason is printed: magic-ratchet, admit-gate, etc). 2 PROVE RESOLVE the gate that proves X (nx_organ_ship_lib), then RUN it; its EXIT CODE is the verdict (gv_verdict law). Resolution order: gate=<name> the caller declared -> a row in knowledge/organ_gate.conf -> the <X>_gate convention -> X ITSELF when X ends in _gate -> X minus its last underscore segment plus _gate. Each candidate is probed at the serving root (<n>.elf) and at buildroot/_build/ (<n>.sov.elf), and EVERY path probed is printed. FRESHNESS (2026-08-25): for the ONE candidate that is the target this run just built, buildroot/_build/ is probed FIRST -- it holds code from THIS build while the serving root holds the PREVIOUS promote, and an in-process gate compiles its subject IN, so promoted-first reported a tooth count from code the loop did not build. Measured in this loop's own journal: ONE build sha 2d9c5011..., PROVE RED from ./nx_uvunwrap_gate.elf and PROVE GREEN from the artifact just built, consecutive rows. It fails in the FLATTERING direction too -- nx_editstack_gate and nx_domain_map_gate each went GREEN against the promoted copy moments after a build. Every PROVE line, its journal row and the last line now carry artifact=<which one produced this verdict>. REFUSE on a nonzero gate exit (21) with the gate's tail. REFUSE (22) when the caller DECLARED a gate that does not exist -- a caller error, never the ordinary no-gate case. Nothing resolved is announced NO-GATE-FOUND with its full search transcript, journalled, and carried into the final line as prove=NO-GATE-FOUND UNPROVEN: a NAMED loud absence. (Before 2026-08-20 this searched ONE name and silently continued on a miss, so shipping nx_gate_roster_run -- gate nx_gate_roster_gate -- proved nothing and still said SHIPPED.) EVERY DECLARED ROW RUNS (2026-08-23): when organ_gate.conf carries several rows for X (the compiler: one gate per language rung) each further row is resolved at the same two roots and RUN after the first; a declared row with no artifact REFUSES (22) and a RED refuses (21). The last line prints gates_proven=N of_declared=M so a partial proof can never read as a whole one. (Until today only the first row ran and the conf delegated the rest to "the lane's checklist" -- a law that has to be remembered gets skipped.) 2a VINTAGE WHOSE TREE DID THAT VERDICT DESCRIBE? (2026-08-25, part 2). The freshness swap above fixed

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_tool_run.nx nx_organ_ship_lib.nx nx_build_firsttry_lib.nx nx_organ_ship.nx nx_organ_ship_loss_canonical_integ

imports: nx_syscalls.nxnx_tool_run.nxnx_organ_ship_lib.nxnx_build_firsttry_lib.nx

imported by: nx_organ_ship_loss_canonical_integration_gate_t370.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main os_puts sys_write os_slen os_streq ce_build_firsttry bft_atoi bft_report 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 ↻ bft_measure sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close bft_compute sys_mmap ↻ bft_slen bft_span_atoi bft_span_eq_span bft_span_eq bft_slen ↻ bft_span_starts

structs

none

consts

81const OS_CAP: i64 = 262144
82const OS_TIMEOUT_MS: i64 = 900000 // a build under admit backoff can legitimately wait minutes
85const OS_MGMT_CALL: *u8 = "./nx_mgmt_call.elf"
86const OS_LINE_CAP: i64 = 2048 // one journal line: epoch+target+stage+verdict+detail(a sha or a path)
87const OS_SMALL_CAP: i64 = 4096 // captured stdout of a one-line receipt fork (filehash/offc_install)
94const OS_GATE_DIR_A: *u8 = "./"
95const OS_GATE_SUF_A: *u8 = ".elf"
96const OS_GATE_DIR_B: *u8 = "./buildroot/_build/"
97const OS_GATE_SUF_B: *u8 = ".sov.elf"
100const OS_EXIT_NO_GATE_NAMED: i64 = 22
106const OS_PROVCHECK: *u8 = "./nx_provcheck.elf"
111const OS_PROV_INNER_TMO_MS: i64 = 90000
207const OS_JRNL: *u8 = "knowledge/status/organ_ship.jrnl"
208const OS_MODE_JRNL: i64 = 420
214const OS_REFUSAL_HEAD: i64 = 160
215const OS_CTRL_MAX: i64 = 31
216const OS_SPACE: i64 = 32
357const OS_DOCSTAGE_ELF: *u8 = "./nx_docstage.elf"
358const OS_DOC_RC_DOC: i64 = 0
359const OS_DOC_RC_UNDOC: i64 = 1

functions

114func os_prov_timeout_ms() -> i64 { return OS_PROV_INNER_TMO_MS + OS_PROV_INNER_TMO_MS / 3 }
called by 1: os_gate_freshen
116func os_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
117func os_puts(s: *u8) -> i64 { sys_write(1, s, os_slen(s)); return 0 }
118func os_pn(v: i64) -> i64
130func os_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var oo: i64 = o; while s[i] != (0 as u8) { d[oo] = s[i]; oo = oo + 1; i = i + 1 } d[oo] = 0 as u8; return oo }
132func os_catn(d: *u8, o: i64, v: i64) -> i64
called by 2: os_gate_freshenmain calls 1: sys_mmap
144func os_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 }
145func os_starts(s: *u8, p: *u8) -> i64 { var i: i64 = 0; while p[i] != (0 as u8) { if s[i] != p[i] { return 0 } i = i + 1 } return 1 }
called by 1: main
146func os_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
155func os_prov(gate: *u8, target: *u8) -> *u8
167func os_find(hay: *u8, hlen: i64, needle: *u8) -> i64
174func os_json_str(hay: *u8, hlen: i64, key: *u8, dst: *u8, dcap: i64) -> i64
186func os_int_after(hay: *u8, hlen: i64, needle: *u8) -> i64
called by 1: main calls 2: os_findos_slen
195func os_tail(buf: *u8, n: i64, lines: i64) -> i64
217func os_bytes_of(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } let s: i64 = sys_lseek(fd, 0, 2); sys_close(fd); return s }
218func os_build_refusal_class(body: *u8, n: i64) -> *u8
called by 1: main calls 1: os_find
227func os_refusal_head(body: *u8, n: i64, out: *u8) -> i64
called by 1: main
236func ce_build_firsttry(argc: i64, argv: *i64) -> i64
244func os_jrnl(target: *u8, stage: *u8, verdict: *u8, detail: *u8) -> i64
268func os_ncat(d: *u8, o: i64, v: i64) -> i64
called by 2: os_loss_journalmain calls 1: sys_mmap
285func os_jrnl_losses(target: *u8, buf: *u8, n: i64) -> i64
316func os_mgmt(method: *u8, path: *u8, body: *u8, out: *u8, olen: *i64) -> i64
326func os_sha_of(path: *u8, dst: *u8) -> i64
360func os_doc_stage(target: *u8) -> i64
386func os_src_names(hay: *u8, hlen: i64, name: *u8) -> i64
418func os_gate_freshen(gname: *u8, target: *u8, gpath: *u8) -> i64
559func os_harness_manifest(outpath: *u8, src_sha: *u8, gatepath: *u8, timeout_ms: i64, allow_loss: i64, extra: *u8, tok: *u8) -> i64 { return osl_harness_manifest(outpath, src_sha, gatepath, timeout_ms, allow_loss, extra, tok) }
called by 1: main
563func os_loss_refused(reason:*u8)->i64{os_puts("{\"schema\":\"nishi-ship-loss-approval/1\",\"state\":\"needs-intervention\",\"reason\":\"");os_puts(reason);os_puts("\"}\n");return 31}
564func os_loss_exact_inner(target:*u8,live:*u8,stage_sha:*u8,approval:*u8,scratch:*u8)->i64
601func os_loss_exact(target:*u8,live:*u8,stage_sha:*u8,approval:*u8)->i64
610func os_loss_journal(target:*u8,detail:*u8)->i64
624func main(argc: i64, argv: *i64) -> i64