code wiki / _hdl_build / nx_edge_watchdog.nx
nx_edge_watchdog.nx
buildroot/runtime/_hdl_build/nx_edge_watchdog.nx
about
nx_edge_watchdog.nx -- OFF-BOX LIVENESS WATCHDOG for the family's public surfaces (F620).
BORN FROM THE 2026-07-20 NAS OUTAGE: every monitor we had (vqoe gate, cron-watch, deploy-ready,
reconciler, supervisor, self-heal) runs ON THE NAS -- so when the NAS died, the monitoring died WITH it
and NOTHING alerted; the outage was noticed only because a human's tool calls started timing out.
★LAW: a monitor that shares a failure domain with its subject is not a monitor.
This organ therefore runs on the LAPTOP (or any host that is not the NAS) and probes the PUBLIC edge
exactly as a family member's browser would -- WAN-side, no LAN shortcuts, no NAS-side dependency.
CONTRACT (data-driven, rule 11): targets live in a conf, one per line "<label> <https-url> <needle>".
A target is UP iff the fetch returns 200 AND the body contains <needle> (content proof, not port-open --
the "wedged but alive" class the recovery doctrine calls out). State is a tiny append-only log plus a
LATCHED alert file that a human/automation can watch; consecutive failures must reach `fail_min` before
alerting, so one flaky fetch never cries wolf, and recovery CLEARS the latch with an explicit RECOVERED
line (an alert that cannot clear itself is noise).
usage: nx_edge_watchdog [conf] [statelog] [alertfile]
defaults: knowledge/registry/edge_watch.conf · knowledge/status/edge_watch.log · knowledge/status/EDGE_ALERT
exit: 0 all UP · 1 one or more DOWN (so a scheduler/pulse can branch on it)
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_url_connect.nxnx_https_fetch_follow.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
| 24 | const EW_MAGIC_4194304: i64 = 4194304 |
| 25 | const EW_MAGIC_2048: i64 = 2048 |
| 26 | const EW_MAGIC_65536: i64 = 65536 |
| 27 | const EW_MAGIC_4096: i64 = 4096 |
| 29 | const EW_CAP: i64 = 262144 // per-probe body cap (a liveness needle never needs more) |
| 30 | const EW_CONF_CAP: i64 = 16384 |
| 31 | const EW_MAXT: i64 = 16 // DECLARED envelope: at most 16 targets per run |
| 32 | const EW_FAILMIN: i64 = 2 // consecutive failures before the latch trips |
functions
| 34 | func ew_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 35 | func ew_cat(dst: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 40 | func ew_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 52 | func ew_contains(b: *u8, n: i64, needle: *u8) -> i64 called by 1: main |
| 70 | func ew_tok(cb: *u8, p0: i64, e: i64, out: *u8) -> i64 called by 1: main |
| 95 | func main(argc: i64, argv: *i64) -> i64 |