code wiki / (root) / nx_srcfresh_gate.nx

nx_srcfresh_gate.nx

buildroot/runtime/nx_srcfresh_gate.nx

7912 B148 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_srcfresh_gate.nx -- TEETH FOR THE EXTRACTED FRESHNESS PREDICATE (nx_srcfresh.nx). T1-T5 are DELIBERATELY THE SAME FIVE CASES _freshness_gate.nx already locks against the original oi_src_stale, re-asserted against the extracted copy. An extraction that is not re-asserted is a claim of equivalence, not a proof of it -- and the copies already in this tree are exactly what happens when the claim is trusted (several read only tv_sec and disagree with the predicate the gate proved). T6/T7 ARE THE LOAD-BEARING PAIR AND ARE NEW. They set two files to the SAME SECOND and different NANOSECONDS. Every second-granularity implementation of this predicate answers 0 (fresh) for T6, because the two mtimes compare EQUAL -- so T6 is the tooth that fails for the copies and passes only for a real nanosecond comparison. T7 drives the same fixture the other way so the pair discriminates in BOTH directions and cannot be satisfied by a function that simply always returns 1. LAW: A TOOTH THAT ONLY THE CORRECT IMPLEMENTATION PASSES IS THE ONLY KIND WORTH ADDING TO A COPY. T8-T10 lock the MAGNITUDE, including the absent-artifact case returning -1 rather than 0: "no measurable lag" and "no lag" are different facts, and folding them is the defect class this session kept finding. DETERMINISTIC: mtimes are set explicitly via sys_utimensat -- no sleeps, no filesystem-resolution races. Fixtures live in /tmp and are unlinked at the end. Inherits nx_gate_verdict (D001). license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_srcfresh.nx nx_gate_verdict.nx nx_srcfresh_gate.nx

imports: nx_syscalls.nxnx_srcfresh.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main 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 ↻ gv_head gv_puts sys_write ↻ sys_unlinkat sg_write sys_openat_wr sys_write ↻ sg_len sys_close sg_set sys_mmap ↻ sys_utimensat gv_check gv_puts ↻ sf_src_stale sf_mtime_ns sys_mmap ↻ sys_fstatat sys_munmap sf_mtime_ns ↻ sf_lag_sec sf_mtime_ns ↻ sf_prov_stale

structs

none

consts

24const SG_MODE: i64 = 420 // 0644
25const SG_BASE: i64 = 1700000000 // fixed epoch -- the clock is set, never observed
26const SG_LAG: i64 = 100 // seconds the source leads the artifact in T8
27const SG_RT: i64 = 1700000042 // round-trip probe value
28const SG_NS_LO: i64 = 500
29const SG_NS_HI: i64 = 900
30const SG_TSBUF: i64 = 64

functions

32func sg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: sg_write
33func sg_cat(d: *u8, at: i64, s: *u8) -> i64
called by 1: main
40func sg_write(path: *u8, content: *u8) -> i64
48func sg_set(path: *u8, sec: i64, nsec: i64) -> i64
called by 1: main calls 2: sys_mmapsys_utimensat
57func main(argc: i64, argv: *i64) -> i64