nx_trace_log.nx
buildroot/runtime/nx_trace_log.nx
about
nx_trace_log.nx -- bit-traceability persistence layer.
Per [[feedback-end-to-end-bit-traceability-architecture]]:
"Local trace per call in ~/.nishi/trace/<call_id>.jsonl default-
off cross-device." nx_provenance_chain is the in-memory ring;
nx_trace_log is the persistent log shape (in-memory in V1; on-disk
JSONL in V2 once nx_jsonl_writer is wired into the substrate).
THE COMPLEMENT TO nx_provenance_chain: chain is the hot path; log
is the cold path. Caller appends every provenance link to the
chain AND emits a log entry. Chain wraps at capacity (old links
roll out); log grows unbounded until caller archives.
Composes:
nx_provenance_chain -- the source of truth for which transforms
ran; trace_log is its persistent shadow
nx_methyl -- each entry methyl-marked
nx_trace_merkle -- the merkle-root summary of a log range
nx_trace_consent (queued) -- per-call cross-device sharing
V1 ships:
- struct NxTraceEntry capturing call_id + entry_seq + transform_id
+ params_hash + output_hash + ts + originator
- struct NxTraceLog as append-only growable buffer with persist_count
- append + count + find_by_call_id
Gap list (V1 honest perf verdict):
- in-memory only; on-disk JSONL writer queued
- no compression of redundant transforms
- per-call grouping via call_id is caller-supplied (V2 auto-assigns)
dependencies 3 imports · 4 importers
imports: nx_syscalls.nxnx_tier.nxnx_provenance_chain.nx
imported by: nx_session_audit_compose_test.nxnx_trace_log_test.nxnx_trace_merkle.nxnx_trace_merkle_test.nx
structs
| 42 | struct NxTraceEntry |
| 54 | struct NxTraceLog |
consts
| 36 | const NX_TL_OK: nx_int = 0 |
| 37 | const NX_TL_ERR_FULL: nx_int = 1 |
| 38 | const NX_TL_ERR_BAD_ENTRY: nx_int = 2 |
| 61 | const NX_TL_ENTRY_BYTES: nx_size = 56 |
functions
| 65 | func nx_trace_log_new(capacity: nx_size) -> *NxTraceLog |
| 75 | func _tl_at(l: *NxTraceLog, idx: nx_size) -> *NxTraceEntry |
| 85 | func nx_trace_log_append(l: *NxTraceLog, |
| 112 | func nx_trace_log_append_from_chain(l: *NxTraceLog, |
| 137 | func nx_trace_log_count_for_call(l: *NxTraceLog, call_id: nx_int) -> nx_int |
| 148 | func nx_trace_log_entry_at(l: *NxTraceLog, idx: nx_size) -> *NxTraceEntry |
| 153 | func nx_trace_log_count(l: *NxTraceLog) -> nx_size |