nx_emit_journal.nx
buildroot/runtime/nx_emit_journal.nx
about
nx_emit_journal.nx -- append-only audit log of substrate emits.
Per user oversight directive 2026-05-14 (gap #5): every successful
emit must journal who/what/when/where it came from. This is the
foundation for the patent-check (#3), quality-gate (#6), and
uniqueness-ledger (#8) work that builds on top.
One row per emit, in JSONL. No reads, no rotation, no rewrites --
append-only by design. Caller picks the path (e.g.,
nxc2/_journal/YYYY-MM-DD.jsonl).
Row schema:
{"module":"nx_quad","source_id":"euclid_elements",
"license_class":"pd_classical","ts_ns":<i64>,"event":"emit"}
genealogy_id: substrate_audit_journal_2026_05_14
lineage_id: append_only_log
dependencies 7 imports · 1 importers
imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_fcntl.nxnx_clock.nxnx_str.nxnx_strconv.nx
imported by: nx_emit_journal_test.nx
structs
| 40 | struct NxJournal |
consts
| 33 | const NX_JOURNAL_OK: nx_int = 0 |
| 34 | const NX_JOURNAL_OPEN_FAIL: nx_int = -1 |
| 35 | const NX_JOURNAL_WRITE_FAIL: nx_int = -2 |
| 36 | const NX_JOURNAL_CLOSED: nx_int = -3 |
| 38 | const NX_JOURNAL_ROW_CAP: nx_size = 1024 |
| 46 | const NX_JOURNAL_STRUCT_BYTES: nx_size = 24 |
functions
| 50 | func nx_journal_open(path: *u8) -> *NxJournal |
| 61 | func nx_journal_close(j: *NxJournal) -> nx_int |
| 70 | func nx_journal_lc_str(lc: nx_int, out: *u8) -> nx_size |
| 82 | func nx_journal_write_all(fd: nx_fd, buf: *u8, n: nx_size) -> nx_size |
| 95 | func nx_journal_append( |
| 135 | func nx_journal_emit(j: *NxJournal, module: *u8, source_id: *u8, license_class: nx_int) -> nx_int |
| 140 | func nx_journal_refuse(j: *NxJournal, module: *u8, source_id: *u8, license_class: nx_int) -> nx_int |
| 144 | func nx_journal_n_appended(j: *NxJournal) -> nx_int { return j.n_appended } called by 1: main |