nx_statuscensus_lib.nx
buildroot/runtime/nx_statuscensus_lib.nx
about
nx_statuscensus_lib.nx -- TS11 (/compare/trafficsafety): STATUS ANALYTICS + THE NON-EMPTY-200 SLA GAUGE, the LIB.
OPERATOR 2026-09-05: "analytics on our 404s and 503s and all other statuses including undefined, and we
need to make sure we are getting to the point we have 99 percent and above 200 code slas with confirmed
non empty expected delivery." This lib is the ONE classifier; nx_statuscensus (program) runs it over the
live journals and nx_statuscensus_gate drives it over fixtures IN-PROCESS, so the gate and the beat cannot
disagree on a bucket. It EXTENDS the two journals the estate already writes -- no second request log:
EDGE sites_telemetry.log (nx_sites_telemetry.nx, one row per connection, append-only, 489 MB on
2026-09-05, so the census reads a DECLARED TAIL WINDOW, never the whole file):
ts=<us> acc=<L|N> vh=<id> hs=<us> by=<bytes> rc=<0|-N>
vh=71 is the edge's own synthesized 503/504 (backend refused, edge window overrun, outcome-unknown,
deadline), vh=22 is the edge 404, rc<0 is a TLS handshake that never reached HTTP: there IS no
status for that row and it is counted UNDEFINED, never folded into a code. vh=70 is a PROXIED
backend reply: the edge row carries its bytes but NOT its status, so it counts DELIVERED-BY-BYTES
and is ALSO counted on a separate axis edge_proxied_unstatused= (the size of the blind spot); the
owed rung is a st=<code> field on the emitter so a proxied 500 with a body stops reading as a 200.
TOOLS knowledge/status/actlog.jrnl (ta_actlog_x): <ts> TAB mcp TAB <tool> TAB call TAB <status> TAB
tools/call lane=<l> exit=<n> bytes=<n> dur_ms=<n>. lane=async status=started rows are RECEIPTS
(the job's own result lands in _jobs/); a row with exit=0 and bytes>0 is DELIVERED; bytes=0 is EMPTY;
exit!=0 is ERROR even when bytes>0 (an error body is not a delivery).
PARTITIONS SUM (printed as edge_partition_sum= / act_partition_sum=), UNDEFINED is its own bucket, a window
under min_rows reports UNOBSERVED and does not vote, and the SLA permil is DELIVERED over ALL rows -- an empty
200 is not a delivery. Verdict LAST line: GREEN rc 0 / RED rc 1 / UNOBSERVED rc 3.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_statuscensus.nxnx_statuscensus_gate.nx
structs
| none |
consts
| 27 | const SC_CONF_PATH: *u8 = "knowledge/statuscensus.conf" |
| 30 | const SC_WINDOW_DEFAULT: i64 = 8388608 |
| 31 | const SC_SLA_MIN_DEFAULT: i64 = 990 // the operator's bar: 99 percent and above |
| 32 | const SC_MINROWS_DEFAULT: i64 = 100 // below this a window is UNOBSERVED, never a pass |
| 33 | const SC_VH_SYNTH: i64 = 71 // nx_sites_daemon_v2: edge-synthesized 503/504 |
| 34 | const SC_VH_404: i64 = 22 // nx_sites_daemon_v2: edge 404 |
| 35 | const SC_VH_PROXIED: i64 = 70 // nx_sites_daemon_v2: proxied backend reply, status not journaled |
| 36 | const SC_SEEK_SET: i64 = 0 |
| 37 | const SC_SEEK_END: i64 = 2 |
| 38 | const SC_MODE_0644: i64 = 420 |
| 39 | const SC_NUMBUF: i64 = 32 |
| 40 | const SC_TAB: i64 = 9 |
| 41 | const SC_NL: i64 = 10 |
| 42 | const SC_MINUS: i64 = 45 |
| 43 | const SC_HASH: i64 = 35 |
| 44 | const SC_ZERO: i64 = 48 |
| 45 | const SC_NINE: i64 = 57 |
| 191 | const E_TOTAL: i64 = 0 |
| 192 | const E_DELIV: i64 = 1 |
| 193 | const E_EMPTY: i64 = 2 |
| 194 | const E_404: i64 = 3 |
| 195 | const E_SYNTH: i64 = 4 |
| 196 | const E_UNDEF: i64 = 5 |
| 197 | const E_PROXIED: i64 = 6 // SEPARATE AXIS, not a partition member (a proxied row is also DELIVERED or EMPTY) |
| 198 | const E_SLOTS: i64 = 8 |
| 228 | const A_TOTAL: i64 = 0 |
| 229 | const A_DELIV: i64 = 1 |
| 230 | const A_EMPTY: i64 = 2 |
| 231 | const A_ERROR: i64 = 3 |
| 232 | const A_RECEIPT: i64 = 4 |
| 233 | const A_SLOTS: i64 = 8 |
functions
| 47 | func sc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 48 | func sc_fputs(fd: i64, s: *u8) -> i64 { sys_write(fd, s, sc_slen(s)); return 0 } |
| 49 | func sc_fputn(fd: i64, v: i64) -> i64 |
| 62 | func sc_puts(s: *u8) -> i64 { return sc_fputs(1, s) } |
| 63 | func sc_putn(v: i64) -> i64 { return sc_fputn(1, v) } calls 1: sc_fputn |
| 66 | func sc_eol(buf: *u8, i: i64, n: i64) -> i64 |
| 73 | func sc_has(buf: *u8, s: i64, e: i64, key: *u8) -> i64 |
| 86 | func sc_count(buf: *u8, s: i64, e: i64, key: *u8) -> i64 |
| 99 | func sc_find_num(buf: *u8, s: i64, e: i64, key: *u8, out: *i64) -> i64 |
| 129 | func sc_tabwrap(s: *u8) -> *u8 |
| 143 | func sc_read_tail(path: *u8, window: i64, lenbox: *i64) -> *u8 |
| 172 | func sc_conf(key: *u8, dflt: i64, srcbox: *i64) -> i64 |
| 200 | func sc_census_edge(buf: *u8, s0: i64, n: i64, c: *i64) -> i64 |
| 235 | func sc_census_act(buf: *u8, s0: i64, n: i64, c: *i64) -> i64 |
| 257 | func sc_permil(num: i64, den: i64) -> i64 { if den <= 0 { return 0 - 1 } return (num * 1000) / den } called by 1: sc_run |
| 260 | func sc_report(fd: i64, ec: *i64, ac: *i64, window: i64, wsrc: i64, slamin: i64, minrows: i64, elen: i64, alen: i64, everdict: *u8, averdict: *u8, epm: i64, apm: i64, verdict: *u8) -> i64 |
| 287 | func sc_run(telpath: *u8, actpath: *u8, statuspath: *u8, tmppath: *u8, logpath: *u8, window: i64, wsrc: i64, slamin: i64, minrows: i64) -> i64 |