nx_buildpath_lib.nx
buildroot/runtime/nx_buildpath_lib.nx
about
nx_buildpath_lib.nx -- THE ONE ANSWER TO "WHERE DID THE BUILDER PUT THE ARTIFACT?"
WHY IT EXISTS (measured 2026-08-16, coverage_complete=1 / corpus_complete=1 over 23,232 sources):
nx_sov_build_run anchors its CWD to buildroot/ and writes _build/<name>.sov.elf. It has not
written /tmp since 2026-07-30, when the flock change moved artifacts to a per-target
_build/<n>.lock+.s+.sov.elf. Every consumer that wants the freshly-built artifact must know that,
and the knowledge had NO CALLABLE HOME -- so each one re-derived it, and they disagree:
- nx_stale_check probes /tmp THEN _build. Fixed under seq1554, whose own comment records that
probing ONE location "made this guard answer BUILDFAIL for EVERY target, so
the instrument that gates a risky promote was DEAD".
- nx_drift_watch INLINED nx_stale_check's logic ("the SAME logic as nx_stale_check, INLINED
to stay single-nest") and NEVER RECEIVED THAT FIX. It logged BUILDFAIL
against all four of its subjects for ~32h while reporting verdict=GREEN.
- 13 further organs probe /tmp ONLY, with no fallback at all.
*AN INLINED COPY DOES NOT RECEIVE ITS ORIGINAL'S FIXES -- the duplicate-ruler defect with a
delay fuse, because the copy looks correct on the day it is written.
*A BUG YOU FIX BY REWRITING THE LINE, RATHER THAN BY EXTRACTING THE FIX, IS A BUG YOU WILL
WRITE AGAIN. A correction with no callable home fixes exactly one site.
WHY THE PROBE ORDER IS WHAT IT IS -- every root is here for a NAMED reason, never for luck:
BP_AT_BUILD "_build/" the caller already runs from buildroot/ (nx_drift_watch
chdirs there before checking; so does the builder itself).
BP_AT_BUILDROOT "buildroot/_build/" the caller runs from the SERVING ROOT -- every gate invoked
by /api/gate_run, and the 48 gates repointed on 2026-08-16.
BP_AT_TMP "/tmp/" LEGACY, pre-2026-07-30. Kept so an older host still
resolves, and reported SEPARATELY so that resolving only
via the legacy root is VISIBLE AS DRIFT instead of silent.
THE RETURN IS THE ROOT THAT MATCHED, NOT A BOOLEAN. A caller that can say WHICH root answered can
distinguish "found where the builder writes" from "found only in the legacy location" -- and one of
those is a warning. A two-state answer collapses them, which is how this class stayed invisible.
*AN AXIS THAT CANNOT SAY *WHICH* CANNOT REPORT DRIFT, ONLY PRESENCE.
`out` ALWAYS holds a path, including on failure, where it holds the PRIMARY probe -- so a caller
reports what it LOOKED FOR rather than printing an empty string. A guard whose failure message
names no path is the reason this defect took three lanes to find.
NO GUESSED CAP: bp_needed(name) derives the exact bytes required from the longest prefix, the
caller's name and the suffix, and bp_artifact REFUSES with BP_OUTCAP_TOO_SMALL rather than
truncating. A ceiling that has to be guessed is a defect generator in both directions.
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_buildpath_gate.nxnx_drift_watch.nx
structs
| none |
consts
| 52 | const BP_OUTCAP_TOO_SMALL: i64 = 0 - 1 |
| 53 | const BP_NOTFOUND: i64 = 0 |
| 54 | const BP_AT_BUILD: i64 = 1 |
| 55 | const BP_AT_BUILDROOT: i64 = 2 |
| 56 | const BP_AT_TMP: i64 = 3 |
functions
| 58 | func bp_slen(s: *u8) -> i64 called by 1: bp_needed |
| 63 | func bp_cat(dst: *u8, off: i64, src: *u8) -> i64 called by 1: bp_compose |
| 70 | func bp_root_build() -> *u8 { return "_build/" as *u8 } |
| 71 | func bp_root_buildroot() -> *u8 { return "buildroot/_build/" as *u8 } |
| 72 | func bp_root_tmp() -> *u8 { return "/tmp/" as *u8 } |
| 73 | func bp_suffix() -> *u8 { return ".sov.elf" as *u8 } |
| 77 | func bp_needed(name: *u8) -> i64 called by 3: mainbp_artifactd_check calls 5: bp_slenbp_root_buildbp_root_buildrootbp_root_tmpbp_suffix |
| 86 | func bp_exists(path: *u8) -> i64 |
| 94 | func bp_compose(root: *u8, name: *u8, out: *u8) -> i64 |
| 105 | func bp_artifact(name: *u8, out: *u8, outcap: i64) -> i64 called by 2: maind_check calls 6: bp_neededbp_composebp_root_buildbp_existsbp_root_buildrootbp_root_tmp |
| 121 | func bp_reason(code: i64) -> *u8 called by 1: main |