code wiki / _hdl_build / nx_staledir_gate.nx

nx_staledir_gate.nx

buildroot/runtime/_hdl_build/nx_staledir_gate.nx

4444 B76 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_staledir_gate.nx -- proves the DIRECTION GUARD in nx_stale_check (F1145 / debt seq1008). WHY THIS GATE EXISTS: nx_stale_check's byte-compare tells you source and deployment DISAGREE but is structurally blind to WHICH IS AHEAD. The old code called every disagreement STALE, whose remedy text is "rebuild+restage" -- and for a binary that is AHEAD of its source that remedy DELETES the shipped feature. That is exactly how the nx_page_verify auto-connect-override would have been destroyed. So the guard is not cosmetic: it decides whether a human is told to run a DESTRUCTIVE command. The classifier under test is pure size-direction arithmetic, so it is testable without building anything: sd_verdict(fresh_bytes, deployed_bytes, identical) -> the verdict id. T1 identical -> CURRENT T2 fresh << deployed and tiny -> AMBIGUOUS (the pre-existing stub trap must SURVIVE this change) T3 fresh < deployed -> DEPLOYED-AHEAD <== THE NEW TOOTH: the seq1008 shape, remedy WITHHELD T4 fresh > deployed -> STALE (source genuinely ahead; rebuild IS the right remedy) T5 same size, differing bytes -> STALE (direction unknowable by size; must not claim AHEAD) T6 REGRESSION: the exact seq1008 magnitudes (572834 vs 574963) must classify DEPLOYED-AHEAD, NOT the stub AMBIGUOUS and NOT STALE -- a 2KB delta on a 575KB binary is the real case that slipped through the old stub-only guard. T7 ANTI-VACUITY: the guard must NOT swallow everything -- a genuinely stale target still reaches STALE, so the useful remedy is not lost. A guard that flags every case is as useless as none. expect_exit: 0 license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_gate_verdict.nx nx_staledir_gate.nx

imports: nx_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 gv_head gv_puts sys_write sd_verdict gv_check gv_puts ↻ gv_verdict gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real gv_cat sys_write ↻ sys_close sys_munmap ↻

structs

none

consts

24const SD_CURRENT: i64 = 0
25const SD_AMBIGUOUS: i64 = 1
26const SD_AHEAD: i64 = 2
27const SD_STALE: i64 = 3
28const SD_STUB_CAP: i64 = 4096

functions

33func sd_verdict(fresh: i64, deployed: i64, identical: i64) -> i64
called by 1: main
40func main() -> i64