Context
On 2026-04-22 (session 15852d91) and 2026-04-23 (session 8968b9f6), the production AgentIdentity nodes were wiped.
The Problem
This was traced back to a test-pollution anti-pattern in the Playwright test suite. Tests like MailboxService.spec.mjs and PermissionService.spec.mjs attempt to isolate themselves using an in-memory database override (aiConfig.storagePaths.graph = ':memory:';). However, if LifecycleService._initPromise is already set (because a prior test initialized the LifecycleService with the default production SQLite path), the :memory: override is silently ignored. When the test's beforeEach hook then executes storage.clear(), it wipes the production data instead of the intended in-memory database.
The Architectural Reality
Other specs (e.g., DreamService, SemanticGraphExtractor) use concrete testDbPath temporary files per test. This provides a robust isolation boundary and eliminates the leak surface.
The Fix
Refactor test/playwright/unit/ai/mcp/server/memory-core/services/MailboxService.spec.mjs and test/playwright/unit/ai/mcp/server/memory-core/services/PermissionService.spec.mjs to use concrete testDbPath temporary files instead of the :memory: aiConfig mutation.
Acceptance Criteria
MailboxService.spec.mjs uses testDbPath tmp files for database isolation.
PermissionService.spec.mjs uses testDbPath tmp files for database isolation.
- The
:memory: override mutation is removed from both specs.
- Specs pass reliably without wiping the production database.
Origin Session ID: e068b094-fcae-436a-a9ab-c513246f7f71
Context
On 2026-04-22 (session 15852d91) and 2026-04-23 (session 8968b9f6), the production AgentIdentity nodes were wiped.
The Problem
This was traced back to a test-pollution anti-pattern in the Playwright test suite. Tests like
MailboxService.spec.mjsandPermissionService.spec.mjsattempt to isolate themselves using an in-memory database override (aiConfig.storagePaths.graph = ':memory:';). However, ifLifecycleService._initPromiseis already set (because a prior test initialized theLifecycleServicewith the default production SQLite path), the:memory:override is silently ignored. When the test'sbeforeEachhook then executesstorage.clear(), it wipes the production data instead of the intended in-memory database.The Architectural Reality
Other specs (e.g.,
DreamService,SemanticGraphExtractor) use concretetestDbPathtemporary files per test. This provides a robust isolation boundary and eliminates the leak surface.The Fix
Refactor
test/playwright/unit/ai/mcp/server/memory-core/services/MailboxService.spec.mjsandtest/playwright/unit/ai/mcp/server/memory-core/services/PermissionService.spec.mjsto use concretetestDbPathtemporary files instead of the:memory:aiConfig mutation.Acceptance Criteria
MailboxService.spec.mjsusestestDbPathtmp files for database isolation.PermissionService.spec.mjsusestestDbPathtmp files for database isolation.:memory:override mutation is removed from both specs.Origin Session ID: e068b094-fcae-436a-a9ab-c513246f7f71