code wiki / (root) / nx_research_journal.nx

nx_research_journal.nx

buildroot/runtime/nx_research_journal.nx

9610 B219 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic research
docsdependenciesstructsconstsfunctions

about

nx_research_journal.nx -- RES-R6: a CRASH-RESUMABLE research session journal. module: nishi-core.research.journal capability: CORE_COMPUTE (a durable, replay-able research progress log) WHAT this builds (one capability): a research session records each phase (FETCH / EXTRACT / VERIFY / SYNTH) and per-source progress as ATOMIC FRAMED LINES. On restart after a crash, the journal is REPLAYED: the highest phase that has a DONE record becomes the resume high-water mark, and every phase at or below it is SKIPPED -- the completed FETCH/EXTRACT work is NOT re-done. WHY it is correct under crash: every journal line is written by the WMS-R0 primitive fa_append (nx_framed_append.nx) -- the whole record is assembled in ONE buffer and emitted as EXACTLY ONE sys_write() to an O_APPEND fd, so a crash can never produce a half-written record that interleaves with another. A crash CAN leave the very last record absent (it was never reached) or, on other channels, torn; the replay therefore credits a phase DONE ONLY when it reads a WELL-FORMED line ("RJ " head + " END" tail + matching sid + ev=DONE). A torn / truncated last line is ignored -> replay can never SKIP work that did not actually complete (proven by the gate's torn-line tamper row). REUSE / lineage (rule 15 DRY, check-registries): this organ adds NO new write primitive. It COMPOSES fa_append / fa_cat / fa_catn from nx_framed_append.nx (the WMS-R0 floor) for writing, and the count_torn-style line+token byte-walk idiom from nx_framed_append_gate.nx for replay parsing. Sovereign: only nx_syscalls + nx_framed_append. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_framed_append.nx nx_research_journal.nx nx_research_journal_gate.nx

imports: nx_syscalls.nxnx_framed_append.nx

imported by: nx_research_journal_gate.nx

structs

none

consts

32const RJ_REC_CAP: i64 = 256
36const RJ_FETCH: i64 = 1
37const RJ_EXTRACT: i64 = 2
38const RJ_VERIFY: i64 = 3
39const RJ_SYNTH: i64 = 4
42const RJ_BEGIN: i64 = 1
43const RJ_DONE: i64 = 2

functions

51func rj_log(path: *u8, sid: i64, phase: i64, src_idx: i64, event: i64) -> i64
69func rj_phase_begin(path: *u8, sid: i64, phase: i64) -> i64
called by 3: do_phasedo_synthmain calls 1: rj_log
72func rj_phase_done(path: *u8, sid: i64, phase: i64) -> i64
called by 2: do_phasedo_synth calls 1: rj_log
75func rj_source_done(path: *u8, sid: i64, phase: i64, src: i64) -> i64
called by 2: do_phasemain calls 1: rj_log
87func rj_field(b: *u8, ls: i64, le: i64, tok: *u8, dflt: i64) -> i64
called by 1: rj_replay
126func rj_wellformed(b: *u8, ls: i64, le: i64) -> i64
called by 1: rj_replay
153func rj_replay(path: *u8, sid: i64, out: *i64) -> i64
216func rj_should_skip(phase: i64, last_done_phase: i64) -> i64
called by 1: main