code wiki / (root) / nx_comparewatch_census.nx

nx_comparewatch_census.nx

buildroot/runtime/nx_comparewatch_census.nx

12953 B263 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_comparewatch_census.nx -- THE /compare DISTANCE-TO-100%, made a one-call sovereign measurement (2026-08-29). Prints total/OPEN/LANDED per the watch plane, per-domain, the zero-gap frontier, and appends one trend row per run. Before this organ the only correct count ever taken was a HAND TALLY. COMPOSES, NEVER RE-IMPLEMENTS: - parsing/versioning rules: nx_comparewatch_lib (pure -- the gate exercises the same code); - plane iteration: nx_seg_store's SEQUENTIAL CURSOR (ss_cur_open/ss_cur_next). The naive whole-plane pass via ss_get point lookups is the documented quadratic read defect -- the seg store's own header measures 10,000 lookups DYING where the cursor survives; one mapping per SEGMENT, not per record. HONEST LIMITS, stated not hidden: - ss_cur_next treats an UNREADABLE segment exactly like an empty one (it moves to the next), so a torn segment silently contributes zero rows AT THE CURSOR LAYER. The compensating witness is the plane's own q:n declared-count row: measured-live != declared -> verdict RED. Books that do not balance are the alarm; this organ cannot name WHICH segment tore. - rows are counted by KEY (last version wins, tombstones excluded); q:n counts what the writer last declared. The regen re-puts the whole plane, so the two agree in health. VERDICT VOCABULARY (closed): GREEN = books balance (live==declared, partition sums, no foreign keys over the bar); RED = the instrument's books do NOT balance -- an accounting alarm, NOT "there are open contracts" (826 open is a normal state, not a failure); UNMEASURABLE(exit 3) = no plane. exit: 0 GREEN | 1 RED | 3 UNMEASURABLE license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_seg_store.nx nx_comparewatch_lib.nx nx_comparewatch_census.nx

imports: nx_syscalls.nxnx_seg_store.nxnx_comparewatch_lib.nx

imported by: nobody (leaf or entry point)

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

main cwc_puts sys_write sys_exit sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ ss_cur_open sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn sys_mmap ↻ ss_cat ss_readall sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_munmap cwc_jrnl sys_openat_append cwc_puts ↻ sys_mmap ↻ cwc_cat cwc_catn sys_mmap ↻ sys_now_realtime_sec

structs

none

consts

29const CWC_PREFIX_DEFAULT: *u8 = "knowledge/store/comparewatch-"
30const CWC_JRNL: *u8 = "knowledge/status/comparewatch_census.log"
32const CWC_MAX_ROWS: i64 = 8192
33const CWC_DOM_W: i64 = 48
34const CWC_MAX_DOMS: i64 = 256
35const CWC_EXIT_RED: i64 = 1
36const CWC_EXIT_UNMEASURABLE: i64 = 3
37const CWC_EXIT_USAGE: i64 = 2

functions

39func cwc_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 3: cwc_numcwc_jrnlmain calls 1: sys_write
40func cwc_num(v: i64) -> i64
called by 1: main calls 3: cwc_putssys_mmapsys_write
53func cwc_cat(b: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { b[p] = s[i]; p = p + 1; i = i + 1 } return p }
called by 1: cwc_jrnl
54func cwc_catn(b: *u8, o: i64, v: i64) -> i64
called by 1: cwc_jrnl calls 1: sys_mmap
66func cwc_streqz(a: *u8, b: *u8) -> i64
called by 1: main
75func cwc_jrnl(rows: i64, open: i64, landed: i64, other: i64, malformed: i64, tomb: i64, foreign: i64, declared: i64, doms: i64, zerogap: i64, verdict: *u8) -> i64
99func main(argc: i64, argv: *i64) -> i64