code wiki / (root) / nx_sketch_buglog.nx

nx_sketch_buglog.nx

buildroot/runtime/nx_sketch_buglog.nx

11238 B338 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind sketch/demotopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_buglog.nx -- 5W+H+GLP provenance ledger primitive. NOT JUST FOR BUGS. This is the general provenance-emit primitive every tool / sketch / capability uses to declare itself. The "bug log" is just one filtered view (kind=BUG) of a broader ledger that also holds: kind = CAPABILITY -- primitive declares what it does kind = BUG -- something failed; root-cause + fix kind = IMPROVEMENT_OPP -- lineage step exists but unshipped (e.g., heule_bias_table is on sketch_hll's lineage but the table isn't in code yet) kind = CROSS_REF -- primitive A composes against B G (Genealogy) and L (Lineage) are stored as arrays of SHORT IDs that reference docs/genealogy.md and docs/lineage.md. Lightweight entries, full provenance, joinable for tree views. SCHEMA (10 fields): kind entry type (sealed enum below) W Who primitive name W What workload / scenario / capability description W When ISO timestamp + commit hash W Where sealed axis enum (accuracy/memory/time/capability/usability) W Why root cause (for bugs) / motivation (for capabilities) H How repro + fix (bugs) / usage example (capabilities) G genealogy_ids IDs into docs/genealogy.md L lineage_ids IDs into docs/lineage.md (TODO items here = improvement opportunities a human or AI can pick up directly) P performance JSON object of measured metrics All callers append to _offc/provenance.jsonl (one JSON line per entry). Bug-table is just `grep '"kind":"BUG"' _offc/provenance.jsonl`.

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_sketch_types.nx nx_sketch_buglog.nx nx_sketch_hll_provenance.nx nx_sketch_hll_provenance_v2.nx

imports: nx_syscalls.nxnx_sketch_types.nx

imported by: nx_sketch_hll_provenance.nxnx_sketch_hll_provenance_v2.nx

structs

59struct StrSlice
64struct BugLog

consts

43const NX_MAGIC_1000000000: i64 = 1000000000
45const NX_PROV_KIND_BUG: i64 = 0
46const NX_PROV_KIND_CAPABILITY: i64 = 1
47const NX_PROV_KIND_IMPROVEMENT_OPP: i64 = 2
48const NX_PROV_KIND_CROSS_REF: i64 = 3
50const NX_BUG_AXIS_ACCURACY: i64 = 0
51const NX_BUG_AXIS_MEMORY: i64 = 1
52const NX_BUG_AXIS_TIME: i64 = 2
53const NX_BUG_AXIS_CAPABILITY: i64 = 3
54const NX_BUG_AXIS_USABILITY: i64 = 4
56const NX_BUG_MAX_GENEALOGY: i64 = 64
57const NX_BUG_MAX_LINEAGE: i64 = 64

functions

85func nx_buglog_slen(s: *u8) -> i64
91func nx_buglog_alloc() -> *BugLog
called by 2: mainmain calls 1: sys_mmap
119func nx_buglog_slice_at(arr: *StrSlice, i: i64) -> *StrSlice
125func nx_buglog_set_kind(e: *BugLog, kind: i64) -> i64
called by 2: mainmain
132func nx_buglog_kind_str(kind: i64) -> *u8
called by 1: nx_buglog_emit
140func nx_buglog_kind_strlen(kind: i64) -> i64
called by 1: nx_buglog_emit
148func nx_buglog_set_who(e: *BugLog, s: *u8, len: i64) -> i64
called by 1: nx_buglog_set_who_z
154func nx_buglog_set_what(e: *BugLog, s: *u8, len: i64) -> i64
160func nx_buglog_set_when(e: *BugLog, s: *u8, len: i64) -> i64
166func nx_buglog_set_axis(e: *BugLog, axis: i64) -> i64
called by 2: mainmain
173func nx_buglog_set_why(e: *BugLog, s: *u8, len: i64) -> i64
called by 1: nx_buglog_set_why_z
179func nx_buglog_set_how(e: *BugLog, s: *u8, len: i64) -> i64
called by 1: nx_buglog_set_how_z
185func nx_buglog_set_performance(e: *BugLog, s: *u8, len: i64) -> i64
191func nx_buglog_add_genealogy(e: *BugLog, s: *u8, len: i64) -> i64
200func nx_buglog_add_lineage(e: *BugLog, s: *u8, len: i64) -> i64
211func nx_buglog_set_who_z(e: *BugLog, s: *u8) -> i64
214func nx_buglog_set_what_z(e: *BugLog, s: *u8) -> i64
217func nx_buglog_set_when_z(e: *BugLog, s: *u8) -> i64
220func nx_buglog_set_why_z(e: *BugLog, s: *u8) -> i64
223func nx_buglog_set_how_z(e: *BugLog, s: *u8) -> i64
226func nx_buglog_set_performance_z(e: *BugLog, s: *u8) -> i64
229func nx_buglog_add_genealogy_z(e: *BugLog, s: *u8) -> i64
232func nx_buglog_add_lineage_z(e: *BugLog, s: *u8) -> i64
238func nx_buglog_axis_str(axis: i64) -> *u8
called by 1: nx_buglog_emit
247func nx_buglog_axis_strlen(axis: i64) -> i64
called by 1: nx_buglog_emit
258func nx_buglog_w(s: *u8, len: i64) -> i64
263func nx_buglog_emit_field(name: *u8, name_len: i64,
called by 1: nx_buglog_emit calls 1: nx_buglog_w
275func nx_buglog_emit_id_array(name: *u8, name_len: i64,
295func nx_buglog_emit_raw_json(name: *u8, name_len: i64,
called by 1: nx_buglog_emit calls 1: nx_buglog_w
307func nx_buglog_emit(e: *BugLog) -> i64
327func nx_buglog_query(e: *BugLog) -> *ApproxI64
calls 1: nx_approx_new
333func nx_buglog_n_genealogy(e: *BugLog) -> i64 { return e.n_genealogy }
334func nx_buglog_n_lineage(e: *BugLog) -> i64 { return e.n_lineage }
336func nx_buglog_memory_bytes(e: *BugLog) -> i64