code wiki / (root) / nx_netscope_heal.nx

nx_netscope_heal.nx

buildroot/runtime/nx_netscope_heal.nx

6857 B157 linesdepth 4pulls 5 transitivereach 3 importersview sourcekind librarytopic netscope
docsdependenciesstructsconstsfunctions

about

nx_netscope_heal.nx -- NX-NETSCOPE rung 3: goal-directed SELF-HEALING connectivity agent (DECISION CORE). The north-star payload: a device given a goal ("reach nishifamily.com") auto-selects the BEST reachable resolver/path, switches/fails over, and re-verifies -- without flapping. This is the PURE, DETERMINISTIC decision core (no I/O), isolated so it is KAT-able offline (fault-inject a synthetic probe matrix -> assert the chosen resolver + heal action). The live MAPE-K loop (monitor tick, EXECUTE set-resolver, backoff+jitter sleep, circuit breaker) wraps this next increment. Design grounded (research workflow wf_ca778575) in: - Happy Eyeballs v2/v3 (RFC 8305/8306): RACE candidates, pick best -- but "best" = lowest RTT among CORRECT answers (a fast WRONG answer, NXDOMAIN/SERVFAIL/timeout, never wins over a slower correct one). - MAPE-K autonomic loop (monitor->analyze->plan->execute->verify). - Hysteresis / RTT-banding (RFC 2439 RFD spirit): don't switch for a marginal gain -> no flapping. Reuses nxv_cell + ProbeCell + NXNS_* from the shipped probe/verdict layers; composes nx_dns_probe_matrix_parallel results (no new deps). license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_netscope_verdict.nx nx_netscope_heal.nx nx_netscope_heal_loop.nx nx_netscope_heal_test.nx

imports: nx_netscope_verdict.nx

imported by: nx_netscope_heal_loop.nxnx_netscope_heal_test.nx

structs

40struct HealDecision

consts

26const HEAL_KEEP: i64 = 0
27const HEAL_SWITCH: i64 = 1
28const HEAL_GIVEUP: i64 = 2
30const HEAL_R_HEALTHY: i64 = 0 // incumbent still best -> no change
31const HEAL_R_INCUMBENT_FAILED: i64 = 1 // incumbent no longer correct -> fail over
32const HEAL_R_BETTER_FOUND: i64 = 2 // a meaningfully faster correct resolver
33const HEAL_R_NO_CANDIDATE: i64 = 3 // nothing correct reachable -> give up safely
37const HEAL_BAND_MS: i64 = 20
47const HEAL_DECISION_BYTES: i64 = 40

functions

52func heal_cell_eligible(cell: *ProbeCell, require_private: i64) -> i64
61func heal_select_best(cells: *ProbeCell, ns: i64, nh: i64, col: i64, require_private: i64) -> i64
83func heal_decide(cells: *ProbeCell, ns: i64, nh: i64, col: i64,
136func heal_render(out: *HealDecision, servers: *i64, host_name: *u8, host_len: i64) -> i64
called by 1: main calls 3: nxv_wnxv_ipnxv_dec