nx_srcfresh.nx
buildroot/runtime/nx_srcfresh.nx
about
nx_srcfresh.nx -- LIB: IS THIS ARTIFACT BUILT FROM THIS SOURCE? The canonical source-vs-artifact
staleness predicate, extracted 2026-08-07 so callers that are not installers can ask the question.
WHY IT EXISTS AS A LIB. The predicate already existed and was already PROVEN -- oi_src_stale in
nx_offc_install.nx, locked by _freshness_gate.nx (T1 stale / T2 neg-control fresh / T3 artifact-absent /
T4 source-absent / T5 mtime round-trip). But it lives inside an INSTALLER that owns main(), so no other
organ can import it, and the mtime-stat idiom is consequently open-coded in 10+ places (gv_mtime in
nx_gate_verdict_lib, gb_mtime in nx_gatebuilt_gate, nx_pipeline_census, nx_datacurator x3, nx_netobs,
nx_imgbook_promote, nx_janitor_sprawl, nx_sov_tree_audit, nx_eff_lib, nx_mem_healer) -- and those copies
do NOT agree: several read only st_mtim.tv_sec, so two writes in the same second compare EQUAL and a
rebuild-within-a-second reads FRESH when it is stale.
A PROVEN PREDICATE TRAPPED INSIDE AN ORGAN THAT OWNS main() IS NOT A SHARED CAPABILITY, IT IS A COPY
WAITING TO BE MADE -- AND EVERY COPY IS FREE TO DISAGREE WITH THE ONE THE GATE PROVED.
SEMANTICS ARE LIFTED VERBATIM from oi_src_stale rather than re-derived, so the behaviour _freshness_gate
already locked carries over unchanged; nx_srcfresh_gate re-asserts all five of its cases against THIS
copy (equivalence is asserted, not assumed) and adds the same-second case the second-granularity copies
silently fail.
Imports ONLY nx_syscalls.nx -- a lib that drags a dependency tree behind it does not get adopted.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 16 importers
diagram shows first 10 each side; +0 more imports, +6 more importers in the complete lists below.
imports: nx_syscalls.nxnx_sha256.nx
imported by: nx_capcliff_gate.nxnx_fsops.nxnx_fsops_lib_t77.nxnx_fsops_t77.nxnx_gatebuilt_gate.nxnx_gatefresh.nxnx_io_envelope_census_gate.nxnx_lease_lib.nxnx_mgmt_api.nxnx_mgmt_api.pre-toolchain-20260910.nxnx_mgmt_api_search_candidate_t330.nxnx_mgmt_api_toolchain_session_20260910.nxnx_mgmt_cap_candidate_t186.nxnx_mgmt_deploy_candidate_t185.nxnx_rungclose.nxnx_srcfresh_gate.nx
structs
| none |
consts
| 23 | const SF_MAGIC_4194304: i64 = 4194304 |
| 25 | const SF_STATBUF: i64 = 256 |
| 26 | const SF_MTIME_SEC_OFF: i64 = 88 |
| 27 | const SF_MTIME_NSEC_OFF: i64 = 96 |
| 28 | const SF_NS_PER_SEC: i64 = 1000000000 |
| 82 | const SF_PROV_CAP: i64 = 4096 |
| 83 | const SF_HEXLEN: i64 = 64 |
| 84 | const SF_HEXBUF: i64 = 80 |
functions
| 32 | func sf_mtime_ns(path: *u8) -> i64 |
| 49 | func sf_src_stale(artifact: *u8, source: *u8) -> i64 |
| 64 | func sf_lag_sec(artifact: *u8, source: *u8) -> i64 |
| 86 | func sf_hex32(dig: *u8, out: *u8) -> i64 |
| 99 | func sf_file_sha_hex(path: *u8, out: *u8) -> i64 |
| 120 | func sf_prov_src_sha(provpath: *u8, out: *u8) -> i64 |
| 152 | func sf_prov_stale(provpath: *u8, srcpath: *u8) -> i64 |