feat(research): run retained strategies through durable canonical engine

This commit is contained in:
Boki 2026-10-23 21:59:09 -04:00
parent d929db707a
commit 618fb9e33c
58 changed files with 6596 additions and 779 deletions

View file

@ -62,10 +62,11 @@ describe('orchestrator architecture boundaries', () => {
expect(
path === 'types.ts' ||
path.startsWith('contracts/') ||
path === 'backtest/native-worker-protocol.ts'
path === 'backtest/native-worker-protocol.ts' ||
path === 'backtest/canonical-result.ts'
).toBe(true);
for (const specifier of imports.get(file) ?? []) {
expect(specifier.startsWith('.') || ['zod', '@stock-bot/types', '@stock-bot/stock-config/backtest', '@stock-bot/stock-config/strategy'].includes(specifier)).toBe(
expect(specifier.startsWith('.') || ['zod', '@stock-bot/types', '@stock-bot/stock-config/backtest', '@stock-bot/stock-config/strategy', '@stock-bot/stock-config/canonical-replay', '@stock-bot/stock-config/canonical-research', '@stock-bot/calculations/analytics', '@stock-bot/calculations/returns'].includes(specifier)).toBe(
true
);
}
@ -75,7 +76,7 @@ describe('orchestrator architecture boundaries', () => {
it('the shared backtest contract loads no configuration manager, services or application runtime', async () => {
const entry = resolve(root, '../../config/src/contracts/backtest.ts');
expect(runtimeImports(entry).sort()).toEqual(['@stock-bot/types', 'zod']);
expect(runtimeImports(entry).sort()).toEqual(['./canonical-research', '@stock-bot/types', 'zod']);
const bundle = await Bun.build({ entrypoints: [entry], target: 'browser' });
expect(bundle.success).toBe(true);
const code = await bundle.outputs[0]?.text();
@ -87,9 +88,9 @@ describe('orchestrator architecture boundaries', () => {
it('shared strategy catalog contracts cannot import strategy execution or application services', async () => {
const directory = resolve(root, '../../config/src/contracts');
for (const name of ['strategy.ts', 'builtin-strategy.ts', 'strategy-names.ts']) {
for (const name of ['strategy.ts', 'builtin-strategy.ts', 'strategy-names.ts', 'canonical-research.ts', 'canonical-replay.ts']) {
for (const specifier of runtimeImports(join(directory, name))) {
expect(['zod', '@stock-bot/types', './builtin-strategy', './strategy-names'].includes(specifier)).toBe(true);
expect(['zod', '@stock-bot/types', './builtin-strategy', './strategy-names', './strategy', './canonical-replay'].includes(specifier)).toBe(true);
}
}
const bundle = await Bun.build({