Files
deepseek-harness/packages/session/session-projection/tests/loader-compatibility.e2e.ts
T
imccyu f415c83579 refactor(session-projection): simplify legacy registration compatibility
- register() returns the registration's effect disposer with then/catch/finally
  attached; the original body moves unchanged into a private acquire(), keeping
  synchronous installation and the asynchronous handle handoff.
- Legacy stateOf(session, key) logs one ctx.logger.warn per key per registry;
  registration and calls to its result no longer warn.
- Containing an ignored legacy registration failure is deferred and recorded
  under Known Limitations.
2026-10-20 00:18:25 +08:00

24 lines
1.2 KiB
TypeScript

/** Published/source Loader composition preserves old projection plugins and bounded diagnostics. */
import { fileURLToPath } from 'node:url'
import { expect, it } from 'vitest'
import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-loader-smoke'
it('loads a legacy projection plugin, reads Session state, and warns once for its deprecated keyed read', async () => {
const driver = fileURLToPath(new URL('./fixtures/driver.ts', import.meta.url))
const { stdout } = await runLoaderSmoke({
label: 'legacy projection registration',
tempDirPrefix: 'dsh-projection-compatibility-',
binScript: driver,
libBinScript: driver,
configPath: fileURLToPath(new URL('./fixtures/cordis.yml', import.meta.url)),
tsconfigPath: fileURLToPath(new URL('../../../../tsconfig.json', import.meta.url)),
})
expect(stdout.trim()).toBe(JSON.stringify({
first: 1,
second: 2,
values: { 'fixture/legacy-projection': 2 },
released: null,
warnings: ['sessionProjections.stateOf(session, "fixture/legacy-projection") is deprecated; read handle.stateOf(session) from an awaited registration, or use the owning domain service'],
}))
}, LOADER_SMOKE_TEST_TIMEOUT_MS)