feat(log): LOG-FLUSH -- a VM's log records reach Artemis's log ring; and the ring keeps its order when it grows

FABRIC-3 SXXXII.4's deferred LOG-FLUSH, built to the 2026-10-14 rulings
(SXXXVIII): everything a VM logs, at or above the log level, goes into its
own buffer; it goes to Artemis on LOG-FLUSH, when full, and at once on an
ERROR, as one kernel-Hermes LOG_BATCH message she writes on her own turn,
the source being the sender the kernel stamped.  Records that cannot go yet
are counted and reported with the next flush.  LOG-SHOW (Hera only) reads
the ring back -- it had no reader.

Found by the first test that filled it: ring growth overwrote the oldest
record and put blank slots inside the live range.  Fixed test first.

Three ISAs: POST 1052 passed; new parity baseline word_count=526
hash=0x82f4ae7cb2e2d424 (deliberate).  CLAUDE.md: Phase 8 PKI closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-14 12:10:01 -04:00
co-authored by Claude Opus 5.5
parent 5e26fad30d
commit 4da370f492
35 changed files with 91102 additions and 15 deletions
+17
View File
@@ -19,6 +19,7 @@
#include "starkernel/log_attrib.h" /* vm_log_attributed_vm() */
#include "starkernel/capsule_birth.h" /* capsule_vm_registry_get, VMRegistryEntry */
#include "starkernel/console.h" /* console_println() -- (LOG-APPEND-RAW) diagnostics */
#include "starkernel/vm_log_buffer.h" /* vm_log_buffer_flush() -- LOG-FLUSH */
#include <string.h> /* strlen */
#endif
@@ -294,6 +295,20 @@ static void log_word_append_raw(VM *vm)
vm->error = 1;
}
}
/* ── LOG-FLUSH ( -- ) ─────────────────────────────────────────────────── */
/*
* Sends this VM's log buffer to Artemis's log ring now, rather than when it
* fills or an ERROR record comes (vm_log_buffer.c; FABRIC-3.md SXXXVIII,
* 2026-10-14). Records that cannot go yet are counted, and the count goes
* with the next flush that can.
*/
static void log_word_flush(VM *vm)
{
if (vm_log_buffer_flush(vm) < 0) {
console_println("LOG-FLUSH: Artemis not ready -- records counted, sent with the next flush");
}
}
#endif
/* ── Registration ────────────────────────────────────────────────────── */
@@ -308,6 +323,7 @@ static void log_word_append_raw(VM *vm)
* String literals: LOG-ERROR" LOG-WARN" LOG-INFO" LOG-TEST" LOG-DEBUG"
* Stack string: LOG-ERROR-STR LOG-WARN-STR LOG-INFO-STR
* LOG-TEST-STR LOG-DEBUG-STR
* Kernel only: (LOG-APPEND-RAW) LOG-FLUSH
*/
void register_log_words(VM *vm)
{
@@ -344,5 +360,6 @@ void register_log_words(VM *vm)
#ifdef __STARKERNEL__
register_word(vm, "(LOG-APPEND-RAW)", log_word_append_raw);
register_word(vm, "LOG-FLUSH", log_word_flush);
#endif
}