code wiki / _hdl_build / nx_edge_watchdog.nx

nx_edge_watchdog.nx

buildroot/runtime/_hdl_build/nx_edge_watchdog.nx

9887 B220 linesdepth 21pulls 146 transitivereach 0 importersview sourcekind tooltopic edge
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_url_connect.nx nx_https_fetch_follow.nx nx_edge_watchdog.nx

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

main sys_mmap sys_clock_gettime_real nx_trust_store_load_from_c sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id

structs

none

consts

24const EW_MAGIC_4194304: i64 = 4194304
25const EW_MAGIC_2048: i64 = 2048
26const EW_MAGIC_65536: i64 = 65536
27const EW_MAGIC_4096: i64 = 4096
29const EW_CAP: i64 = 262144 // per-probe body cap (a liveness needle never needs more)
30const EW_CONF_CAP: i64 = 16384
31const EW_MAXT: i64 = 16 // DECLARED envelope: at most 16 targets per run
32const EW_FAILMIN: i64 = 2 // consecutive failures before the latch trips

functions

34func 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 }
called by 1: main calls 1: sys_write
35func ew_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: main
40func ew_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
52func ew_contains(b: *u8, n: i64, needle: *u8) -> i64
called by 1: main
70func ew_tok(cb: *u8, p0: i64, e: i64, out: *u8) -> i64
called by 1: main
95func main(argc: i64, argv: *i64) -> i64