code wiki / _hdl_build / nx_cron_watch.nx
nx_cron_watch.nx
buildroot/runtime/_hdl_build/nx_cron_watch.nx
about
nx_cron_watch.nx -- CRON/AUTOMATION FRESHNESS SUPERVISOR (operator: "prevent things like this...
supervised"; the next silent-failure class after API-contract drift + lib drift = a scheduled job that
SILENTLY STOPS FIRING, e.g. seq22 team_pulse died unnoticed). SOTA = the dead-man's-switch / heartbeat
model (Healthchecks.io "expected period + grace time", Cronitor, Dead Man's Snitch): a job pings on its
schedule; a check-in missed beyond a grace window -> STALE/alert. Sovereign twist: the heartbeat is each
job's own evidence-log `ts=<epoch>` (no external SaaS; evidence-layer native). Data-driven (rule 11):
knowledge/registry/cron_heartbeats.tsv rows name<TAB>heartbeat-file<TAB>ts-marker<TAB>max-age-secs<TAB>remediation.
max-age = expected-interval + grace. age = now - ts. age>max-age -> STALE. missing ts -> STALE (never fired).
nx_cron_watch check [manifest] (JSON: per watch fresh/stale + age + verdict GREEN/STALE-DETECTED)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_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
| 13 | const CW_CAP: i64 = 262144 |
| 14 | const CW_TAB: i64 = 9 |
| 15 | const CW_NL: i64 = 10 |
| 16 | const CW_HASH: i64 = 35 |
| 17 | const CW_STDERR: i64 = 2 |
| 18 | const CW_SPAN: i64 = 16 |
| 19 | const CW_EXIT_USAGE: i64 = 2 |
functions
| 21 | func cw_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(CW_STDERR, s, n); return 0 } |
| 22 | func cw_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 23 | func cw_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o] = s[i]; o = o + 1; i = i + 1 } return o } called by 1: main |
| 24 | func cw_catn(d: *u8, o: i64, v: i64) -> i64 { let t: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { d[o] = 45 as u8; o = o + 1; m = 0 - m } var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { d[o] = t[k-1-i]; o = o + 1; i = i + 1 } return o } |
| 25 | func cw_cat_esc(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 { var i: i64 = s; while i < e { var c: i64 = q[i] as i64; if c == 34 { c = 39 } if c == 92 { c = 47 } if c < 32 { c = 32 } d[o] = c as u8; o = o + 1; i = i + 1 } return o } called by 1: main |
| 33 | func cw_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 45 | func cw_num_after(buf: *u8, n: i64, marker: *u8) -> i64 called by 1: main |
| 75 | func cw_le(q: *u8, i: i64, n: i64) -> i64 { var e: i64 = i; var s: i64 = 1; while s == 1 { if e >= n { s = 0 } else { if q[e] == (CW_NL as u8) { s = 0 } else { e = e + 1 } } } return e } called by 1: main |
| 76 | func cw_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 called by 1: main |
| 92 | func cw_cstr(q: *u8, s: i64, e: i64, dst: *u8) -> i64 { var i: i64 = 0; while s + i < e { dst[i] = q[s+i]; i = i + 1 } dst[i] = 0 as u8; return i } called by 1: main |
| 93 | func cw_atoi_span(q: *u8, s: i64, e: i64) -> i64 { var v: i64 = 0; var i: i64 = s; while i < e { let c: i64 = q[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v } called by 1: main |
| 94 | func main(argc: i64, argv: *i64) -> i64 |