code wiki / (root) / sketch_buglog.nx

sketch_buglog.nx

buildroot/runtime/sketch_buglog.nx

11259 B331 linesdepth 4pulls 4 transitivereach 3 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 · 3 importers

syscalls.nx sketch_types.nx sketch_buglog.nx sketch_buglog_test.nx sketch_hll_provenance.nx sketch_hll_provenance_v2.nx

imports: syscalls.nxsketch_types.nx

imported by: sketch_buglog_test.nxsketch_hll_provenance.nxsketch_hll_provenance_v2.nx

structs

52struct StrSlice {
57struct BugLog {

consts

38const NX_PROV_KIND_BUG: i64 = 0
39const NX_PROV_KIND_CAPABILITY: i64 = 1
40const NX_PROV_KIND_IMPROVEMENT_OPP: i64 = 2
41const NX_PROV_KIND_CROSS_REF: i64 = 3
43const NX_BUG_AXIS_ACCURACY: i64 = 0
44const NX_BUG_AXIS_MEMORY: i64 = 1
45const NX_BUG_AXIS_TIME: i64 = 2
46const NX_BUG_AXIS_CAPABILITY: i64 = 3
47const NX_BUG_AXIS_USABILITY: i64 = 4
49const NX_BUG_MAX_GENEALOGY: i64 = 64
50const NX_BUG_MAX_LINEAGE: i64 = 64

functions

78func nx_buglog_slen(s: *u8) -> i64 {
84func nx_buglog_alloc() -> *BugLog {
called by 3: mainmainmain
112func nx_buglog_slice_at(arr: *StrSlice, i: i64) -> *StrSlice {
118func nx_buglog_set_kind(e: *BugLog, kind: i64) -> i64 {
called by 2: mainmain
125func nx_buglog_kind_str(kind: i64) -> *u8 {
called by 1: nx_buglog_emit
133func nx_buglog_kind_strlen(kind: i64) -> i64 {
called by 1: nx_buglog_emit
141func nx_buglog_set_who(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_who_z
147func nx_buglog_set_what(e: *BugLog, s: *u8, len: i64) -> i64 {
153func nx_buglog_set_when(e: *BugLog, s: *u8, len: i64) -> i64 {
159func nx_buglog_set_axis(e: *BugLog, axis: i64) -> i64 {
called by 3: mainmainmain
166func nx_buglog_set_why(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_why_z
172func nx_buglog_set_how(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_how_z
178func nx_buglog_set_performance(e: *BugLog, s: *u8, len: i64) -> i64 {
184func nx_buglog_add_genealogy(e: *BugLog, s: *u8, len: i64) -> i64 {
193func nx_buglog_add_lineage(e: *BugLog, s: *u8, len: i64) -> i64 {
204func nx_buglog_set_who_z(e: *BugLog, s: *u8) -> i64 {
207func nx_buglog_set_what_z(e: *BugLog, s: *u8) -> i64 {
210func nx_buglog_set_when_z(e: *BugLog, s: *u8) -> i64 {
213func nx_buglog_set_why_z(e: *BugLog, s: *u8) -> i64 {
216func nx_buglog_set_how_z(e: *BugLog, s: *u8) -> i64 {
219func nx_buglog_set_performance_z(e: *BugLog, s: *u8) -> i64 {
222func nx_buglog_add_genealogy_z(e: *BugLog, s: *u8) -> i64 {
225func nx_buglog_add_lineage_z(e: *BugLog, s: *u8) -> i64 {
231func nx_buglog_axis_str(axis: i64) -> *u8 {
called by 1: nx_buglog_emit
240func nx_buglog_axis_strlen(axis: i64) -> i64 {
called by 1: nx_buglog_emit
251func nx_buglog_w(s: *u8, len: i64) -> i64 {
256func nx_buglog_emit_field(name: *u8, name_len: i64,
called by 1: nx_buglog_emit calls 1: nx_buglog_w
268func nx_buglog_emit_id_array(name: *u8, name_len: i64,
288func nx_buglog_emit_raw_json(name: *u8, name_len: i64,
called by 1: nx_buglog_emit calls 1: nx_buglog_w
300func nx_buglog_emit(e: *BugLog) -> i64 {
320func nx_buglog_query(e: *BugLog) -> *ApproxI64 {
calls 1: nx_approx_new
326func nx_buglog_n_genealogy(e: *BugLog) -> i64 { return e.n_genealogy }
called by 1: main
327func nx_buglog_n_lineage(e: *BugLog) -> i64 { return e.n_lineage }
called by 1: main
329func nx_buglog_memory_bytes(e: *BugLog) -> i64 {