Add exact-equality Hermes ledger self-audit -- FABRIC-3.6.md task 2.6

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-09-20 21:02:27 -04:00
co-authored by Claude Sonnet 5
parent d11eb2e5db
commit 313ffc89e6
7 changed files with 27705 additions and 1 deletions
+13
View File
@@ -951,7 +951,20 @@ static void kernel_main_deep(BootInfo *boot_info) {
if (held4 != pulled4 - returned4 - consumed4) ok = 0;
if (stadium_reservoir_peek(alloc_test_id) != reservoir0 - decay_expected) ok = 0;
/* Task 2.6: the live audit never fired across both cycles,
* and a ONE-unit corruption of each counter in turn (on a
* copy -- live state untouched) is caught by the pure
* predicate, while the uncorrupted values pass it. */
if (sk_hermes_audit_failure_count() != 0) ok = 0;
if (!sk_hermes_audit()) ok = 0;
if (!sk_hermes_audit_values(held4, pulled4, returned4, consumed4)) ok = 0;
if (sk_hermes_audit_values(held4 + 1, pulled4, returned4, consumed4)) ok = 0;
if (sk_hermes_audit_values(held4, pulled4 + 1, returned4, consumed4)) ok = 0;
if (sk_hermes_audit_values(held4, pulled4, returned4 + 1, consumed4)) ok = 0;
if (sk_hermes_audit_values(held4, pulled4, returned4, consumed4 + 1)) ok = 0;
console_println(ok ? "PASS" : "FAIL");
print_uint(" audit_failures=", sk_hermes_audit_failure_count());
print_uint(" decay_consumed=", decay_expected);
print_uint(" reservoir0=", reservoir0);
print_uint(" Q_SLOT=", SK_HERMES_Q_SLOT);