Context
#12435 catalogs the aiConfig Provider-singleton-mutated-without-restore antipattern across ~11 test setups. Of those, 5 memory-core specs are the locally-verifiable subset — the remaining 6 (SessionSummarization / ResumeValidation SLM specs + ingestion/Dream handoffFilePath) are gemma4-gated (CI-skipped, need a live endpoint to verify) and stay Phase 2 under #12435. gpt flagged #12435 as the sole open blocker of epic #12456, so this lands the do-able half now.
The Problem
Per ADR 0019, runtime writes to AiConfig route through the reactive Provider's proxy set-trap → setData on the shared singleton, risking test data bleeding into live DBs (the #12335 orphan incident). Snapshot/restore was the wrong fix (PRs #12598 / #12660 — both closed; restore() is itself a B4 mutation). The ADR-0019 fix is by-construction: the config resolves test values declaratively under UNIT_TEST_MODE, so the specs never mutate the singleton.
The Architectural Reality
The 5 specs mutated aiConfig.storagePaths.graph / modelProvider / embeddingProvider / autoSummarize. ai/mcp/server/memory-core/config.template.mjs already resolves storagePaths.graph (and the provider leaves) by construction under UNIT_TEST_MODE — so the fix is to remove the overrides + let the leaf resolve, not to add restore logic.
The Fix
Drop the aiConfig.<path> = … mutations from the 5 specs; they isolate by construction. Files: GraphService.spec, WriteSideInvariant.spec, McpServerToolLimits.spec, ChromaManager.spec, SessionService.spec (+ removed dead tmpDir/fs/os/path imports).
Acceptance Criteria
Out of Scope
- The 6 gemma4-gated specs (SessionSummarization / ResumeValidation SLM + ingestion/Dream
handoffFilePath) — Phase 2 under #12435, needs a non-gemma4 verification path.
- The planned sub-#2 fail-build lint flagging
aiConfig.x = in tests — separate.
Related
- #12435 — parent (the full ~11-spec scope; stays open for the gemma4 Phase-2 tail).
- #12456 — epic blocked by #12435.
Decision Record impact: aligned-with ADR 0019 (by-construction reactive-Provider isolation).
Origin Session ID: 2d558ccb-e067-4777-bb80-e52f86d5ca43
Retrieval Hint: "by-construction aiConfig isolation 5 memory-core specs Phase 1 #12435"
Live latest-open sweep: checked latest 20 open issues 2026-06-07; no equivalent found.
Context
#12435 catalogs the
aiConfigProvider-singleton-mutated-without-restore antipattern across ~11 test setups. Of those, 5 memory-core specs are the locally-verifiable subset — the remaining 6 (SessionSummarization / ResumeValidation SLM specs + ingestion/DreamhandoffFilePath) are gemma4-gated (CI-skipped, need a live endpoint to verify) and stay Phase 2 under #12435. gpt flagged #12435 as the sole open blocker of epic #12456, so this lands the do-able half now.The Problem
Per ADR 0019, runtime writes to
AiConfigroute through the reactive Provider's proxy set-trap →setDataon the shared singleton, risking test data bleeding into live DBs (the #12335 orphan incident). Snapshot/restore was the wrong fix (PRs #12598 / #12660 — both closed;restore()is itself a B4 mutation). The ADR-0019 fix is by-construction: the config resolves test values declaratively underUNIT_TEST_MODE, so the specs never mutate the singleton.The Architectural Reality
The 5 specs mutated
aiConfig.storagePaths.graph/modelProvider/embeddingProvider/autoSummarize.ai/mcp/server/memory-core/config.template.mjsalready resolvesstoragePaths.graph(and the provider leaves) by construction underUNIT_TEST_MODE— so the fix is to remove the overrides + let the leaf resolve, not to add restore logic.The Fix
Drop the
aiConfig.<path> = …mutations from the 5 specs; they isolate by construction. Files:GraphService.spec,WriteSideInvariant.spec,McpServerToolLimits.spec,ChromaManager.spec,SessionService.spec(+ removed deadtmpDir/fs/os/pathimports).Acceptance Criteria
aiConfig.<path> = …mutations.npm run test-unit(verified: GraphService 30, ChromaManager 7, SessionService 7, McpServerToolLimits 4, WriteSideInvariant 3 = 51 green).Out of Scope
handoffFilePath) — Phase 2 under #12435, needs a non-gemma4 verification path.aiConfig.x =in tests — separate.Related
Decision Record impact: aligned-with ADR 0019 (by-construction reactive-Provider isolation).
Origin Session ID: 2d558ccb-e067-4777-bb80-e52f86d5ca43 Retrieval Hint: "by-construction aiConfig isolation 5 memory-core specs Phase 1 #12435" Live latest-open sweep: checked latest 20 open issues 2026-06-07; no equivalent found.