code wiki / (root) / nx_gatefresh.nx

nx_gatefresh.nx

buildroot/runtime/nx_gatefresh.nx

11416 B205 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_gatefresh.nx -- "I just ran that gate and it said GREEN. Can I believe it?" ONE target, cheap, now. THE GAP IT FILLS, and why it is not a fourth copy of anything: nx_stale_check <t> REBUILDS and byte-compares _offc/<t>.elf -- authoritative, but O(one build) and a DIFFERENT subject (the _offc build tree, not the deploy root that gate_run executes). nx_rebuild_plan walks the transitive closure for the WHOLE fleet and names the trigger file -- the right instrument for a census, far too heavy to ask about one gate. nx_gatebuilt_gate censuses every authored gate and reports stale_built, but its list is CAPPED at 25, so the gate you actually care about is usually NOT in the output. None of them answer the per-target question in one call, which is the question an agent has RIGHT AFTER reading a verdict. All the arithmetic is nx_srcfresh (live, gated 10/10) -- this organ is only resolution plus an exit code, so it cannot drift from the predicate the gate proved. WHY IT MATTERS (measured 2026-08-07): /api/gate_run served exit 0 verdict=GREEN pass=23/23 for nx_fsops_gate from a 2026-07-29 binary whose source declared 28 checks, and I reported "no regression" on that GREEN. A gate ELF statically links its libs, so a verdict is a claim about the tree AS OF ITS BUILD. Fleet-wide: 715 gates have a binary and only 176 are current with their own source. A GATE VERDICT IS EVIDENCE ABOUT THE SOURCE ONLY IF THE GATE WAS BUILT FROM IT. SCOPE IS DECLARED IN THE OUTPUT, never implied: OWN-SOURCE mtime only. A gate invalidated by a shared dep reads FRESH here, and mtime proves a source MOVED, not that codegen CHANGED (a comment-only edit moves it and leaves the binary byte-identical). So FRESH is a floor, not a guarantee, and the payload says so. nx_gatefresh <name> -> exit 0 FRESH | 1 STALE | 3 UNBUILT (no <name>.elf) | 4 NO-SOURCE | 2 usage license_tier: ORIGINAL Read-only: it stats two paths and writes nothing. (Rule 26)

dependencies 1 imports · 0 importers

nx_srcfresh.nx nx_gatefresh.nx

imports: nx_srcfresh.nx

imported by: nobody (leaf or entry point)

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

main gf_puts gf_cat sf_mtime_ns 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 ↻ sys_fstatat sys_munmap gf_has_main gf_at sf_prov_stale sys_mmap ↻ sf_prov_src_sha sys_openat_rd sys_mmap ↻ sys_read sys_close sf_file_sha_hex sys_openat_rd ↻ sys_mmap ↻ sys_read ↻ sys_close ↻ sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_seed_allocated

structs

none

consts

28const GF_PATHCAP: i64 = 512
29const GF_RC_STALE: i64 = 1
30const GF_RC_USAGE: i64 = 2
31const GF_RC_UNBUILT: i64 = 3
32const GF_RC_NOSRC: i64 = 4
33const GF_RC_LIB: i64 = 5
34const GF_SCAN: i64 = 262144 // bounded source scan for the entry-point probe
35const GF_DIR_RT: *u8 = "buildroot/runtime/"
36const GF_DIR_HDL: *u8 = "buildroot/runtime/_hdl_build/"

functions

38func gf_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main
39func gf_putn(v: i64) -> i64
called by 1: main
52func gf_cat(d: *u8, at: i64, s: *u8) -> i64
called by 1: main
62func gf_at(buf: *u8, i: i64, n: i64, needle: *u8) -> i64
called by 1: gf_has_main
78func gf_has_main(path: *u8) -> i64
called by 1: main calls 1: gf_at
98func main(argc: i64, argv: *i64) -> i64