code wiki / _hdl_build / nx_gate_verdict_lib.nx
nx_gate_verdict_lib.nx
buildroot/runtime/_hdl_build/nx_gate_verdict_lib.nx
about
nx_gate_verdict_lib.nx -- the SHARED reader for "what does this gate log say?". NO main() ON PURPOSE.
WHY A MODULE AND NOT A NOTE: nx_gate_rollup.nx owns a main(), so its gr_slurp/gr_last_line cannot be
imported by a second entry point -- the same structural trap nx_gatelib's own header documents for
egb_walk/tr_walk ("that is why it kept being copied rather than shared -- a structural reason, not an
oversight, and the fix is a module with no main() rather than a note promising to do it later").
This is that module. New readers import it instead of copying; nx_gate_rollup folds into it next.
THE VERDICT CONTRACT, in one place so it cannot drift again: a gate log's NEWEST non-empty line
carries the anchor. The ecosystem emits BOTH cases -- knowledge/status/deploy_ready.log,
fin_spine_gate.log, coordination_gate.log and pm_dashboard_gate.log use uppercase VERDICT=, while
rv64_runproof_gate.log and friends use lowercase verdict=. nx_gate_rollup matched lowercase ONLY,
which made every uppercase gate read RED the instant it was registered. Case is a spelling detail,
not a verdict; both are accepted here so no future reader has to rediscover that.
FAIL-CLOSED: missing / empty / no-anchor is GV_NONE, never GREEN. "I could not tell" must never read
as "fine" -- that is the failure mode the gate plane exists to remove.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_gate_rollup.nxnx_gatereg_derive.nx
structs
| none |
consts
| 20 | const GV_MAGIC_86400: i64 = 86400 |
| 22 | const GV_LOGCAP: i64 = 262144 |
| 23 | const GV_LINECAP: i64 = 4096 |
| 26 | const GV_NONE: i64 = 0 |
| 27 | const GV_GREEN: i64 = 1 |
| 28 | const GV_RED: i64 = 2 |
| 116 | const GV_STATBUF: i64 = 256 |
| 117 | const GV_STAT_MTIME_OFF: i64 = 88 |
functions
| 30 | func gv_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 33 | func gv_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 48 | func gv_last_line(buf: *u8, n: i64, out: *u8, cap: i64) -> i64 |
| 75 | func gv_contains(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 91 | func gv_has_anchor(line: *u8, n: i64) -> i64 |
| 103 | func gv_is_pass(line: *u8, n: i64) -> i64 |
| 119 | func gv_mtime(path: *u8) -> i64 |
| 133 | func gv_age_days(path: *u8, now: i64) -> i64 |
| 141 | func gv_classify(path: *u8, buf: *u8, line: *u8) -> i64 |