Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(mcp-host): stabilize dual-store title parity test with a frozen clock

Diego Zacariasc54f7b31a21e
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 7847c178f..eae0e8444 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.320",
+ "version": "0.1.321",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.320",
+ "version": "0.1.321",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index d0c0c6a19..0d423966a 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.320",
+ "version": "0.1.321",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/core/conversation/persistence/__tests__/sessionTitle.persistence.test.ts b/mcp-host/src/core/conversation/persistence/__tests__/sessionTitle.persistence.test.ts
index 2e9c3e1b7..d35807045 100644
--- a/mcp-host/src/core/conversation/persistence/__tests__/sessionTitle.persistence.test.ts
+++ b/mcp-host/src/core/conversation/persistence/__tests__/sessionTitle.persistence.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, it } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
import { mkdtempSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
@@ -77,9 +77,26 @@ describe('auto-title dual-store parity (spec 15 A10/A11 — assert observable ou
},
})
const manager = new ConversationManager(dual)
- const conv = await manager.getOrCreate(KEY)
- await manager.startTurn(conv, 'hello', 'task-1', null, 'My Title')
- await manager.completeTurn(conv, 'hi')
+ // Memory stamps lastActivityAt from `conversation.updated_at` while SQLite
+ // stamps its row from an independent clock read in the persist worker; the
+ // two land on the same millisecond ~98% of runs but straddle a second
+ // boundary otherwise, so the parity probe reports a spurious lastActivityAt
+ // mismatch (mirrors dualConversationStore.test.ts). Freeze Date at a
+ // whole-second instant so both reads are identical and the seconds↔ms
+ // round-trip is exact; only Date is faked so the persist queue's real
+ // timers still run.
+ vi.useFakeTimers({ toFake: ['Date'] })
+ vi.setSystemTime(new Date('2026-01-01T00:00:00.000Z'))
+ try {
+ const conv = await manager.getOrCreate(KEY)
+ await manager.startTurn(conv, 'hello', 'task-1', null, 'My Title')
+ await manager.completeTurn(conv, 'hi')
+ // Wait for the durable row (stamped at the frozen instant) to land before
+ // the parity probe reads it.
+ await sqlite.persistQueue.drainPrefix(PREFIX)
+ } finally {
+ vi.useRealTimers()
+ }
const memSummaries = await memory.listSessionSummariesByPrefix(PREFIX, {})
const sqlSummaries = await sqlite.store.listSessionSummariesByPrefix(PREFIX, {})