code wiki / _hdl_build / nx_bld_cache_cas_gate.nx

nx_bld_cache_cas_gate.nx

buildroot/runtime/_hdl_build/nx_bld_cache_cas_gate.nx

39257 B682 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_bld_cache_cas_gate.nx -- VERDICT gate for rung B2 of /compare/toolchain: the content-addressed build cache in nx_sov_build_run (watch symbol bld_cache_cas). Runs the REAL builder binary end to end inside an ISOLATED fixture tree under <buildroot>/_build/nx_bld_cache_cas_gate/ (its own runtime/, its own _offc/ copy of the live toolchain, its own _build/cache) so nothing here touches the estate's cache, its toolchain, or its knowledge/ confs -- and so the gate is idempotent: the fixture is wiped at SETUP, never at teardown (a teardown does not run when a run crashes). DONE-RULE UNDER TEST (toolchain.plan B2, verbatim): an unchanged rebuild returns byte-identical bytes with ZERO compiler invocation, and a one-byte source edit MISSES; a hit is byte-verified before use; a key miss on any input change is the tooth; determinism re-proven by byte-identical cold rebuilds. THE ZERO-INVOCATION WITNESS IS STATE, NOT A MESSAGE: the builder writes _build/<t>.s ONLY inside its compile loop (sys_openat_wr(spath) immediately before it forks nx_cc). The gate deletes that file before a rebuild; if the artifact comes back and the .s is still ABSENT, the compiler was not forked. A tooth asserts the .s IS present after a real build, so the absence witness cannot pass vacuously. Subject: argv[1] = builder elf (absolute or cwd-relative), else the first of <nishihost>/nx_sov_build_run.sov.elf.new (STAGED -- what the next promote installs) <buildroot>/_build/nx_sov_build_run.sov.elf (the last build) <buildroot>/_offc/nx_sov_build_run.elf (LIVE) and the chosen path + its sha256 are PRINTED, so the reader knows which binary was judged. Bounded by the subject's OWN declared per-step deadline (it time-boxes compile and assemble); the gate passes ms=0 so that bound is inherited rather than copied. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_sha256.nx nx_gate_verdict.nx nx_gatekit_lib.nx nx_bld_cache_cas_gate.nx

imports: nx_syscalls.nxnx_sha256.nxnx_gate_verdict.nxnx_gatekit_lib.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write gv_ctr 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_mmap ↻ gv_need gv_puts ↻ gk_corpus_root sys_mmap ↻ gk_cat gk_exists sys_openat_rd sys_close gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap

structs

none

consts

35const CG_SHA_HEX: i64 = 64
36const CG_PATH: i64 = 4096
37const CG_OUT: i64 = 1048576 // one builder run prints well under this; = GK_BUF
38const CG_DIRBUF: i64 = 65536
39const CG_DENT_RECLEN_OFF: i64 = 16 // linux_dirent64: d_reclen u16 at +16, d_name at +19 (gk_dirscan uses the same)
40const CG_DENT_NAME_OFF: i64 = 19
41const CG_MODE_X: i64 = 493 // 0755
42const CG_FX_EXIT_A: i64 = 42 // fixture v1 exit code
43const CG_FX_EXIT_B: i64 = 43 // fixture v2 exit code (ONE byte differs: '2' -> '3')
44const CG_MAXOUT_SHOW: i64 = 4096 // how much of a captured run to echo into the report on a failure
46const CG_FX: *u8 = "casfx"
47const CG_FXREL: *u8 = "_build/nx_bld_cache_cas_gate"

functions

63func cgp_mk(base: *u8, tail: *u8) -> i64
70func cgp_init(buildroot: *u8) -> i64
called by 1: main calls 1: cgp_mk
88func cgp_root() -> *u8 { return cgp_root_p as *u8 }
called by 1: main
89func cgp_tree() -> *u8 { return cgp_tree_p as *u8 }
called by 2: cg_buildmain
90func cgp_know() -> *u8 { return cgp_know_p as *u8 }
91func cgp_conf() -> *u8 { return cgp_conf_p as *u8 }
called by 1: main
92func cgp_fxsrc() -> *u8 { return cgp_fxsrc_p as *u8 }
called by 1: cg_write_fixture
93func cgp_fxs() -> *u8 { return cgp_fxs_p as *u8 }
called by 1: main
94func cgp_fxelf() -> *u8 { return cgp_fxelf_p as *u8 }
called by 2: cg_run_fxmain
95func cgp_cache() -> *u8 { return cgp_cache_p as *u8 }
called by 1: main
96func cgp_cc() -> *u8 { return cgp_cc_p as *u8 }
called by 1: main
97func cgp_asm() -> *u8 { return cgp_asm_p as *u8 }
called by 1: main
98func cgp_lock() -> *u8 { return cgp_lock_p as *u8 }
called by 1: main
99func cgp_rt() -> *u8 { return cgp_rt_p as *u8 }
called by 1: main
100func cgp_hdl() -> *u8 { return cgp_hdl_p as *u8 }
called by 1: main
101func cgp_offc() -> *u8 { return cgp_offc_p as *u8 }
called by 1: main
102func cgp_build() -> *u8 { return cgp_build_p as *u8 }
called by 1: main
105func cg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
106func cg_p(s: *u8) -> i64 { sys_write(1, s, cg_len(s)); return 0 }
called by 2: cg_show_on_failmain calls 2: sys_writecg_len
107func cg_nl() -> i64 { let b: *u8 = sys_mmap(2); b[0] = 10 as u8; sys_write(1, b, 1); sys_munmap(b, 2); return 0 }
108func cg_pn(v: i64) -> i64 { gv_num(v); return 0 }
called by 1: main calls 1: gv_num
111func cg_sha(path: *u8, out: *u8) -> i64
131func cg_hexeq(a: *u8, b: *u8) -> i64
called by 1: main
138func cg_copy(src: *u8, dst: *u8, mode: i64) -> i64
156func cg_clear_dir(dir: *u8) -> i64
188func cg_count_suffix(dir: *u8, suffix: *u8) -> i64
219func cg_write_fixture(exit_code: i64) -> i64
254func cg_build(subject: *u8, extra: *u8, out: *u8, outlen: *i64, ctr: *i64) -> i64
274func cg_run_fx() -> i64 { return gk_run(cgp_fxelf(), 0 as *u8, 0 as *u8, 0 as *u8, 0 as *u8) }
called by 1: main calls 2: gk_runcgp_fxelf
277func cg_key_of(out: *u8, n: i64, keyout: *u8) -> i64
called by 1: main calls 1: gk_out_pos
291func cg_file_has(path: *u8, needle: *u8) -> i64
302func cg_needle_anm(out: *u8) -> *u8
called by 1: main calls 1: gk_cat
308func cg_show_on_fail(cond: i64, out: *u8, n: i64) -> i64
called by 2: cg_buildmain calls 3: cg_pcg_nlsys_write
318func cg_append_byte(path: *u8) -> i64
330func cg_flip_last(path: *u8) -> i64
346func main(argc: i64, argv: *i64) -> i64