code wiki / (root) / nx_verdictlog_lib.nx

nx_verdictlog_lib.nx

buildroot/runtime/nx_verdictlog_lib.nx

67154 B1480 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_verdictlog_lib.nx -- THE VERDICT-LOG RULER: read a detector's own recorded verdicts and say what its output is worth. FM3 and FM4 of /compare/failmodes, and ONE ruler for both because both ask the same primitive question of the same artifacts: WHAT VERDICT DID THIS DETECTOR EMIT, AND WHEN. FM3 reads one stream through time (is this detector's output informative). FM4 reads two streams of the same subject side by side (do two vantages agree). Splitting the parser between them would be the duplicate-ruler defect, and the census and its gate would then be free to disagree about what a verdict IS. --------------------------------------------------------------------------------------------- FM3 -- THE ACCEPT RULE, QUOTED VERBATIM FROM failmodes.plan BEFORE THE WORK BEGAN: "run it over the EXISTING detector fleet and publish the four numbers per detector; the rung is accepted only if at least one currently-shipping detector is shown to score badly enough to justify changing or retiring it. A scorer that flatters every incumbent has measured nothing." THE FOUR NUMBERS ARE SRE'S -- precision, recall, detection time, reset time -- and EACH IS THREE-STATE. That is not a softening of the rule, it is the only honest way to publish it, and the reason is measured rather than assumed: A VERDICT LOG RECORDS WHAT THE DETECTOR SAID AND NEVER WHETHER IT WAS RIGHT. Nothing in this estate joins a detector's firing to an adjudication, so a precision figure computed from these files would be a CONSTANT WEARING THE SHAPE OF A MEASUREMENT. Each axis therefore carries either a value or a NAMED abstention: precision UNINFORMATIVE-CONSTANT the output never varies, so it carries no information and its precision equals the base rate. This is an EXACT statement, not an estimate. UNOBSERVABLE-NO-ADJUDICATION otherwise: nothing joins a firing to a truth. recall UNVERIFIED-NEVER-FIRED the detector has produced no positive in its whole recorded history, so nothing has demonstrated it CAN fire. A green that never had a corresponding red is unverified. UNOBSERVABLE-NO-GROUND-TRUTH otherwise: a missed event leaves no trace here. detect_bound_s <n> the largest observed interval between consecutive runs. A BOUND, and labelled one: a condition that becomes visible just after a run waits at most this long to be seen. UNOBSERVABLE-NO-TIMESTAMP the stream carries no declared timestamp key. reset <n> the largest observed number of runs from a non-green to the next green. LATCHED the trailing non-green episode never returns to

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_gatekit_lib.nx nx_verdictlog_lib.nx nx_failclass.nx nx_verdictlog_gate.nx

imports: nx_syscalls.nxnx_gatekit_lib.nx

imported by: nx_failclass.nxnx_verdictlog_gate.nx

structs

none

consts

87const VL_TAB: i64 = 9
88const VL_NL: i64 = 10
89const VL_QUOTE: i64 = 34
90const VL_HASH: i64 = 35
91const VL_MINUS: i64 = 45
92const VL_DOT: i64 = 46
93const VL_ZERO: i64 = 48
94const VL_NINE: i64 = 57
95const VL_SEMI: i64 = 59
96const VL_UC_A: i64 = 65
97const VL_UC_Z: i64 = 90
98const VL_USCORE: i64 = 95
99const VL_LC_A: i64 = 97
100const VL_LC_Z: i64 = 122
101const VL_BAR: i64 = 124
102const VL_CASEGAP: i64 = 32
103const VL_B10: i64 = 10
104const VL_MODE_0644: i64 = 420
105const VL_NUMBUF: i64 = 32
106const VL_SMALL: i64 = 16
107const VL_PATHBUF: i64 = 4096
108const VL_DENTBUF: i64 = 65536
109const VL_DT_DIR: i64 = 4
110const VL_DENT_RECLEN_OFF: i64 = 16
111const VL_DENT_TYPE_OFF: i64 = 18
112const VL_DENT_NAME_OFF: i64 = 19
113const VL_BYTE_SHIFT: i64 = 8
117const VL_SYS_GETDENTS64: i64 = 217
122const VL_VAN_SUBJ_OFF: i64 = 0
123const VL_VAN_SUBJ_LEN: i64 = 1
124const VL_VAN_A_OFF: i64 = 2
125const VL_VAN_A_LEN: i64 = 3
126const VL_VAN_B_OFF: i64 = 4
127const VL_VAN_B_LEN: i64 = 5
128const VL_VAN_WIN: i64 = 6
131const VL_GREEN: i64 = 0
132const VL_RED: i64 = 1
133const VL_ABSTAIN: i64 = 2
134const VL_UNKWORD: i64 = 3 // a verdict key was present and its word is not declared vocabulary
135const VL_NOVERDICT: i64 = 4 // the line carries no verdict key at all
138const VL_MAXVOC: i64 = 256
139const VL_MAXVAN: i64 = 64
140const VL_VANSLOTS: i64 = 7
142const VL_C_NVKEY: i64 = 0
143const VL_C_NTSKEY: i64 = 1
144const VL_C_NGREEN: i64 = 2
145const VL_C_NRED: i64 = 3
146const VL_C_NABST: i64 = 4
147const VL_C_NEXT: i64 = 5
148const VL_C_NVAN: i64 = 6
149const VL_C_REJECT: i64 = 7
150const VL_C_OVER: i64 = 8
151const VL_C_MINRUNS: i64 = 9
152const VL_C_MAXFILES: i64 = 10
153const VL_C_STRIDE: i64 = 11
155const VL_C_VKBASE: i64 = 32
156const VL_C_TSBASE: i64 = 544
157const VL_C_GRBASE: i64 = 1056
158const VL_C_RDBASE: i64 = 1568
159const VL_C_ABBASE: i64 = 2080
160const VL_C_EXBASE: i64 = 2592
161const VL_C_VANBASE: i64 = 3104
162const VL_C_LEN: i64 = 3584
165const VL_R_RUNS: i64 = 0
166const VL_R_GREEN: i64 = 1
167const VL_R_RED: i64 = 2
168const VL_R_ABST: i64 = 3
169const VL_R_UNK: i64 = 4
170const VL_R_TSRUNS: i64 = 5
171const VL_R_TSFIRST: i64 = 6
172const VL_R_TSLAST: i64 = 7
173const VL_R_MAXGAP: i64 = 8
174const VL_R_EPISODES: i64 = 9
175const VL_R_MAXRESET: i64 = 10
176const VL_R_LATCHED: i64 = 11
177const VL_R_LASTSTATE: i64 = 12
178const VL_R_LASTTS: i64 = 13
179const VL_R_BYTES: i64 = 14
180const VL_R_NONMONO: i64 = 15
181const VL_R_UNKOFF: i64 = 16 // offset of the first undeclared verdict word, into the file buffer
182const VL_R_UNKLEN: i64 = 17
183const VL_R_LEN: i64 = 20
186const VL_B_SCORED: i64 = 0 // has both green and non-green runs: the output varies
187const VL_B_CONSTNG: i64 = 1 // every run non-green: never once green -- OFFENDER
188const VL_B_CONSTGR: i64 = 2 // every run green: never fired, so its recall is unverified
189const VL_B_UNKVOCAB: i64 = 3 // speaks a verdict dialect this ruler cannot read
190const VL_B_SNAPSHOT: i64 = 4 // one run: a level cannot express a trajectory
191const VL_B_NOVERDICT: i64 = 5 // carries no verdict vocabulary at all
192const VL_B_UNREADABLE: i64 = 6
193const VL_NBUCKET: i64 = 7
196const VL_T_FILES: i64 = 0
197const VL_T_SKIPPED: i64 = 1
198const VL_T_BYTES: i64 = 2
199const VL_T_BUCKET0: i64 = 3 // .. VL_T_BUCKET0 + VL_NBUCKET - 1
200const VL_T_LATCHED: i64 = 10 // a SEPARATE AXIS, deliberately not a partition member
201const VL_T_OFFEND: i64 = 11
202const VL_T_HIST0: i64 = 12 // .. VL_T_HIST0 + VL_NHIST - 1
203const VL_NHIST: i64 = 11
204const VL_T_LEN: i64 = 32
207const VL_V_AGREE: i64 = 0
208const VL_V_DISAGREE: i64 = 1
209const VL_V_U_AMISS: i64 = 2
210const VL_V_U_BMISS: i64 = 3
211const VL_V_U_ANOOBS: i64 = 4
212const VL_V_U_BNOOBS: i64 = 5
213const VL_V_U_WINDOW: i64 = 6
214const VL_V_U_ABSTAIN: i64 = 7
215const VL_NVOUT: i64 = 8
217const VL_RATCHET_ALLOW: i64 = 0
218const VL_RATCHET_REFUSE: i64 = 1
219const VL_RATCHET_UNMEAS: i64 = 3
221const VL_FNV_OFFSET: i64 = 2166136261
222const VL_FNV_PRIME: i64 = 16777619
223const VL_FNV_MASK32: i64 = 4294967295
224const VL_HASH_LOAD: i64 = 4

functions

229func vl_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
230func vl_err(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
called by 1: vl_conf_load calls 1: sys_write
232func vl_putn(v: i64) -> i64
250func vl_nl() -> i64
258func vl_lower(c: i64) -> i64
called by 2: vl_ci_eqvl_ci_find
265func vl_is_alpha(c: i64) -> i64
called by 1: vl_wordch
271func vl_wordch(c: i64) -> i64
called by 1: vl_line_state calls 1: vl_is_alpha
278func vl_find_byte(buf: *u8, s: i64, e: i64, b: i64) -> i64
288func vl_range_eq(buf: *u8, s: i64, e: i64, lit: *u8) -> i64
300func vl_ci_eq(buf: *u8, s: i64, e: i64, conf: *u8, off: i64, len: i64) -> i64
called by 2: vl_tok_invl_hasext calls 1: vl_lower
311func vl_ci_find(buf: *u8, s: i64, e: i64, conf: *u8, off: i64, len: i64) -> i64
called by 1: vl_key_at calls 1: vl_lower
328func vl_atoi(buf: *u8, s: i64, e: i64) -> i64
343func vl_fnv_buf(buf: *u8, n: i64) -> i64
called by 1: vl_fnv_file
357func vl_fnv_file(path: *u8) -> i64
368func vl_take(conf: *u8, voc: *i64, cnt_slot: i64, base: i64, s: i64, e: i64) -> i64
called by 1: vl_conf_load
377func vl_conf_load(confp: *u8, clen: *i64, voc: *i64) -> *u8
499func vl_key_at(conf: *u8, voc: *i64, base: i64, n: i64, buf: *u8, s: i64, e: i64, klen: *i64) -> i64
called by 2: vl_line_statevl_line_ts calls 1: vl_ci_find
519func vl_tok_in(conf: *u8, voc: *i64, base: i64, n: i64, buf: *u8, s: i64, e: i64) -> i64
called by 1: vl_line_state calls 1: vl_ci_eq
530func vl_line_state(conf: *u8, voc: *i64, buf: *u8, s: i64, e: i64, span: *i64) -> i64
555func vl_line_ts(conf: *u8, voc: *i64, buf: *u8, s: i64, e: i64) -> i64
580func vl_series_reset(sr: *i64) -> i64
called by 1: vl_series
594func vl_series(path: *u8, conf: *u8, voc: *i64, sr: *i64) -> *u8
666func vl_bucket(sr: *i64, minruns: i64) -> i64
called by 2: mainvl_alert_scan
675func vl_bucket_name(b: i64) -> *u8
685func vl_bucket_id(buf: *u8, s: i64, e: i64) -> i64
705func vl_is_offender(bucket: i64, latched: i64) -> i64
716func vl_latched(sr: *i64, minruns: i64) -> i64
called by 2: mainvl_alert_scan
739func vl_unscored(bucket: i64) -> *u8
747func vl_precision(bucket: i64) -> *u8
called by 2: mainvl_emit_row calls 1: vl_unscored
755func vl_recall(bucket: i64, sr: *i64) -> *u8
called by 2: mainvl_emit_row calls 1: vl_unscored
765func vl_hasext(name: *u8, conf: *u8, voc: *i64) -> i64
called by 1: vl_dirscan calls 2: gk_lenvl_ci_eq
792func vl_dirscan(dir: *u8, conf: *u8, voc: *i64, names: *u8, stride: i64, cap: i64) -> i64
841func vl_dircount(dir: *u8) -> i64
867func vl_row(out: *u8, oo: *i64, cap: i64, s: *u8) -> i64
878func vl_rown(out: *u8, oo: *i64, cap: i64, v: i64) -> i64
897func vl_rowb(out: *u8, oo: *i64, cap: i64, src: *u8, s: i64, e: i64) -> i64
908func vl_rowtab(out: *u8, oo: *i64, cap: i64) -> i64
913func vl_rownl(out: *u8, oo: *i64, cap: i64) -> i64
922func vl_emit_row(out: *u8, oo: *i64, cap: i64, path: *u8, sr: *i64, bucket: i64, fbuf: *u8, latched: i64) -> i64
961func vl_bucket_sum(tot: *i64) -> i64
called by 1: main
968func vl_bucket_distinct(tot: *i64) -> i64
called by 1: main
981func vl_hist_distinct(tot: *i64) -> i64
called by 1: main
991func vl_hist_bin(sr: *i64) -> i64
called by 1: vl_alert_scan
1000func vl_alert_report(tot: *i64, voc: *i64, dirp: *u8, outp: *u8, wrote: i64) -> i64
1047func vl_alert_scan(confp: *u8, dirp: *u8, outp: *u8, tot: *i64) -> i64
1118func vl_row_name(buf: *u8, s: i64, e: i64, span: *i64) -> i64
1133func vl_name_hash(buf: *u8, s: i64, e: i64) -> i64
1144func vl_name_eq(a: *u8, as0: i64, ae: i64, b: *u8, bs: i64, be: i64) -> i64
1154func vl_name_index(bl: *u8, blen: i64, hs: *i64, he: *i64, hcap: i64) -> i64
1178func vl_name_in(bl: *u8, hs: *i64, he: *i64, hcap: i64, needle: *u8, ns: i64, ne: i64) -> i64
1191func vl_write_set(path: *u8, wl: *u8, cs: *i64, ce: *i64, n: i64) -> i64
1207func vl_alert_ratchet(worklistp: *u8, baselinep: *u8) -> i64
1303func vl_last_obs(path: *u8, conf: *u8, voc: *i64, obs: *i64) -> i64
1331func vl_vout_name(v: i64) -> *u8
called by 1: vl_vantage_scan
1342func vl_state_name(s: i64) -> *u8
called by 1: vl_vantage_scan
1353func vl_vantage_cmp(ra: i64, rb: i64, oa: *i64, ob: *i64, window: i64) -> i64
called by 1: vl_vantage_scan
1369func vl_vantage_scan(confp: *u8, outp: *u8, res: *i64) -> i64