code wiki / _hdl_build / nx_health_template.nx
nx_health_template.nx
buildroot/runtime/_hdl_build/nx_health_template.nx
about
nx_health_template.nx -- CONTENT-AWARE health verdict (operator 2026-06-29: "it also needs to check against
KNOWN-GOOD TEMPLATES -- a 404 being 'up' with a 200 status is wrong"). HTTP 200 is NOT enough: an error/404
page served WITH a 200 status, or a wrong/blank page, is a FALSE-GREEN -- exactly what the operator hates.
This validates the actual response BODY against (a) a KNOWN-GOOD template MARKER the page MUST contain, and
(b) a built-in set of error-page fingerprints it must NOT contain. So "200 + 404-content" is correctly DOWN.
PURE transform htpl_verdict(body,n,status,expect,en) -> code (independently gateable; the IO/data layers wire
the fetch). The known-good marker per URL is data-driven (health_templates.conf). license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_health_monitor.nxnx_health_template_gate.nx
structs
| none |
consts
| 10 | const HT_OK: i64 = 0 // 200 + matches the known-good template + no error fingerprint |
| 11 | const HT_WRONG_STATUS: i64 = 1 // non-200 status |
| 12 | const HT_ERROR_CONTENT: i64 = 2 // body is an error page despite the status (the operator's "200-but-404" case) |
| 13 | const HT_MISSING_TEMPLATE: i64 = 3 // body does NOT contain the known-good marker (wrong/blank/placeholder page) |
functions
| 15 | func htpl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 17 | func htpl_contains(hay: *u8, n: i64, needle: *u8, nn: i64) -> i64 |
| 32 | func htpl_has_error(body: *u8, n: i64) -> i64 |
| 45 | func htpl_verdict(body: *u8, n: i64, status: i64, expect: *u8, en: i64) -> i64 |
| 52 | func htpl_healthy(body: *u8, n: i64, status: i64, expect: *u8, en: i64) -> i64 |