code wiki / _hdl_build / nx_health_template.nx

nx_health_template.nx

buildroot/runtime/_hdl_build/nx_health_template.nx

3177 B55 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic health
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_health_template.nx nx_health_monitor.nx nx_health_template_gate.nx

imports: nx_syscalls.nx

imported by: nx_health_monitor.nxnx_health_template_gate.nx

structs

none

consts

10const HT_OK: i64 = 0 // 200 + matches the known-good template + no error fingerprint
11const HT_WRONG_STATUS: i64 = 1 // non-200 status
12const HT_ERROR_CONTENT: i64 = 2 // body is an error page despite the status (the operator's "200-but-404" case)
13const HT_MISSING_TEMPLATE: i64 = 3 // body does NOT contain the known-good marker (wrong/blank/placeholder page)

functions

15func htpl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
17func htpl_contains(hay: *u8, n: i64, needle: *u8, nn: i64) -> i64
32func htpl_has_error(body: *u8, n: i64) -> i64
called by 1: htpl_verdict calls 1: htpl_contains
45func htpl_verdict(body: *u8, n: i64, status: i64, expect: *u8, en: i64) -> i64
52func htpl_healthy(body: *u8, n: i64, status: i64, expect: *u8, en: i64) -> i64
called by 1: main calls 1: htpl_verdict