code wiki / (root) / nx_organ_ship_review_lib_candidate_t371.nx

nx_organ_ship_review_lib_candidate_t371.nx

buildroot/runtime/nx_organ_ship_review_lib_candidate_t371.nx

65383 B1102 linesdepth 6pulls 10 transitivereach 5 importersview sourcekind librarytopic organ
docsdependenciesstructsconstsfunctions

about

nx_organ_ship_lib.nx -- WHICH GATE PROVES THIS TARGET? The resolver the ship loop was missing. WHY (measured 2026-08-20). nx_organ_ship's PROVE stage looked for exactly ONE name, "<target>_gate", and when that artifact did not exist it announced GATE=NONE and carried on. Shipping nx_gate_roster_run therefore SKIPPED THE PROOF STAGE ENTIRELY -- its gate is nx_gate_roster_gate -- and the loop reported SHIPPED having proven nothing about the binary it installed. A SHIP LOOP THAT SILENTLY SKIPS ITS PROOF STAGE WHEN A NAME DOES NOT MATCH IS THE VACUOUS-TEST DEFECT IN THE ONE ORGAN EVERY OTHER SHIP DEPENDS ON. THE REMEDY IS NOT A RENAME. Renaming a gate to satisfy a classifier is dodging by luck; the estate settled that question once already for a sibling classifier (organ_kind.conf: "renaming a third time would be dodging classifiers by luck"). So: RESOLVE the gate, and PUBLISH THE SEARCH. Every candidate path probed is appended to `tried` in the order probed, so a miss can NAME what it looked for instead of being a silent skip, and a hit can NAME the rule that found it. RESOLUTION ORDER -- declaration first, derivation second (rule 17): 1 explicit the caller passed gate=<name>. A caller ASSERTION: if it is absent the loop REFUSES, because a declared gate that is not there is a caller error, not a missing gate. 2 conf row knowledge/organ_gate.conf, "<target> TAB <gatename>". The declaration path: a target whose gate cannot be derived from its name gets a ROW, never a rename. 3 convention <target>_gate -- what the estate mostly does. 4 self the target ITSELF when it ends in _gate. Shipping a gate used to skip PROVE for the same reason (nx_foo_gate_gate does not exist); a gate proves itself by running. 5 strip1 <target minus its LAST underscore segment>_gate. This is the measured shape: nx_gate_roster_run -> nx_gate_roster_gate. EXACTLY ONE segment, deliberately. Each further strip walks toward a DIFFERENT organ's gate, and A GATE WHOSE SUBJECT IS NOT THE TARGET PROVES NOTHING ABOUT THE TARGET -- a resolver that reached far enough would manufacture a FALSE proof, which is strictly worse than the silent skip it replaces. ROOT ORDER -- WHICH COPY OF THE RESOLVED GATE RUNS (added 2026-08-25). Each candidate is probed at two roots: the promoted serving root and the build scratch. Promoted-first is right for a gate that is a DIFFERENT organ from the target, because this invocation did not build it. It is WRONG for the one candidate that IS the target just built, and for an in-process gate -- whose subject is compiled INTO the gate -- that means reporting a tooth count from code the loop did not build. `fresh` names the target so osl_try_fresh can flip the order for that candidate alone; osl_root_of reports which root any resolved path came from, so the number always travels with its provenance. WHY A LIB AND NOT A FUNCTION INSIDE THE LOOP: nx_organ_ship's main() BUILDS before it proves, so a gate that drove main() would fork real compiles. The roots are PARAMETERS here (dir + suffix pairs)

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_tool_run.nx nx_sha256.nx nx_behaveprobe_review_candidate_t3 nx_organ_ship_review_lib_candi nx_organ_ship_review_candidate_t37 nx_ship_behavior_loss_regression_t nx_ship_behavior_review_gate_t371.

imports: nx_syscalls.nxnx_tool_run.nxnx_sha256.nxnx_behaveprobe_review_candidate_t371.nx

imported by: nx_organ_ship_review_candidate_t371.nxnx_ship_behavior_loss_regression_t371.nxnx_ship_behavior_review_gate_t371.nx

structs

920struct OslLossSet { count:i64,record:NxBufOwned,digest:*u8 }
1015struct ObrWriter { out:*NxBufOwned,number:*u8,error:i64 }

consts

46const OSL_NAMECAP: i64 = 256
47const OSL_PATHCAP: i64 = 512
48const OSL_TAB: i64 = 9
49const OSL_SP: i64 = 32
50const OSL_NL: i64 = 10
51const OSL_CR: i64 = 13
52const OSL_SEMI: i64 = 59
53const OSL_HASH: i64 = 35
54const OSL_US: i64 = 95
56const OSL_WHY_NONE: i64 = 0
57const OSL_WHY_EXPLICIT: i64 = 1
58const OSL_WHY_CONF: i64 = 2
59const OSL_WHY_CONVENTION: i64 = 3
60const OSL_WHY_SELF: i64 = 4
61const OSL_WHY_STRIP1: i64 = 5
62const OSL_GATE_SUFFIX: *u8 = "_gate"
63const OSL_CONF_DEFAULT: *u8 = "knowledge/organ_gate.conf"
66const OSL_ROOT_NONE: i64 = 0
67const OSL_ROOT_A: i64 = 1
68const OSL_ROOT_B: i64 = 2
386const OSL_SRC_SUF: *u8 = ".nx"
387const OSL_LIB_SUFFIX: *u8 = "_lib"
388const OSL_KW_IMPORT: *u8 = "import"
389const OSL_CMT: *u8 = "//"
390const OSL_QUOTE: i64 = 34
392const OSL_SRC_DIR_HDL: *u8 = "./buildroot/runtime/_hdl_build/"
393const OSL_SRC_DIR_RT: *u8 = "./buildroot/runtime/"
398const OSL_CLO_UNPROVEN: i64 = 0
399const OSL_CLO_INDEPENDENT: i64 = 1
400const OSL_CLO_CONTAINS: i64 = 2
405const OSL_VINT_UNKNOWN: i64 = 0
406const OSL_VINT_STAGE1: i64 = 1
407const OSL_VINT_REBUILT: i64 = 2
408const OSL_VINT_INDEPENDENT: i64 = 3
409const OSL_VINT_STALE_REFUSED: i64 = 4
410const OSL_VINT_STALE_NOARTIFACT: i64 = 5
411const OSL_VINT_UNKNOWN_NOSRC: i64 = 6
412const OSL_VINT_UNKNOWN_NONAME: i64 = 7
413const OSL_VINT_STALE_WRONGSRC: i64 = 8
459const OSL_PROV_UNPROVEN: i64 = 0
460const OSL_PROV_CURRENT: i64 = 1
461const OSL_PROV_DRIFTED: i64 = 2
466const OSL_PC_EXIT_CURRENT: i64 = 0
467const OSL_PC_EXIT_DRIFTED: i64 = 1
472const OSL_VINT_PROV_CURRENT: i64 = 9
473const OSL_VINT_REBUILT_PROV: i64 = 10
474const OSL_VINT_STALE_PROV: i64 = 11
765const OSL_PICK_KEEP: i64 = 0 // run what the resolver picked: root B already, or root A byte-identical to the banked artifact
766const OSL_PICK_SWITCH_B: i64 = 1 // root A differs from the banked root B: run root B, and say root A is BEHIND its own source
767const OSL_PICK_UNPROVEN: i64 = 2 // the bank cannot be matched to anything executable (root B absent -- a refused build eats the fossil and leaves the sidecar -- or a digest unreadable): UNPROVEN, never CURRENT
804const OSL_HM_BUF: i64 = 16384
805const OSL_HM_MODE: i64 = 420
809const OSL_FNV_OFFSET: i64 = 0 - 3750763034362895579
810const OSL_FNV_PRIME: i64 = 1099511628211
811const OSL_HM_HEX: i64 = 16
812const OSL_HM_HEX_A: i64 = 87
813const OSL_HM_ZERO: i64 = 48

functions

70func osl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
71func osl_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 }
72func osl_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 }
called by 1: osl_try_fresh
76func osl_catb(d: *u8, o: i64, cap: i64, s: *u8) -> i64
called by 1: osl_probe1
85func osl_tried_cap() -> i64 { return 10 * (OSL_PATHCAP + 1) }
87func osl_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: osl_root_of
94func osl_root_of(path: *u8, dirA: *u8, dirB: *u8) -> i64
106func osl_root_name(r: i64) -> *u8
112func osl_ends_gate(s: *u8) -> i64
called by 1: osl_gate_resolve_fresh calls 1: osl_slen
122func osl_strip1(target: *u8, dst: *u8) -> i64
147func osl_conf_scan(conf: *u8, target: *u8, idx: i64, dst: *u8, countp: *i64) -> i64
216func osl_conf_gate(conf: *u8, target: *u8, dst: *u8) -> i64
222func osl_conf_gate_nth(conf: *u8, target: *u8, idx: i64, dst: *u8) -> i64
called by 1: os_ship_main calls 2: sys_mmaposl_conf_scan
228func osl_conf_gate_count(conf: *u8, target: *u8) -> i64
called by 1: os_ship_main calls 2: sys_mmaposl_conf_scan
239func osl_probe1(cand: *u8, dir: *u8, suf: *u8, tried: *u8, tcap: i64, tp: *i64, dst: *u8) -> i64
252func osl_try(cand: *u8, dirA: *u8, sufA: *u8, dirB: *u8, sufB: *u8, tried: *u8, tcap: i64, tp: *i64, dst: *u8) -> i64
called by 1: osl_try_fresh calls 1: osl_probe1
275func osl_try_fresh(cand: *u8, fresh: *u8, dirA: *u8, sufA: *u8, dirB: *u8, sufB: *u8, tried: *u8, tcap: i64, tp: *i64, dst: *u8) -> i64
291func osl_gate_resolve_fresh(target: *u8, explicit: *u8, fresh: *u8, conf: *u8, dirA: *u8, sufA: *u8, dirB: *u8, sufB: *u8, tried: *u8, tcap: i64, dst: *u8, why: *i64) -> i64
328func osl_gate_resolve(target: *u8, explicit: *u8, conf: *u8, dirA: *u8, sufA: *u8, dirB: *u8, sufB: *u8, tried: *u8, tcap: i64, dst: *u8, why: *i64) -> i64
332func osl_why_name(w: i64) -> *u8
called by 1: os_ship_main
478func osl_closure_tried_cap() -> i64 { return 2 * (OSL_PATHCAP + 1) }
485func osl_name_of(path: *u8, dirA: *u8, sufA: *u8, dirB: *u8, sufB: *u8, dst: *u8) -> i64
510func osl_eol(buf: *u8, n: i64, from: i64) -> i64
518func osl_qend(buf: *u8, end: i64, from: i64) -> i64
526func osl_skipws(buf: *u8, n: i64, from: i64) -> i64
542func osl_at(buf: *u8, end: i64, at: i64, s: *u8) -> i64
551func osl_line_imports(buf: *u8, ls: i64, le: i64, name: *u8, nl: i64) -> i64
581func osl_imports(buf: *u8, n: i64, name: *u8) -> i64
596func osl_closure_of_buf(buf: *u8, n: i64, target: *u8) -> i64
611func osl_gate_closure(gate: *u8, target: *u8, dirA: *u8, dirB: *u8, suf: *u8, tried: *u8, tcap: i64, srcdst: *u8, seenp: *i64) -> i64
647func osl_should_rebuild(gate: *u8, target: *u8, clo: i64) -> i64
657func osl_vint_current(v: i64) -> i64
669func osl_vint_name(v: i64) -> *u8
683func osl_closure_name(c: i64) -> *u8
699func osl_prov_of_exit(rc: i64) -> i64
704func osl_prov_name(p: i64) -> *u8
719func osl_should_rebuild_prov(gate: *u8, target: *u8, clo: i64, prov: i64) -> i64
733func osl_vint_norebuild(prov: i64, clo: i64) -> i64
743func osl_vint_rebuilt(prov: i64) -> i64
754func osl_vint_max() -> i64 { return OSL_VINT_STALE_PROV }
768func osl_pick_banked(resolved_root: i64, sha_a: *u8, sha_b: *u8, b_exists: i64) -> i64
776func osl_pick_name(p: i64) -> *u8
789func osl_should_rebuild_pick(gate: *u8, target: *u8, clo: i64, prov: i64, pick: i64) -> i64
815func osl_fnv64(h0: i64, buf: *u8, n: i64) -> i64
821func osl_fnv64_file(h0: i64, path: *u8) -> i64
827func osl_hm_hex(h: i64, out: *u8) -> i64
838func osl_hm_nl(d: *u8, o0: i64) -> i64
847func osl_hm_row(d: *u8, o0: i64, comp: *u8, path: *u8) -> i64
863func osl_hm_val(d: *u8, o0: i64, comp: *u8, v: i64) -> i64
887func osl_harness_manifest(outpath: *u8, target_src_sha: *u8, gatepath: *u8, timeout_ms: i64, allow_loss: i64, extra: *u8, tok: *u8) -> i64
921func osls_len(s:*u8)->i64{var n:i64=0;while s[n]!=(0 as u8){n=n+1};return n}
922func osls_eq(a:*u8,b:*u8,n:i64)->i64{var i:i64=0;while i<n{if a[i]!=b[i]{return 0};i=i+1};return 1}
923func osls_prefix(a:*u8,n:i64,s:*u8)->i64{let m:i64=osls_len(s);if n<m{return 0};return osls_eq(a,s,m)}
924func osls_hex(s:*u8)->i64{if (s as i64)<=0{return 0};if osls_len(s)!=64{return 0};var i:i64=0;while i<64{let c:i64=s[i] as i64;if c<48{return 0};if c>57{if c<97||c>102{return 0}};i=i+1};return 1}
926func osls_uint(s:*u8,n:i64)->i64{if n<=0{return -1};var v:i64=0;var i:i64=0;while i<n{let c:i64=s[i] as i64;if c<48||c>57{return -1};if v>(NX_BO_I64_MAX-(c-48))/10{return -1};v=v*10+c-48;i=i+1};return v}
927func osls_find(s:*u8,n:i64,key:*u8)->i64{let m:i64=osls_len(key);var i:i64=0;while i+m<=n{if osls_eq(s+i,key,m)==1{return i};i=i+1};return -1}
928func osls_token(s:*u8,n:i64,key:*u8,length:*i64)->i64
936func osls_field(s:*u8,n:i64,key:*u8)->i64
940func osls_report(buf:*u8,n:i64)->i64
958func osls_add(b:*NxBufOwned,s:*u8,n:i64)->i64{return nx_bo_append(b,s,n,0)}
959func osls_text(b:*NxBufOwned,s:*u8)->i64{return osls_add(b,s,osls_len(s))}
960func osls_build(live:*u8,candidate:*u8,report:*u8,n:i64,set:*OslLossSet)->i64
974func osls_close(set:*OslLossSet)->i64{var rc:i64=nx_bo_release(&set.record);if (set.digest as i64)>0{let r:i64=sys_munmap_direct(set.digest,65);if r<0{rc=r};set.digest=0 as *u8};return rc}
975func osls_approve(set:*OslLossSet,approval:*u8,live:*u8,candidate:*u8)->i64
985func os_evidence_sync_existing(fd:i64,record:*NxBufOwned)->i64
996func os_evidence_retain(path:*u8,dir:*u8,record:*NxBufOwned)->i64
1010func osls_sync_existing(fd:i64,set:*OslLossSet)->i64{return os_evidence_sync_existing(fd,&set.record)}
1011func osls_retain(path:*u8,dir:*u8,set:*OslLossSet)->i64{return os_evidence_retain(path,dir,&set.record)}
1016func obr_add(w:*ObrWriter,s:*u8,n:i64)->i64{if w.error!=0{return w.error};w.error=nx_bo_append(w.out,s,n,0);return w.error}
1017func obr_text(w:*ObrWriter,s:*u8)->i64{return obr_add(w,s,osls_len(s))}
1018func obr_num(w:*ObrWriter,v:i64)->i64{if w.error!=0{return w.error};let n:i64=nxi_buf(w.number,0,v);return obr_add(w,w.number,n)}
1019func obr_frame(w:*ObrWriter,name:*u8,s:*u8,n:i64)->i64
1023func obr_context(target:*u8,live:*u8,other:*u8,q:*NxBehaviorRequest,out:*NxBufOwned)->i64
1040func obr_eligible(r:*NxBehaviorResult)->i64
1047func obr_build(context:*NxBufOwned,target:*u8,r:*NxBehaviorResult,a:*NxBufOwned,b:*NxBufOwned,out:*NxBufOwned)->i64
1060func obr_digest(record:*NxBufOwned,out:*u8)->i64
1068func obr_next(record:*NxBufOwned,at:i64,name:*u8)->i64
1076func obr_approve(record:*NxBufOwned,context:*NxBufOwned,approval:*u8)->i64
1091func os_evidence_read(path:*u8,out:*NxBufOwned)->i64