code wiki / _hdl_build / nx_clobber_guard.nx

nx_clobber_guard.nx

buildroot/runtime/_hdl_build/nx_clobber_guard.nx

3104 B60 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_clobber_guard.nx -- SOTA anti-clobber guard for dual-copy artifacts (acl lane, F744). Content-reconciliation with OPTIMISTIC-CONCURRENCY / git-non-fast-forward semantics: compare two SURFACE copies of one logical artifact (e.g. laptop SSOT vs NAS buildroot, or a store's two segments' exports). A would-be push that OVERWRITES a DIVERGED target is REFUSED (exit 3) so the writer must reconcile first -- never silent last-writer-wins. Byte-exact compare (same idiom as nx_drift_watch / nx_stale_check byte compare), no crypto dependency, no hardware writes (Rule 26). nx_clobber_guard cmp <pathA> <pathB> Machine contract (exit code): 0 CONVERGED (safe to push) | 3 DIVERGED (would-clobber, refuse) | 4 ABSENT (a surface is missing) | 2 usage. The stdout line carries the verdict + sizes for logs. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_clobber_guard.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main cg_w sys_write sys_exit sys_mmap cg_read sys_openat_rd sys_read sys_close cg_wn nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap

structs

none

consts

13const K_MAGIC_8388608: i64 = 8388608

functions

15func cg_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main calls 1: sys_write
20func cg_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
21func cg_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
34func main(argc: i64, argv: *i64) -> i64