nx_refdrift.nx
buildroot/runtime/nx_refdrift.nx
about
nx_refdrift.nx -- DOES THE URL STILL SERVE THE BYTES WE PINNED? The refs referee proves the mirror matches
its pin, which is a claim about OUR disk. It says so about itself in its own verdict note: "fetch-time
provenance proves the mirror is OF the url. It does NOT prove the url still serves those bytes." This
organ closes that residual, and it exists because the gap was measured the hard way on 2026-09-04: two
pinned standards had MOVED upstream since they were fetched, and a seat only discovered it by re-fetching
them for an unrelated reason. A CITATION THAT DRIFTS SILENTLY IS A CLAIM WITH AN EXPIRY DATE NOBODY
RECORDED -- the pin still matches the mirror, the mirror still matches the pin, and the source has changed.
IT COMPARES BYTES, NOT HASHES, AND THAT IS DELIBERATE. The refs referee already proves pin == filehash of
the mirror, so the mirror IS the pinned bytes. Re-fetching and byte-comparing against the mirror therefore
answers the drift question exactly, with no second hash implementation to drift from the first. One ruler.
IT IS BOUNDED BY CONSTRUCTION AND SAYS SO. The operator's standing law is that hammering the estate is a
defect in its own right, so this organ takes ONE refs file and a MAXIMUM number of rows per run, both from
argv, and it PRINTS the bound beside the result. A run that stops at its cap declares checked and total, so
a partial pass can never read as a clean sweep -- the self-ceiling defect this estate names as law L011.
nx_refdrift check <refsfile> [max] -> per-row MATCH / DRIFTED / UNREACHABLE, plus a summing partition
nx_refdrift selftest -> teeth, exit 0 GREEN / 1 RED
Exit: 0 no drift found | 1 DRIFTED rows exist | 2 usage | 3 UNREADABLE refs file. verdict= is LAST.
license_tier: ORIGINAL. Forks the sovereign fetcher, writes one reused temp mirror. No hw writes (Rule 26).
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_tool_run.nxnx_rowparse_lib.nxnx_mirrorintegrity_lib.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
| 27 | const RD_EXIT_OK: i64 = 0 |
| 28 | const RD_EXIT_DRIFT: i64 = 1 |
| 29 | const RD_EXIT_USAGE: i64 = 2 |
| 30 | const RD_EXIT_UNREAD: i64 = 3 |
| 31 | const RD_SPAN: i64 = 8 |
| 32 | const RD_OUT: i64 = 262144 |
| 33 | const RD_REFS_CAP: i64 = 1048576 |
| 34 | const RD_BODY_CAP: i64 = 8388608 |
| 35 | const RD_FETCH_OUT: i64 = 65536 |
| 36 | const RD_PATH: i64 = 4096 |
| 37 | const RD_SEEK_END: i64 = 2 |
| 40 | const RD_MAX_DEFAULT: i64 = 12 |
| 41 | const RD_COL_KEY: i64 = 1 |
| 42 | const RD_COL_URL: i64 = 3 |
| 43 | const RD_COL_MIRROR: i64 = 4 |
| 44 | const RD_ARGV_SLOTS: i64 = 4 |
| 45 | const RD_PROBE: *u8 = "knowledge/fetched/refdrift_probe.tmp" |
| 46 | const RD_FETCHER: *u8 = "nx_research_fetch.elf" |
| 47 | const RD_PROBE_NAME: *u8 = "refdrift_probe.tmp" |
| 48 | const RD_PROBE_B: *u8 = "knowledge/fetched/refdrift_probe_b.tmp" |
| 49 | const RD_PROBE_B_NAME: *u8 = "refdrift_probe_b.tmp" |
| 71 | const RD_SPACE: i64 = 32 |
| 72 | const RD_WL_COL_DOM: i64 = 1 |
| 73 | const RD_WL_COL_KEY: i64 = 2 |
| 74 | const RD_WL_COL_MIRROR: i64 = 3 |
| 75 | const RD_WL_COL_CANON: i64 = 4 |
| 76 | const RD_COL_PIN: i64 = 5 |
| 77 | const RD_COL_ACCESSED: i64 = 6 |
| 78 | const RD_REFS_DIR: *u8 = "buildroot/knowledge/compare/" |
| 79 | const RD_HASHER: *u8 = "nx_filehash.elf" |
| 80 | const RD_SHA_TAG: *u8 = "sha256" |
| 81 | const RD_JSON_QCQ: i64 = 3 |
| 82 | const RD_HEXLEN: i64 = 64 |
| 83 | const RD_TMP_SUFFIX: *u8 = ".recite.tmp" |
| 84 | const RD_WL_TAG: *u8 = "MOVED" |
| 87 | const RD_KEYARG: *u8 = "key=" |
| 89 | const RD_SECS_PER_DAY: i64 = 86400 |
| 90 | const RD_DAYS_EPOCH_TO_ERA0: i64 = 719468 |
| 91 | const RD_DAYS_PER_ERA: i64 = 146097 |
| 92 | const RD_ERA_YEARS: i64 = 400 |
| 93 | const RD_DOE_4Y: i64 = 1460 |
| 94 | const RD_DOE_100Y: i64 = 36524 |
| 95 | const RD_DOE_ERA_LAST: i64 = 146096 |
| 96 | const RD_DAYS_PER_YEAR: i64 = 365 |
| 97 | const RD_LEAP_4: i64 = 4 |
| 98 | const RD_LEAP_100: i64 = 100 |
| 99 | const RD_MP_SCALE: i64 = 5 |
| 100 | const RD_MP_OFF: i64 = 2 |
| 101 | const RD_MP_DIV: i64 = 153 |
| 102 | const RD_MP_MARCH: i64 = 3 |
| 103 | const RD_MP_WRAP: i64 = 9 |
| 104 | const RD_MP_JAN: i64 = 10 |
| 105 | const RD_TWO_DIGIT: i64 = 10 |
| 233 | const RD_V_MATCH: i64 = 0 |
| 234 | const RD_V_DRIFTED: i64 = 1 |
| 235 | const RD_V_UNREACHABLE: i64 = 2 |
| 236 | const RD_V_DYNAMIC: i64 = 3 |
functions
| 52 | func rd_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 106 | func rd_put2(out: *u8, o: i64, v: i64) -> i64 |
| 111 | func rd_ymd(epoch: i64, out: *u8) -> i64 |
| 131 | func rd_basename(p: *u8) -> *u8 |
| 138 | func rd_sha(path: *u8, out: *u8, fo: *u8, folen: *i64, av: *i64) -> i64 |
| 162 | func rd_recite_row(refs: *u8, key: *u8, newurl: *u8, sha: *u8, ymd: *u8, rb: *u8, ob: *u8, c: *i64) -> i64 |
| 238 | func rd_same(mb: *u8, mn: i64, pb: *u8, pn: i64, qb: *u8, qn: i64) -> i64 calls 1: rp_same |
| 246 | func main(argc: i64, argv: **u8) -> i64 |