From 32ed3e2bced0a489aeca7737def73aaa95e7f458 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Wed, 19 Aug 2026 22:26:08 +0800 Subject: [PATCH] test: adapt consumers to the cache's own root tree The web e2e seeds no longer warm the deleted coldSnapshot; assertions do not depend on the cache path. list-children mounts the cache with a scratch root instead of a storage-domain backend, and drops the now-unused storage devDependencies. --- apps/web/tests/agent-preset-selection.e2e.ts | 1 - apps/web/tests/subagent-conversation.e2e.ts | 2 -- packages/subagent/subagent/package.json | 2 -- .../subagent/subagent/tests/list-children.spec.ts | 15 ++++++--------- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/apps/web/tests/agent-preset-selection.e2e.ts b/apps/web/tests/agent-preset-selection.e2e.ts index 59a966c0a7..579f987663 100644 --- a/apps/web/tests/agent-preset-selection.e2e.ts +++ b/apps/web/tests/agent-preset-selection.e2e.ts @@ -134,7 +134,6 @@ async function seedSubagent(scaffold: WebScaffold, parentId: SessionId): Promise data: { turn: 1, reason: { kind: 'completed' } }, }, ] as SessionEvent[]) - await scaffold.ctx.sessionProjectionCache.coldSnapshot(header) } /** diff --git a/apps/web/tests/subagent-conversation.e2e.ts b/apps/web/tests/subagent-conversation.e2e.ts index bf087aec56..ed5a582e0b 100644 --- a/apps/web/tests/subagent-conversation.e2e.ts +++ b/apps/web/tests/subagent-conversation.e2e.ts @@ -155,7 +155,6 @@ describe('web e2e: persisted subagent conversation and human continuation', () = data: { turn: 1, reason: { kind: 'completed' } }, }, ] as SessionEvent[]) - await scaffold.ctx.sessionProjectionCache.coldSnapshot(oneShotHeader) grandchildId = sessionId('recorded-grandchild') const authoredAt = Date.now() const grandchildHeader: SessionHeader = { @@ -200,7 +199,6 @@ describe('web e2e: persisted subagent conversation and human continuation', () = data: { turn: 1, reason: { kind: 'completed' } }, }, ] as SessionEvent[]) - await scaffold.ctx.sessionProjectionCache.coldSnapshot(grandchildHeader) expect(scaffold.ctx.agents.get(childId)).toBeUndefined() expect(scaffold.ctx.agents.get(oneShotId)).toBeUndefined() expect(scaffold.ctx.agents.get(grandchildId)).toBeUndefined() diff --git a/packages/subagent/subagent/package.json b/packages/subagent/subagent/package.json index 7a42bdb7a7..189984cfbf 100644 --- a/packages/subagent/subagent/package.json +++ b/packages/subagent/subagent/package.json @@ -96,8 +96,6 @@ "@deepseek-ai/dsh-session-persistence": "workspace:^", "@deepseek-ai/dsh-session-projection": "workspace:^", "@deepseek-ai/dsh-session-projection-cache": "workspace:^", - "@deepseek-ai/dsh-storage": "workspace:^", - "@deepseek-ai/dsh-storage-domain": "workspace:^", "@deepseek-ai/dsh-jobs": "workspace:^", "@deepseek-ai/dsh-tools": "workspace:^", "@deepseek-ai/dsh-user-approval": "workspace:^", diff --git a/packages/subagent/subagent/tests/list-children.spec.ts b/packages/subagent/subagent/tests/list-children.spec.ts index 2e57114584..e90ef052d9 100644 --- a/packages/subagent/subagent/tests/list-children.spec.ts +++ b/packages/subagent/subagent/tests/list-children.spec.ts @@ -13,9 +13,6 @@ import JsonlSessionPersistence from '@deepseek-ai/dsh-session-persistence-jsonl' import SessionProjectionRegistry from '@deepseek-ai/dsh-session-projection' import type { ProjectionDefinition } from '@deepseek-ai/dsh-session-projection' import SessionProjectionCache from '@deepseek-ai/dsh-session-projection-cache' -import Storage from '@deepseek-ai/dsh-storage' -import { DomainFacility } from '@deepseek-ai/dsh-storage-domain' -import { MemoryMediaPool, MemoryStorageBackend } from '../../../storage/storage-domain/tests/helpers/memory-backend.ts' import SubagentRuntime, { SUBAGENT_DESCRIPTOR_VERSION, SubagentError, @@ -27,7 +24,10 @@ import { MockAdapter, textResponse } from '../../../core/agent-loop/tests/mock-a type Script = ConstructorParameters[0] const roots: string[] = [] +const projCacheRoots: string[] = [] + afterEach(() => { + for (const root of projCacheRoots.splice(0)) rmSync(root, { recursive: true, force: true }) for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }) }) @@ -44,12 +44,9 @@ async function setup( await ctx.plugin(AgentLoop, { agents: [] }) if (options.sessionProjections !== false) await ctx.plugin(SessionProjectionRegistry) if (options.projectionCache === true) { - await ctx.plugin(Storage) - ctx.storage.backend.register('memory', new MemoryStorageBackend(new MemoryMediaPool())) - const facility = new DomainFacility(ctx, { backend: 'memory', routes: {} }) - ctx.storage.mount('domain', facility) - ctx.provide('storageDomain', facility) - await ctx.plugin(SessionProjectionCache, { writeEveryEvents: 100, writeIntervalMs: 60_000 }) + const root = mkdtempSync(join(tmpdir(), 'dsh-subagent-projcache-')) + projCacheRoots.push(root) + await ctx.plugin(SessionProjectionCache, { root, writeEveryEvents: 100, writeIntervalMs: 60_000 }) } await ctx.plugin(SubagentRuntime) await ctx.plugin(SubagentSpawn, { providerName: 'spawn' })