test(session): rely on the default JSONL backend

This commit is contained in:
liukx0205 committed 2026-11-15 01:42:16 +08:00
1 parent 73b971fa16
commit 7beee7daf4
19 files changed
+19 -20

No files matched your search

@@ -39,7 +39,7 @@ async function expectSession(actual: string, expectedPath: string): Promise<void
async function seedInterruptedSession(root: string, cwd: string): Promise<string> {
const ctx = new Context()
await ctx.plugin(JsonlSessionPersistence, { root, storage: 'jsonl', compression: 'none' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'none' })
const meta: SessionHeader = {
version: SESSION_FORMAT_VERSION,
id: sessionId,
@@ -51,7 +51,7 @@ async function seedSession(root: string, cwd: string, version: number, events: S
return path
}
const ctx = new Context()
await ctx.plugin(JsonlSessionPersistence, { root, storage: 'jsonl', compression: 'none' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'none' })
const meta: SessionHeader = {
version: SESSION_FORMAT_VERSION,
id: sessionId,
@@ -47,7 +47,7 @@ async function expectSession(actual: string, expectedPath: string): Promise<void
*/
async function seedCataloguedDescriptorlessChild(root: string, cwd: string): Promise<void> {
const ctx = new Context()
await ctx.plugin(JsonlSessionPersistence, { root, storage: 'jsonl', compression: 'none' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'none' })
const parentMeta: SessionHeader = {
version: SESSION_FORMAT_VERSION,
id: parentId,
@@ -48,7 +48,7 @@ async function expectSession(actual: string, expectedPath: string): Promise<void
/** Seed a completed parent turn with its read-only policy and current LLM selection. */
async function seedReadOnlyParent(root: string, cwd: string): Promise<void> {
const ctx = new Context()
await ctx.plugin(JsonlSessionPersistence, { root, storage: 'jsonl', compression: 'none' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'none' })
const meta: SessionHeader = {
version: SESSION_FORMAT_VERSION,
id: sessionId,
@@ -64,7 +64,7 @@ async function seedVisibleBaseline(
options: SeedBaselineOptions = {},
): Promise<string> {
const ctx = new Context()
await ctx.plugin(JsonlSessionPersistence, { root, storage: 'jsonl', compression: 'none' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'none' })
const meta: SessionHeader = {
version: SESSION_FORMAT_VERSION,
id: sessionId,
@@ -56,7 +56,7 @@ async function seed(root: string): Promise<void> {
const ctx = new Context()
try {
await mountAgentLoopTestDependencies(ctx)
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd', storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd' })
const handle = await ctx.sessionPersistence.create({
version: SESSION_FORMAT_VERSION, id: PARENT_ID, createdAt: TIME_ZERO, cwd: '/bench', isSeeded: false,
}, {})
@@ -82,7 +82,7 @@ async function measure(root: string, scenario: string): Promise<ContinuationRepo
let toolCalls = 0
try {
await mountAgentLoopTestDependencies(ctx)
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd', storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd' })
await ctx.plugin(AgentLoop, { agents: [] })
ctx.effect(() => ctx.llm.registerAdapter(['bench'], adapter))
ctx.effect(() => ctx.tools.register(defineContentToolFixture({
@@ -74,7 +74,7 @@ async function run(root: string, mode: string): Promise<CatalogReport | { seeded
try {
await ctx.plugin(SessionStore)
await ctx.plugin(SessionProjectionRegistry)
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd', storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd' })
await ctx.plugin(CatalogQuery)
provideWorkingDirectoryFixture(ctx, '/bench')
await ctx.plugin(SubagentRuntime)
@@ -192,7 +192,7 @@ async function mountHost(ctx: Context, root: string, workload: typeof WORKLOADS[
ctx.sessions.create(header.id, { meta: header })
}
}
await ctx.plugin(JsonlSessionPersistence, { root: join(root, 'sessions'), compression: 'zstd', storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root: join(root, 'sessions'), compression: 'zstd' })
await mountStorage(ctx, root)
await ctx.plugin(SessionProjectionCache, { writeEveryEvents: 200, writeIntervalMs: 5_000 })
await ctx.plugin(SqliteSessionQueryEngine, { path: ':memory:', openAt: 'never' })
@@ -135,7 +135,7 @@ async function memory(): Promise<CorpusMemory> {
async function mountHost(root: string): Promise<{ readonly ctx: Context; readonly controller: SessionController }> {
const ctx = new Context()
await mountAgentLoopTestDependencies(ctx)
await ctx.plugin(JsonlSessionPersistence, { root: join(root, 'sessions'), compression: 'zstd', storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root: join(root, 'sessions'), compression: 'zstd' })
await ctx.plugin(Storage)
await ctx.plugin(StorageJson, { root: join(root, 'storages') })
await ctx.plugin(StorageDomain, { backend: 'json' })
@@ -356,7 +356,7 @@ describe('Session opening benchmark prerequisites', () => {
const mount = async () => {
const ctx = new Context()
contexts.push(ctx)
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd', storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd' })
return ctx.sessionPersistence
}
try {
@@ -166,7 +166,7 @@ class SessionBenchmarkHost {
await ctx.plugin(SessionStore)
}
await installProjectionSet(ctx)
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd', storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root, compression: 'zstd' })
let history: WebController | undefined
if (scenario === 'first-history') {
new BenchmarkSessionQuery(ctx)
@@ -16,7 +16,7 @@ export const name = 'session-persistence-jsonl-legacy-tests'
*/
export async function apply(ctx: Context, config: Config): Promise<void> {
await persistence.apply(ctx, {
root: config.root, storage: 'jsonl',
root: config.root,
...config.compression === undefined ? {} : { compression: config.compression },
...config.listConcurrency === undefined ? {} : { listConcurrency: config.listConcurrency },
})
@@ -39,7 +39,7 @@ d.save('input.docx')
{ insert: [{ id: 'skill-office', name: '@deepseek-ai/dsh-skill-office', config: { assetRoot: join(repo, 'packages/skill/skill-office/assets') } }] },
{ insert: [{ id: 'workspace-dependencies', name: '@deepseek-ai/dsh-tool-workspace-dependencies', config: { source: runtime! } }] },
...officeModelPatches(),
{ id: 'session-persistence-jsonl', config: { root: join(cwd, '.sessions'), storage: 'jsonl', compression: 'none' } },
{ id: 'session-persistence-jsonl', config: { root: join(cwd, '.sessions'), compression: 'none' } },
]))
},
async inspect(cwd) {
@@ -93,7 +93,7 @@ export function registerVisualIntentCases(selected: readonly DocumentFormat[]):
...officeToolPatches(),
{ insert: [{ id: 'workspace-dependencies', name: '@deepseek-ai/dsh-tool-workspace-dependencies', config: { source: runtime! } }] },
...officeModelPatches(),
{ id: 'session-persistence-jsonl', config: { root: sessionRoot, storage: 'jsonl', compression: 'none' } },
{ id: 'session-persistence-jsonl', config: { root: sessionRoot, compression: 'none' } },
]))
},
async inspect(cwd) {
@@ -25,7 +25,7 @@ async function prepareOffice(cwd: string) {
{ insert: [{ id: 'skill-office', name: '@deepseek-ai/dsh-skill-office', config: { assetRoot: join(repo, 'packages/skill/skill-office/assets') } }] },
...officeToolPatches(),
{ insert: [{ id: 'workspace-dependencies', name: '@deepseek-ai/dsh-tool-workspace-dependencies', config: { source: runtime! } }] },
{ id: 'session-persistence-jsonl', config: { root: join(cwd, '.sessions'), storage: 'jsonl', compression: 'none' } },
{ id: 'session-persistence-jsonl', config: { root: join(cwd, '.sessions'), compression: 'none' } },
]))
}
@@ -95,7 +95,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime).each(['native', 'ptc'
{ insert: [{ id: 'workspace-dependencies', name: '@deepseek-ai/dsh-tool-workspace-dependencies', config: { source: runtime! } }] },
...officeModelPatches(),
{ id: 'attachment-local', config: { dshHome: imageRoot } },
{ id: 'session-persistence-jsonl', config: { root: sessionRoot, storage: 'jsonl', compression: 'none' } },
{ id: 'session-persistence-jsonl', config: { root: sessionRoot, compression: 'none' } },
]))
},
async inspect(cwd) {
@@ -61,7 +61,6 @@ const backends: PersistenceMount[] = [
name: 'JSONL',
mount: async (ctx, root) => await ctx.plugin(JsonlSessionPersistence, {
root: join(root, 'jsonl'),
storage: 'jsonl',
compression: 'none',
}),
},
+1 -1
View File
@@ -341,7 +341,7 @@ describe('one-time V4 migration command', () => {
const ctx = new Context();
let prototype;
try {
await ctx.plugin(Backend, { root: ${JSON.stringify(temporaryRoot())}, storage: 'jsonl' });
await ctx.plugin(Backend, { root: ${JSON.stringify(temporaryRoot())} });
prototype = Object.getPrototypeOf(ctx.sessionPersistence);
} finally {
await ctx.fiber.dispose();
+1 -1
View File
@@ -208,7 +208,7 @@ async function migrate(root: string, jobs: number): Promise<number> {
const compression = candidates.find(candidate => candidate.source !== undefined)?.source?.compression ?? 'zstd'
const ctx = new Context()
try {
await ctx.plugin(JsonlSessionPersistence, { root, compression, storage: 'jsonl' })
await ctx.plugin(JsonlSessionPersistence, { root, compression })
let completed = 0
await runMigrationJobs(candidates.length, jobs, async (index, retry) => {
const candidate = candidates[index]