feat(confidence-engine): verify disk persistence of focused-investigation evidence serializer (Experiment 7, Iteration 7)

Extended deterministic test to write serialized evidence record to
OS temp directory, read back from disk, parse JSON, and assert deep
structural equality. Verified: five structured arrays preserved with
correct lengths; exact inputs unchanged; identity fields intact; null
metadata fields survive round-trip. Temp file cleaned in finally block.

Zero live model calls. Zero browser calls. No production code or
canonical-helper modifications. Experiment 4 original structured
output remains unavailable.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Signed-off-by: robbond <rob@rdbsolutions.co.uk>
This commit is contained in:
2026-10-09 14:29:36 +01:00
co-authored by Claude Code
parent 7d7a9e8d29
commit aa57d8589c
3 changed files with 110 additions and 0 deletions
+18
View File
@@ -749,3 +749,21 @@ Returns JSON-serializable record with: five deconstruction arrays (`observations
**What this establishes:** The apparatus limitation identified in Experiment 5 (Experiment 4's raw structured output was not retained) is now corrected. Future focused-investigation experiments can preserve their deconstruction checkpoint via `serializeFocusedInvestigationEvidence()`.
**What remains:** No new semantic evidence was produced. Experiment 4's missing structured output cannot be reconstructed — it was never persisted by the apparatus at that time. The PARTIAL semantic fidelity classification stands unchanged.
## Iterated Eight — Durable Focused-Investigation Evidence Capture via Disk (Experiment 7, 2026-10-09)
**Type:** Apparatus disk-persistence verification (Iteration 7 of bounded iteration loop). Zero-live-call apparatus experiment.
**Objective:** Answer whether `serializeFocusedInvestigationEvidence(checkpoint, identity, metadata)` output can be written to a temporary JSON file on disk and independently recovered without losing any required evidence fields.
**Verified serializer entry point:** `serializeFocusedInvestigationEvidence(checkpoint, identity, metadata)` — `tests/graph/live-update-experiment-helper.cjs`, line ~543. Pure function, no side effects, no I/O, no model calls. Reads the first deconstruction-carrying contribution from `checkpoint.postEpisodeContributions`.
**Disk write/read-back verification:** Extended deterministic test in `tests/graph/live-update-experiment-helper-checkpoint.test.cjs` writes serialized evidence to OS temp directory (via `os.tmpdir()`), reads file back, parses recovered JSON, and asserts deep structural equality against the original. Explicitly verifies: five structured arrays present with correct lengths; exact synthetic input values (`canonicalTargetDescription`, `actualQuestion`, `exactAnswer`) unchanged; identity fields (`experimentId`, `scenarioId`, `targetNodeId`, `evidenceDesignation`) preserved; execution metadata null-fields intact. Temp file removed in `finally` block.
**Exact targeted test result:** `node --check` on helper — PASS. Full deterministic test suite — 0 failures across all sections. Disk persistence block: ALL assertions PASSED (25 disk-specific assertions). Total: syntax check PASS + all existing tests PASS + disk persistence PASS.
**Zero live model calls.** Zero browser calls. No production or canonical-helper code modified. No new dependencies added.
**Distinction:** This test proves that the serializer's JSON-serializable output survives write-to-disk and read-back without loss. It does NOT establish a production/live-run command for writing evidence to files — that remains an untested operational boundary for future work. The apparatus produces correct in-memory records; disk persistence of those records is now independently verified at the test level.
**Experiment 4's original structured output remains unavailable.** Experiment 4 was executed before `serializeFocusedInvestigationEvidence` existed; its raw deconstruction checkpoint was never captured. No amount of apparatus testing can retroactively reconstruct it. The PARTIAL semantic fidelity classification for Experiment 4 stands unchanged.