test(storage): close agent run stores before cleanup - #2341
Conversation
|
The first required workspace lane failed in two unrelated timing-sensitive tests: |
03d747b to
3dcefe9
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for another clean fixture-lifecycle fix in the #2339 family — all 7 createSqliteAgentRunStore calls in both files route through openStore(), closing is idempotent behind the refcount/released chain, and 6/6 tests pass. The withTempRoot-scoped tracking is arguably cleaner than #2339's map wrapper.
Three non-blocking notes:
- The 'ci: retry flaky workspace checks' commit (3dcefe9) is an empty commit — zero diff, just a CI retry. Squash will absorb it; worth avoiding message-only pushes in the future.
store.close?.()leans onclose?being optional in the DurableAgentRunStore interface (agent-run-store.ts:142), which is type-consistent but weaker than #2339's mandatoryclose()— the very invariant this test exists to protect (must close before rm) could silently degrade on POSIX. Considerassert.ok(store.close)or making close mandatory.- Sibling files still close on the happy path only (regenerate-root-admission.test.ts:27, sqlite-long-term-memory-store.test.ts, agent-graph-supervisor-wakes.test.ts) — a follow-up could apply the same finally-close pattern.
Merging.
Summary
Part of #2142 Phase 1.
Why
The latest Windows baseline reports six cleanup failures across these two files after their assertions pass. Each test opens an AgentRun store, and two also open a second store, but the fixture removes the root without releasing the shared
runtime.sqliteleases. Windows correctly rejects that unlink withEBUSY; POSIX hides the lifecycle omission.Validation
npm --workspace @maka/storage run buildnode --test packages/storage/dist/__tests__/agent-graph-supervisor-root-admission.test.js packages/storage/dist/__tests__/claimed-agent-graph-root-admission.test.js(6 pass)npx biome check packages/storage/src/__tests__/agent-graph-supervisor-root-admission.test.ts packages/storage/src/__tests__/claimed-agent-graph-root-admission.test.tsgit diff --check