Authored by Claude Opus 4.8 (Claude Code), @neo-opus-grace (Grace).
Context
Narrow leaf of #12435 (aiConfig Provider singleton mutated without restore across the test suite). #12435's prescription is a shared snapshot/restore helper adopted across ~16 specs; this leaf delivers the reusable helper itself + proves it on the two simplest ingestion specs, so the broad adoption on #12435 has a verified foundation to build on.
A V-B-A during #12435 pickup found the existing shared test-util (test/playwright/unit/ai/services/memory-core/util.mjs — resetMemoryCoreLifecycle, drainMemoryWal, TestLifecycleHelper) is already imported cross-dir but carries no aiConfig snapshot/restore. That util is the natural home.
The Problem
aiConfig is a Provider singleton imported once per module graph; specs that write its leaves (storagePaths.graph, autoIngestFileSystem, handoffFilePath) in setup without restoring leak that state into the next --workers=1 spec. The capture/restore precedent exists in-tree (DestructiveOperationGuard.spec.mjs try/finally) but is hand-rolled per-spec; there is no shared primitive.
The Fix
snapshotAiConfig(aiConfig, paths) in util.mjs — captures the given dot-path leaves and returns a restore() thunk (reassigns original values, deletes leaves that did not exist at capture). Pure + dependency-free.
- A focused unit spec (
util.snapshotAiConfig.spec.mjs): restore-values, delete-added-leaf, missing-parent tolerance.
- Adopt in
ConceptIngestor.spec + MemorySessionIngestor.spec (capture in beforeAll, restore in afterAll) as the proof-of-pattern.
Acceptance Criteria
Out of Scope
- The broad adoption across the remaining ~13 specs — stays on #12435 (this leaf gives it the helper).
- MC
Server.spec adoption — sequenced after #13312 (gpt, active in Server.mjs) to avoid a collision.
Related
- #12435 (umbrella — the full migration), #13312 (the
Server.spec carve-out coordination).
Release classification: post-release (test-isolation hygiene foundation; not v13-blocking). Boardless.
Origin Session ID: 0f5d9f1d-0683-452d-aac1-f467297186ac
Authored by Claude Opus 4.8 (Claude Code), @neo-opus-grace (Grace).
Context
Narrow leaf of #12435 (aiConfig Provider singleton mutated without restore across the test suite). #12435's prescription is a shared snapshot/restore helper adopted across ~16 specs; this leaf delivers the reusable helper itself + proves it on the two simplest ingestion specs, so the broad adoption on #12435 has a verified foundation to build on.
A V-B-A during #12435 pickup found the existing shared test-util (
test/playwright/unit/ai/services/memory-core/util.mjs—resetMemoryCoreLifecycle,drainMemoryWal,TestLifecycleHelper) is already imported cross-dir but carries no aiConfig snapshot/restore. That util is the natural home.The Problem
aiConfigis a Provider singleton imported once per module graph; specs that write its leaves (storagePaths.graph,autoIngestFileSystem,handoffFilePath) in setup without restoring leak that state into the next--workers=1spec. The capture/restore precedent exists in-tree (DestructiveOperationGuard.spec.mjstry/finally) but is hand-rolled per-spec; there is no shared primitive.The Fix
snapshotAiConfig(aiConfig, paths)inutil.mjs— captures the given dot-path leaves and returns arestore()thunk (reassigns original values, deletes leaves that did not exist at capture). Pure + dependency-free.util.snapshotAiConfig.spec.mjs): restore-values, delete-added-leaf, missing-parent tolerance.ConceptIngestor.spec+MemorySessionIngestor.spec(capture inbeforeAll, restore inafterAll) as the proof-of-pattern.Acceptance Criteria
snapshotAiConfiglives in the sharedutil.mjswith a unit spec covering restore / delete-added / missing-parent.ConceptIngestor.spec+MemorySessionIngestor.speccapture/restore theiraiConfigmutations via the helper.--workers=1run of the helper spec + both adopted specs is green.Out of Scope
Server.specadoption — sequenced after #13312 (gpt, active inServer.mjs) to avoid a collision.Related
Server.speccarve-out coordination).Release classification: post-release (test-isolation hygiene foundation; not v13-blocking). Boardless.
Origin Session ID: 0f5d9f1d-0683-452d-aac1-f467297186ac