nx_planepeek.nx
buildroot/runtime/nx_planepeek.nx
about
nx_planepeek.nx -- READ ONE RAW KEY OUT OF A SEG-STORE PLANE. Read-only, writes nothing.
WHY IT EXISTS. The debt- plane is refusing every add/eat because ONE row is reachable past the
declared q:n (nx_plane_check: rows=3696 identical=3696 declared_qn=3696 beyond_qn=1), and
nx_plane_repair correctly refuses to reconcile it: "an older seeding generation -- reseeding would
revive eaten rows and duplicate live ones. That needs a generation diff, not a reconcile."
To DO that generation diff somebody has to look at the row. And nothing in the estate could:
nx_store_put reads its own N-column planes, nx_plane_check verifies round-trips, nx_store_hist is a
column histogram -- none of them will hand you the value at an arbitrary key.
★★★★★A PLANE YOU CAN VERIFY AND REPAIR BUT CANNOT READ A SINGLE KEY OUT OF FORCES EVERY DIAGNOSIS
TO BE A GUESS. I made two wrong guesses about this exact row before building this.
It is deliberately the smallest thing that closes that gap: resolve a key through the SAME
production ss_get every reader uses, print the bytes, exit. No writes, no repair, no opinion.
===========================================================================================
THE FALSE-ABSENCE DEFECT (debt 1787282525, sev 6, fixed 2026-08-21).
===========================================================================================
v1 printed exactly one word for every non-hit: `if ss_get(...) != 1 { MISS }`.
ss_get's OWN contract (nx_seg_store.nx: "1=found, 0=tombstoned, -1=absent") already carried a
state v1 threw away, and the scan underneath it carried three more:
1. ss_get==0 -> the key EXISTS and was explicitly DELETED. v1 said MISS. A tombstone is a
POSITIVE fact about a key, and reporting it as absence inverts its meaning.
2. no manifest -> ss_manifest_dyn returns 0, ss_scan returns 0, ss_get returns -1. So a
MISTYPED PREFIX printed the same MISS as a real absence. Nothing could tell them apart.
3. a segment NAMED in manifest.txt but UNREADABLE on disk -> ss_readall sets sz=-1 and
ss_scan_seglist's `while i + 9 <= sz` loop never executes. The segment contributes ZERO
rows and NO error. A plane half of which could not be opened answered a confident "absent".
4. a caller passing a COLUMN VALUE where the plane's keys are q:<n> (every N-col plane written
by nx_store_put) got MISS, which reads as "your row is gone" rather than "wrong grammar".
FIVE distinguishable conditions, ONE word, and that word is a NEGATIVE ASSERTION. Measured cost:
a seat nearly filed "the enqueue lane is dead" on it, and a build-refusal message shipped
`verify with nx_planepeek deployq- BQ-<target>` -- pointing every caller at a false-absence
generator. ★★★★★★AN UNBOUNDED SEARCH THAT GIVES UP MUST NOT REPORT THE SAME WORD AS AN
EXHAUSTIVE ONE THAT FOUND NOTHING -- otherwise every quote of it silently rewrites the
evidential status of the claim that quotes it.
⇒ MISS now means ONE thing: the plane resolved, EVERY declared segment was read, the key is not
there. Everything else gets its own word and its own exit code, and every answer -- hit or
miss -- prints the coverage it was computed from.
★PRESENCE NEEDS ONE WITNESS; ABSENCE NEEDS PROVEN COVERAGE. So the HIT path stays a cheap point
dependencies 2 imports · 0 importers
imports: nx_seg_store.nxnx_syscalls.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
| 57 | const PK_KEYCAP: i64 = 256 |
| 58 | const PK_MAXRANGE: i64 = 200 |
| 59 | const PK_ZERO: i64 = 48 |
| 60 | const PK_NINE: i64 = 57 |
| 64 | const PK_TAB: i64 = 9 |
| 67 | const PK_PATHCAP: i64 = 512 |
| 71 | const PK_EX_HIT: i64 = 0 |
| 72 | const PK_EX_MISS: i64 = 1 |
| 73 | const PK_EX_USAGE: i64 = 2 |
| 74 | const PK_EX_UNPROVEN: i64 = 3 |
| 75 | const PK_EX_NOPLANE: i64 = 4 |
| 76 | const PK_EX_TOMBSTONED: i64 = 5 |
| 77 | const PK_EX_NOTAKEY: i64 = 6 |
| 81 | const PK_SS_TOMB: i64 = 0 |
| 82 | const PK_SS_HIT: i64 = 1 |
| 85 | const PK_COV_SLOTS: i64 = 8 |
| 86 | const PK_COV_DECLARED: i64 = 0 |
| 87 | const PK_COV_READABLE: i64 = 1 |
| 88 | const PK_COV_UNREADABLE: i64 = 2 |
| 89 | const PK_COV_BYTES: i64 = 3 |
| 90 | const PK_COV_ARCHIVE: i64 = 4 |
| 91 | const PK_COV_KEYS: i64 = 5 |
| 92 | const PK_COV_SEGS: i64 = 6 |
functions
| 94 | func pk_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 95 | func pk_puts(s: *u8) -> i64 { sys_write(1, s, pk_len(s)); return 0 } called by 6: pk_putnpk_name_unreadablepk_put_coveragepk_put_valuepk_resolvemain calls 2: sys_writepk_len |
| 96 | func pk_putn(v: i64) -> i64 |
| 106 | func pk_atoi(s: *u8) -> i64 called by 1: main |
| 116 | func pk_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 123 | func pk_rowkey(seq: i64, out: *u8) -> i64 |
| 137 | func pk_segsize(prefix: *u8, segname: *u8) -> i64 called by 2: pk_coveragepk_name_unreadable calls 6: sys_mmapss_catsys_openat_rdsys_munmapsys_lseeksys_close |
| 153 | func pk_coverage(prefix: *u8, cov: *i64) -> i64 |
| 178 | func pk_name_unreadable(prefix: *u8, cov: *i64) -> i64 |
| 195 | func pk_put_coverage(cov: *i64) -> i64 |
| 214 | func pk_scan_for_colvalue(prefix: *u8, key: *u8, cov: *i64, rk: *i64, rkl: *i64) -> i64 |
| 260 | func pk_put_value(pp: *i64, lp: *i64) -> i64 |
| 270 | func pk_resolve(prefix: *u8, key: *u8, cov: *i64) -> i64 |
| 315 | func main(argc: i64, argv: *i64) -> i64 |