code wiki / (root) / nx_adoptgate_typed_candidate_t310.nx

nx_adoptgate_typed_candidate_t310.nx

buildroot/runtime/nx_adoptgate_typed_candidate_t310.nx

9845 B199 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind tooltopic adoptgate
docsdependenciesstructsconstsfunctions

about

nx_adoptgate.nx -- THE ENFORCED GATE BETWEEN /api/build AND /api/promote (2026-08-07). WHY: the 4-step adoption recipe exists and is correct, and I ran it BY HAND and therefore ran it INCONSISTENTLY -- 35 organs promoted on step 2 alone because step 3 was something I had to remember. *A LAW I HAVE TO REMEMBER IS A LAW I WILL SKIP; PUT IT IN THE PATH.* This collapses steps 2 and 3 into ONE call that emits ONE machine-checkable token, so a promote can be gated on `APPROVED` instead of on my good intentions. IT DOES NOT BUILD AND IT DOES NOT PROMOTE, and that is deliberate: - build must go through /api/build because only that stages the artifact where /api/promote LOOKS (a direct nx_sov_build_run drops it in /tmp or _build -- provably the wrong place, and exactly the artifacts-never-placed-where-consumers-look defect this whole campaign is about). - promotion stays an explicit operator act. A gate that also performs the action it authorises cannot be re-run to audit its own decision. COMPOSES THE INCUMBENTS, never reimplements them (one duplicate ruler was already built and retracted this session): nx_contentdiff = NECESSARY half, nx_behaveprobe = SUFFICIENCY half. nx_adoptgate <target> [workload-args...] -> ADOPT-GATE <target> verdict=APPROVED|REFUSED reason=... content=... behave=... evidence=... exit 0 APPROVED | 1 REFUSED | 2 missing artifact | 3 usage license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_tool_run.nx nx_contentdiff.nx nx_adoptgate_typed_candidate_t

imports: nx_tool_run.nxnx_contentdiff.nx

imported by: nobody (leaf or entry point)

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

main age agcat agexists agp ag_content_paths cd_structured_paths_result sys_map_file sys_openat_rd sys_lseek sys_close cd_structured_error gv_puts sys_write gv_num sys_mmap nxa_die nxa_lock_take nxa_lock_give nxa_report_overrun sys_write ↻ sys_munmap sys_munmap_direct gv_puts ↻ cds_init sys_mmap_try sys_mmap_try ↻ cds_measure cds_elf nx_elf_get_u16_le nx_elf_get_u64_le nx_elf_get_u32_le cds_sectionless nx_elf_get_u64_le ↻ nx_elf_get_u16_le ↻ cds_span nx_elf_get_u32_le ↻ cds_span ↻ nx_elf_get_u32_le ↻ cdl_bytes_eq

structs

none

consts

26const AG_HOST: *u8 = "/volume1/homes/elderwesto/nishihost"
27const AG_CDIFF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_contentdiff.elf"
28const AG_BPROBE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_behaveprobe.elf"
29const AG_CAP: i64 = 262144
30const AG_TMO: i64 = 180000

functions

32func agp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
33func age(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(2,s,n); return 0 }
called by 1: main
34func agcat(d: *u8, o: i64, s: *u8) -> i64 { var x: i64=o; var i: i64=0; while s[i]!=(0 as u8){d[x]=s[i];x=x+1;i=i+1} return x }
called by 1: main
35func agexists(p: *u8) -> i64 { let fd: i64 = sys_openat_rd(p); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: main
40func agfind(buf: *u8, n: i64, ndl: *u8) -> i64
called by 1: main
66func agpos(buf: *u8, n: i64, ndl: *u8, from: i64) -> i64
81func agnum(v: i64) -> i64
called by 1: ag_content_paths calls 1: agp
94func agint_after(buf: *u8, n: i64, ndl: *u8) -> i64
calls 1: agpos
115func ag_echo_lines(buf: *u8, n: i64, ndl: *u8) -> i64
calls 2: agposagp
139func ag_content_paths(live:*u8,staged:*u8,target:*u8)->i64
156func main(argc: i64, argv: *i64) -> i64