nx_comparewatch_census.nx
buildroot/runtime/nx_comparewatch_census.nx
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
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
structs
| none |
consts
| 29 | const CWC_PREFIX_DEFAULT: *u8 = "knowledge/store/comparewatch-" |
| 30 | const CWC_JRNL: *u8 = "knowledge/status/comparewatch_census.log" |
| 32 | const CWC_MAX_ROWS: i64 = 8192 |
| 33 | const CWC_DOM_W: i64 = 48 |
| 34 | const CWC_MAX_DOMS: i64 = 256 |
| 35 | const CWC_EXIT_RED: i64 = 1 |
| 36 | const CWC_EXIT_UNMEASURABLE: i64 = 3 |
| 37 | const CWC_EXIT_USAGE: i64 = 2 |
functions
| 39 | func 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 } |
| 40 | func cwc_num(v: i64) -> i64 |
| 53 | func 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 |
| 54 | func cwc_catn(b: *u8, o: i64, v: i64) -> i64 |
| 66 | func cwc_streqz(a: *u8, b: *u8) -> i64 called by 1: main |
| 75 | func 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 |
| 99 | func main(argc: i64, argv: *i64) -> i64 |