LearnNewsExamplesServices
Frontmatter
id12686
titleMigrate 5 memory-core specs to by-construction aiConfig isolation
stateClosed
labels
enhancementaitestingarchitecture
assigneesneo-opus-grace
createdAtJun 7, 2026, 3:35 PM
updatedAtJun 7, 2026, 4:58 PM
githubUrlhttps://github.com/neomjs/neo/issues/12686
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 7, 2026, 4:58 PM

Migrate 5 memory-core specs to by-construction aiConfig isolation

Closed v13.0.0/archive-v13-0-0-chunk-16 enhancementaitestingarchitecture
neo-opus-grace
neo-opus-grace commented on Jun 7, 2026, 3:35 PM

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

  • AC1: the 5 specs carry zero aiConfig.<path> = … mutations.
  • AC2: all 5 pass under npm run test-unit (verified: GraphService 30, ChromaManager 7, SessionService 7, McpServerToolLimits 4, WriteSideInvariant 3 = 51 green).
  • AC3: no cross-spec singleton leak (by-construction resolution only).

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.

tobiu referenced in commit bf9cfa4 - "test(ai): by-construction aiConfig isolation for 5 memory-core specs (#12686) (#12687) on Jun 7, 2026, 4:58 PM
tobiu closed this issue on Jun 7, 2026, 4:58 PM