nx_sketch_buglog.nx
buildroot/runtime/nx_sketch_buglog.nx
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
imports: nx_syscalls.nxnx_sketch_types.nx
imported by: nx_sketch_hll_provenance.nxnx_sketch_hll_provenance_v2.nx
structs
| 59 | struct StrSlice |
| 64 | struct BugLog |
consts
| 43 | const NX_MAGIC_1000000000: i64 = 1000000000 |
| 45 | const NX_PROV_KIND_BUG: i64 = 0 |
| 46 | const NX_PROV_KIND_CAPABILITY: i64 = 1 |
| 47 | const NX_PROV_KIND_IMPROVEMENT_OPP: i64 = 2 |
| 48 | const NX_PROV_KIND_CROSS_REF: i64 = 3 |
| 50 | const NX_BUG_AXIS_ACCURACY: i64 = 0 |
| 51 | const NX_BUG_AXIS_MEMORY: i64 = 1 |
| 52 | const NX_BUG_AXIS_TIME: i64 = 2 |
| 53 | const NX_BUG_AXIS_CAPABILITY: i64 = 3 |
| 54 | const NX_BUG_AXIS_USABILITY: i64 = 4 |
| 56 | const NX_BUG_MAX_GENEALOGY: i64 = 64 |
| 57 | const NX_BUG_MAX_LINEAGE: i64 = 64 |
functions
| 85 | func nx_buglog_slen(s: *u8) -> i64 |
| 91 | func nx_buglog_alloc() -> *BugLog |
| 119 | func nx_buglog_slice_at(arr: *StrSlice, i: i64) -> *StrSlice |
| 125 | func nx_buglog_set_kind(e: *BugLog, kind: i64) -> i64 |
| 132 | func nx_buglog_kind_str(kind: i64) -> *u8 called by 1: nx_buglog_emit |
| 140 | func nx_buglog_kind_strlen(kind: i64) -> i64 called by 1: nx_buglog_emit |
| 148 | func nx_buglog_set_who(e: *BugLog, s: *u8, len: i64) -> i64 called by 1: nx_buglog_set_who_z |
| 154 | func nx_buglog_set_what(e: *BugLog, s: *u8, len: i64) -> i64 called by 1: nx_buglog_set_what_z |
| 160 | func nx_buglog_set_when(e: *BugLog, s: *u8, len: i64) -> i64 called by 1: nx_buglog_set_when_z |
| 166 | func nx_buglog_set_axis(e: *BugLog, axis: i64) -> i64 |
| 173 | func nx_buglog_set_why(e: *BugLog, s: *u8, len: i64) -> i64 called by 1: nx_buglog_set_why_z |
| 179 | func nx_buglog_set_how(e: *BugLog, s: *u8, len: i64) -> i64 called by 1: nx_buglog_set_how_z |
| 185 | func nx_buglog_set_performance(e: *BugLog, s: *u8, len: i64) -> i64 called by 1: nx_buglog_set_performance_z |
| 191 | func nx_buglog_add_genealogy(e: *BugLog, s: *u8, len: i64) -> i64 |
| 200 | func nx_buglog_add_lineage(e: *BugLog, s: *u8, len: i64) -> i64 |
| 211 | func nx_buglog_set_who_z(e: *BugLog, s: *u8) -> i64 |
| 214 | func nx_buglog_set_what_z(e: *BugLog, s: *u8) -> i64 |
| 217 | func nx_buglog_set_when_z(e: *BugLog, s: *u8) -> i64 |
| 220 | func nx_buglog_set_why_z(e: *BugLog, s: *u8) -> i64 |
| 223 | func nx_buglog_set_how_z(e: *BugLog, s: *u8) -> i64 |
| 226 | func nx_buglog_set_performance_z(e: *BugLog, s: *u8) -> i64 |
| 229 | func nx_buglog_add_genealogy_z(e: *BugLog, s: *u8) -> i64 |
| 232 | func nx_buglog_add_lineage_z(e: *BugLog, s: *u8) -> i64 |
| 238 | func nx_buglog_axis_str(axis: i64) -> *u8 called by 1: nx_buglog_emit |
| 247 | func nx_buglog_axis_strlen(axis: i64) -> i64 called by 1: nx_buglog_emit |
| 258 | func nx_buglog_w(s: *u8, len: i64) -> i64 called by 4: nx_buglog_emit_fieldnx_buglog_emit_id_arraynx_buglog_emit_raw_jsonnx_buglog_emit calls 1: sys_write |
| 263 | func nx_buglog_emit_field(name: *u8, name_len: i64, |
| 275 | func nx_buglog_emit_id_array(name: *u8, name_len: i64, |
| 295 | func nx_buglog_emit_raw_json(name: *u8, name_len: i64, |
| 307 | func nx_buglog_emit(e: *BugLog) -> i64 |
| 327 | func nx_buglog_query(e: *BugLog) -> *ApproxI64 calls 1: nx_approx_new |
| 333 | func nx_buglog_n_genealogy(e: *BugLog) -> i64 { return e.n_genealogy } |
| 334 | func nx_buglog_n_lineage(e: *BugLog) -> i64 { return e.n_lineage } |
| 336 | func nx_buglog_memory_bytes(e: *BugLog) -> i64 |