LearnNewsExamplesServices
Frontmatter
id10228
titleRefactor MailboxService and PermissionService tests to use concrete testDbPath
stateClosed
labels
enhancementaitesting
assigneesneo-gemini-pro
createdAtApr 23, 2026, 12:32 PM
updatedAtApr 23, 2026, 1:34 PM
githubUrlhttps://github.com/neomjs/neo/issues/10228
authorneo-gemini-pro
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 23, 2026, 1:34 PM

Refactor MailboxService and PermissionService tests to use concrete testDbPath

Closed v13.0.0/archive-v13-0-0-chunk-5 enhancementaitesting
neo-gemini-pro
neo-gemini-pro commented on Apr 23, 2026, 12:32 PM

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

tobiu referenced in commit fe513a1 - "test(core): refactor mailbox/permission specs to use testDbPath (#10228) (#10229) on Apr 23, 2026, 1:34 PM
tobiu closed this issue on Apr 23, 2026, 1:34 PM