code wiki / (root) / nx_plane_check.nx

nx_plane_check.nx

buildroot/runtime/nx_plane_check.nx

9026 B180 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic plane
docsdependenciesstructsconstsfunctions

about

nx_plane_check.nx -- VERIFY the TSV<->NXR1 bridge against REAL production plane data, READ-ONLY. WHY THIS EXISTS AND WHY IT COMES BEFORE ANY WRITE: seq1369 shipped the bridge with a gate built on SYNTHETIC fixtures. Fixtures prove the code does what I thought; they cannot prove real rows survive it. Before a single production plane is rewritten, every row of that plane must be shown to make the round trip tsv -> NXR1 -> tsv BYTE-IDENTICAL. This organ does exactly that and WRITES NOTHING. FAIL-CLOSED, and specifically against the VACUOUS-VERIFY TRAP: an empty or unreadable plane exits 4 rather than reporting "0 mismatches, all good". Zero rows checked is not a pass. This is the same trap the TSV-retirement law already warns about (rowset-identical AND NON-EMPTY). COVERAGE IS REPORTED, NOT ASSUMED: it loads via sts_load_honest, whose flags expose that the q:n count key can be LOWER than the rows actually present (measured on debt-: q:n said 125 while 629 segments held 734+ rows). If rows exist beyond the declared count, this exits 5 -- the rows it checked were fine, but the plane was not fully SEEN, and a partial check must never be presented as a complete one. EXIT: 0 all rows byte-identical and plane fully seen · 2 usage · 3 mismatch · 4 empty/unreadable 5 clean so far but coverage incomplete (rows beyond the declared count) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_record_tsv.nx nx_store_seed_lib.nx nx_plane_check.nx

imports: nx_record_tsv.nxnx_store_seed_lib.nx

imported by: nobody (leaf or entry point)

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

main pc_cat pc_emit pc_len sts_load_honest ss_open_cached ssc_init sys_mmap ssc_sig_of ss_cat sys_fstatat ssc_streq ss_open ss_open2 sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_cat ↻ ss_loadfile sys_map_file ss_readall ss_load_aux2 sys_mmap ↻ ss_cat ↻ ss_loadfile ↻ ss_r32 sys_munmap ssl_total_keys ss_r32 ↻ ssl_pow2 ssl_build ss_r32 ↻ ssl_hash_entry ssl_key_eq ss_r32 ↻ ssl_lookup ssl_hash_entry ↻ ssl_key_eq ↻ ss_manifest_free sys_munmap ↻

structs

none

consts

23const PC_CAP: i64 = 16777216 // 16MiB. NOT a fix -- a postponement, and deliberately far above the
27const PC_RECCAP: i64 = 131072
28const PC_OUTCAP: i64 = 131072
29const PC_MSGCAP: i64 = 4096
30const PC_TYPECAP: i64 = 512
31const PC_FLAGS: i64 = 64
32const PC_NL: i64 = 10
33const PC_CH_I: i64 = 105 // 'i' in a typespec means this column is an integer
34const PC_STDOUT: i64 = 1
35const PC_EXIT_USAGE: i64 = 2
36const PC_EXIT_MISMATCH: i64 = 3
37const PC_EXIT_EMPTY: i64 = 4
38const PC_EXIT_COVERAGE: i64 = 5
39const PC_EXIT_TRUNCATED: i64 = 6
40const PC_MAXSHOW: i64 = 5 // per-row detail lines shown before summarising

functions

42func pc_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
43func pc_cat(d: *u8, off: i64, s: *u8) -> i64
called by 1: main
48func pc_emit(b: *u8, n: i64) -> i64 { sys_write(PC_STDOUT, b, n); return 0 }
called by 1: main
50func main(argc: i64, argv: *i64) -> i64