Testing · mastra-ai/mastra
Test durable-agent registry storage and cleanup lifecycles
Adds unit tests for RunRegistry and ExtendedRunRegistry, the in-process stores for non-serializable durable-agent state. Coverage addresses retrieval, replacement, cleanup callbacks, accounting, and extended-registry lifecycle behavior.
The problem
Durable-agent execution keeps live tool functions, model instances, save-queue managers, and message lists outside serializable workflow state. Incorrect overwrite or cleanup behavior could retain stale entries or resources. ExtendedRunRegistry must also remove its message lists and memory metadata while preserving base-registry cleanup.
The approach
Adds a Vitest suite exercising real Map-based registry operations, with fresh registry instances and mock cleanup callbacks. Tests cover registration, missing-entry access, replacement, size and run-ID accounting, and clearing entries. Extended-registry coverage checks message-list and memory-info storage and removal alongside base entries. A patch changeset documents the additive test coverage.
What changed
Introduces a dedicated registry test file and a patch changeset for @mastra/core. The change adds assertions for storage and cleanup contracts without modifying production behavior or adding dependencies.
- vitest
- typescript
- durable-agents
- unit-tests
- state-management
- resource-cleanup