sketch_buglog.nx
buildroot/runtime/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 · 3 importers
imports: syscalls.nxsketch_types.nx
imported by: sketch_buglog_test.nxsketch_hll_provenance.nxsketch_hll_provenance_v2.nx
structs
| 52 | struct StrSlice { |
| 57 | struct BugLog { |
consts
| 38 | const NX_PROV_KIND_BUG: i64 = 0 |
| 39 | const NX_PROV_KIND_CAPABILITY: i64 = 1 |
| 40 | const NX_PROV_KIND_IMPROVEMENT_OPP: i64 = 2 |
| 41 | const NX_PROV_KIND_CROSS_REF: i64 = 3 |
| 43 | const NX_BUG_AXIS_ACCURACY: i64 = 0 |
| 44 | const NX_BUG_AXIS_MEMORY: i64 = 1 |
| 45 | const NX_BUG_AXIS_TIME: i64 = 2 |
| 46 | const NX_BUG_AXIS_CAPABILITY: i64 = 3 |
| 47 | const NX_BUG_AXIS_USABILITY: i64 = 4 |
| 49 | const NX_BUG_MAX_GENEALOGY: i64 = 64 |
| 50 | const NX_BUG_MAX_LINEAGE: i64 = 64 |
functions
| 78 | func nx_buglog_slen(s: *u8) -> i64 { |
| 84 | func nx_buglog_alloc() -> *BugLog { |
| 112 | func nx_buglog_slice_at(arr: *StrSlice, i: i64) -> *StrSlice { |
| 118 | func nx_buglog_set_kind(e: *BugLog, kind: i64) -> i64 { |
| 125 | func nx_buglog_kind_str(kind: i64) -> *u8 {
called by 1: nx_buglog_emit |
| 133 | func nx_buglog_kind_strlen(kind: i64) -> i64 {
called by 1: nx_buglog_emit |
| 141 | func nx_buglog_set_who(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_who_z |
| 147 | func nx_buglog_set_what(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_what_z |
| 153 | func nx_buglog_set_when(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_when_z |
| 159 | func nx_buglog_set_axis(e: *BugLog, axis: i64) -> i64 { |
| 166 | func nx_buglog_set_why(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_why_z |
| 172 | func nx_buglog_set_how(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_how_z |
| 178 | func nx_buglog_set_performance(e: *BugLog, s: *u8, len: i64) -> i64 {
called by 1: nx_buglog_set_performance_z |
| 184 | func nx_buglog_add_genealogy(e: *BugLog, s: *u8, len: i64) -> i64 { |
| 193 | func nx_buglog_add_lineage(e: *BugLog, s: *u8, len: i64) -> i64 { |
| 204 | func nx_buglog_set_who_z(e: *BugLog, s: *u8) -> i64 { |
| 207 | func nx_buglog_set_what_z(e: *BugLog, s: *u8) -> i64 { |
| 210 | func nx_buglog_set_when_z(e: *BugLog, s: *u8) -> i64 { |
| 213 | func nx_buglog_set_why_z(e: *BugLog, s: *u8) -> i64 { |
| 216 | func nx_buglog_set_how_z(e: *BugLog, s: *u8) -> i64 { |
| 219 | func nx_buglog_set_performance_z(e: *BugLog, s: *u8) -> i64 { |
| 222 | func nx_buglog_add_genealogy_z(e: *BugLog, s: *u8) -> i64 { |
| 225 | func nx_buglog_add_lineage_z(e: *BugLog, s: *u8) -> i64 { |
| 231 | func nx_buglog_axis_str(axis: i64) -> *u8 {
called by 1: nx_buglog_emit |
| 240 | func nx_buglog_axis_strlen(axis: i64) -> i64 {
called by 1: nx_buglog_emit |
| 251 | func nx_buglog_w(s: *u8, len: i64) -> i64 { |
| 256 | func nx_buglog_emit_field(name: *u8, name_len: i64, |
| 268 | func nx_buglog_emit_id_array(name: *u8, name_len: i64, |
| 288 | func nx_buglog_emit_raw_json(name: *u8, name_len: i64, |
| 300 | func nx_buglog_emit(e: *BugLog) -> i64 { |
| 320 | func nx_buglog_query(e: *BugLog) -> *ApproxI64 {
calls 1: nx_approx_new |
| 326 | func nx_buglog_n_genealogy(e: *BugLog) -> i64 { return e.n_genealogy }
called by 1: main |
| 327 | func nx_buglog_n_lineage(e: *BugLog) -> i64 { return e.n_lineage }
called by 1: main |
| 329 | func nx_buglog_memory_bytes(e: *BugLog) -> i64 { |