code wiki / _hdl_build / nx_staledir_gate.nx
nx_staledir_gate.nx
buildroot/runtime/_hdl_build/nx_staledir_gate.nx
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
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
structs
| none |
consts
| 24 | const SD_CURRENT: i64 = 0 |
| 25 | const SD_AMBIGUOUS: i64 = 1 |
| 26 | const SD_AHEAD: i64 = 2 |
| 27 | const SD_STALE: i64 = 3 |
| 28 | const SD_STUB_CAP: i64 = 4096 |
functions
| 33 | func sd_verdict(fresh: i64, deployed: i64, identical: i64) -> i64 called by 1: main |
| 40 | func main() -> i64 |