diff --git a/apps/web/tests/scaffold-generation.spec.ts b/apps/web/tests/scaffold-generation.spec.ts index e437dd1d36..198268c9f1 100644 --- a/apps/web/tests/scaffold-generation.spec.ts +++ b/apps/web/tests/scaffold-generation.spec.ts @@ -18,12 +18,16 @@ describe('Web snapshot generation filenames', () => { it('selects the highest parent and child generations without counting retained inputs twice', async () => { const root = await mkdtemp(join(tmpdir(), 'dsh-web-fixture-generations-')) roots.push(root) - for (const name of [ - 'session.jsonl', - 'session.v2.jsonl', - 'session.1.jsonl', - 'session.1.v1.jsonl', - ]) await writeFile(join(root, name), '') + for (const [name, version] of [ + ['session.jsonl', 0], + ['session.v2.jsonl', 2], + ['session.1.jsonl', 0], + ['session.1.v1.jsonl', 1], + ] as const) { + await writeFile(join(root, name), `${JSON.stringify({ + type: 'session', version, id: '{{session:1}}', createdAt: 0, delegationDepth: 0, + })}\n`) + } await expect(selectedSessionFixture(join(root, 'session.jsonl'))) .resolves.toBe(join(root, 'session.v2.jsonl')) @@ -37,8 +41,10 @@ describe('Web snapshot generation filenames', () => { const root = await mkdtemp(join(tmpdir(), 'dsh-web-fixture-generations-')) roots.push(root) - await expect(selectedSessionFixture(join(root, 'session.jsonl'))) + await expect(selectedSessionFixture(join(root, 'session.jsonl'), true)) .resolves.toBe(join(root, 'session.jsonl')) + await expect(selectedSessionFixture(join(root, 'session.jsonl'))) + .rejects.toThrow('missing parent session fixture') }) it('records beside an older generation and preserves the parent or child role', () => { diff --git a/apps/web/tests/scaffold.ts b/apps/web/tests/scaffold.ts index 673fa4eec8..e359c917dc 100644 --- a/apps/web/tests/scaffold.ts +++ b/apps/web/tests/scaffold.ts @@ -1466,15 +1466,19 @@ export async function assertFixtureInventory(dir: string, expected: string[]): P const entries = (await readdir(dir)).sort() const ownsManifest = entries.includes('snapshot.yml') const artifacts = entries.filter(name => name !== 'snapshot.yml') - expect(artifacts).toEqual([...expected].sort()) + const roleInventory = (names: readonly string[]): string[] => [...new Set(names.map((name) => { + const fixture = parseSessionFixtureName(name) + return fixture === undefined ? name : sessionFixtureName(fixture.index, 0) + }))].sort() + expect(roleInventory(artifacts)).toEqual(roleInventory(expected)) if (ownsManifest) { const manifestPath = join(dir, 'snapshot.yml') const manifest = parseSnapshotManifest(await readFile(manifestPath, 'utf8'), manifestPath) expect(manifest.profile).toBe('web') if (manifest.session === undefined) { expect( - artifacts.includes('session.jsonl'), - `${dir}: session owner must carry session.jsonl`, + artifacts.some(name => parseSessionFixtureName(name)?.index === 0), + `${dir}: session owner must carry a canonical parent Session fixture`, ).toBe(true) } else { expect(existsSync(resolve(dir, manifest.session.source)), `${dir}: session source`).toBe(true) diff --git a/packages/llm/llm-deepseek/tests/loader-composition.spec.ts b/packages/llm/llm-deepseek/tests/loader-composition.spec.ts index decc6b88a6..aec0991440 100644 --- a/packages/llm/llm-deepseek/tests/loader-composition.spec.ts +++ b/packages/llm/llm-deepseek/tests/loader-composition.spec.ts @@ -182,7 +182,7 @@ describe('llm-deepseek real dynamic composition', () => { } } expect(request.dsh_session_log).toMatchObject({ - version: 1, + version: 2, session: { id: 'extension-composition-enabled' }, afterSeq: -1, throughSeq: 0,