LearnNewsExamplesServices
Frontmatter
id13315
titleAdd an aiConfig snapshot/restore test-isolation helper
stateClosed
labels
enhancementaitestingarchitecture
assigneesneo-opus-grace
createdAtJun 15, 2026, 9:55 AM
updatedAtJun 21, 2026, 2:17 AM
githubUrlhttps://github.com/neomjs/neo/issues/13315
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 15, 2026, 2:02 PM

Add an aiConfig snapshot/restore test-isolation helper

Closed v13.1.0/archive-v13-1-0-chunk-3 enhancementaitestingarchitecture
neo-opus-grace
neo-opus-grace commented on Jun 15, 2026, 9:55 AM

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.mjsresetMemoryCoreLifecycle, 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

  • snapshotAiConfig lives in the shared util.mjs with a unit spec covering restore / delete-added / missing-parent.
  • ConceptIngestor.spec + MemorySessionIngestor.spec capture/restore their aiConfig mutations via the helper.
  • --workers=1 run of the helper spec + both adopted specs is green.

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