code wiki / _hdl_build / nx_battery_grade.nx

nx_battery_grade.nx

buildroot/runtime/_hdl_build/nx_battery_grade.nx

6908 B174 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic battery
docsdependenciesstructsconstsfunctions

about

nx_battery_grade.nx -- THE UNIVERSAL ANSWER-KEY JUDGE, Nishi first byte up (operator oracle-only law). One generic grader for every key-scored battery on the model card: F786 reasoning/chat MCQ, F788 agentic tool-choice, F789 factuality QA. A SEAT or ORACLE only ever writes answer rows; THIS organ owns the join, the contract and the score -- so a graded number can never be self-asserted by the thing being measured. key plane row : id<TAB>expected<TAB>[note] (the answer key) answer plane row : id<TAB>given<TAB>[epoch]<TAB>[actor] (seat/oracle-written via nx_store_put; id-replace = dedup at the store layer) contract: exact string match on col1; UNANSWERED COUNTS AS WRONG (coverage cannot inflate the score); zero answer rows -> verdict=UNMEASURED (fabrication has no code path); empty key -> verdict=RED fail-loud. score_pct = correct*100/total-keys. Atomic publish to <outpath>. nx_battery_grade <keyprefix> <ansprefix> <outpath> expect_exit: 0 (GREEN|UNMEASURED) | 1 RED | 2 usage license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_store_seed_lib.nx nx_seg_store.nx nx_syscalls.nx nx_battery_grade.nx

imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main kg_werr sys_write kg_slen sys_exit sys_mmap sts_load ss_open_cached ssc_init sys_mmap ↻ ssc_sig_of ss_cat sys_fstatat ssc_streq ss_open ss_open2 sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_cat ↻ ss_loadfile sys_map_file ss_readall ss_load_aux2 sys_mmap ↻ ss_cat ↻ ss_loadfile ↻ ss_r32 sys_munmap ssl_total_keys ss_r32 ↻ ssl_pow2 ssl_build ss_r32 ↻ ssl_hash_entry ssl_key_eq ss_r32 ↻ ssl_lookup ssl_hash_entry ↻ ssl_key_eq ↻

structs

none

consts

22const KG_CAP: i64 = 1048576
23const KG_OCAP: i64 = 8192
24const KG_PATHCAP: i64 = 256
25const KG_TAB: i64 = 9
26const KG_NL: i64 = 10
27const KG_STDERR: i64 = 2
28const KG_MODE: i64 = 0x1a4
29const KG_D0: i64 = 48
30const KG_B10: i64 = 10
31const KG_NUMB: i64 = 24
32const KG_EXIT_RED: i64 = 1
33const KG_EXIT_USAGE: i64 = 2

functions

35func kg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: kg_werr
36func kg_werr(s: *u8) -> i64 { sys_write(KG_STDERR, s, kg_slen(s)); return 0 }
called by 1: main calls 2: sys_writekg_slen
37func kg_cat(d: *u8, off: i64, s: *u8) -> i64
called by 1: main
43func kg_catn(d: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
56func kg_eol(buf: *u8, n: i64, i: i64) -> i64
called by 2: kg_lookupmain
63func kg_eof(buf: *u8, le: i64, i: i64) -> i64
called by 2: kg_lookupmain
69func kg_slice_eq(a: *u8, as1: i64, ae: i64, b: *u8, bs: i64, be: i64) -> i64
called by 2: kg_lookupmain
78func kg_lookup(ab: *u8, an: i64, kb: *u8, ida: i64, idb: i64) -> i64
called by 1: main calls 3: kg_eolkg_eofkg_slice_eq
99func main(argc: i64, argv: *i64) -> i64