code wiki / (root) / nx_trace_log.nx

nx_trace_log.nx

buildroot/runtime/nx_trace_log.nx

5423 B155 linesdepth 4pulls 4 transitivereach 4 importersview sourcekind librarytopic trace
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_provenance_chain.nx nx_trace_log.nx nx_session_audit_compose_test.nx nx_trace_log_test.nx nx_trace_merkle.nx nx_trace_merkle_test.nx

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

42struct NxTraceEntry
54struct NxTraceLog

consts

36const NX_TL_OK: nx_int = 0
37const NX_TL_ERR_FULL: nx_int = 1
38const NX_TL_ERR_BAD_ENTRY: nx_int = 2
61const NX_TL_ENTRY_BYTES: nx_size = 56

functions

65func nx_trace_log_new(capacity: nx_size) -> *NxTraceLog
called by 3: mainmainmain calls 1: sys_mmap
75func _tl_at(l: *NxTraceLog, idx: nx_size) -> *NxTraceEntry
85func nx_trace_log_append(l: *NxTraceLog,
112func nx_trace_log_append_from_chain(l: *NxTraceLog,
137func nx_trace_log_count_for_call(l: *NxTraceLog, call_id: nx_int) -> nx_int
called by 2: mainmain calls 1: _tl_at
148func nx_trace_log_entry_at(l: *NxTraceLog, idx: nx_size) -> *NxTraceEntry
called by 2: mainnx_trace_merkle_build calls 1: _tl_at
153func nx_trace_log_count(l: *NxTraceLog) -> nx_size
called by 2: mainmain