feat(research): retain immutable strategy versions and review history

This commit is contained in:
Boki 2026-10-23 19:35:56 -04:00
parent b106c1ca85
commit 4a2e5ad362
36 changed files with 3236 additions and 148 deletions

View file

@ -65,7 +65,7 @@ describe('orchestrator architecture boundaries', () => {
path === 'backtest/native-worker-protocol.ts'
).toBe(true);
for (const specifier of imports.get(file) ?? []) {
expect(specifier.startsWith('.') || ['zod', '@stock-bot/types', '@stock-bot/stock-config/backtest'].includes(specifier)).toBe(
expect(specifier.startsWith('.') || ['zod', '@stock-bot/types', '@stock-bot/stock-config/backtest', '@stock-bot/stock-config/strategy'].includes(specifier)).toBe(
true
);
}
@ -85,6 +85,32 @@ describe('orchestrator architecture boundaries', () => {
expect(code).not.toContain('engine.node');
});
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 specifier of runtimeImports(join(directory, name))) {
expect(['zod', '@stock-bot/types', './builtin-strategy', './strategy-names'].includes(specifier)).toBe(true);
}
}
const bundle = await Bun.build({
entrypoints: [join(directory, 'strategy.ts')], target: 'browser',
plugins: [{
name: 'current-contract-types',
setup(builder) {
builder.onResolve({ filter: /^@stock-bot\/types$/ }, () => ({
path: fileURLToPath(new URL('../../libs/core/types/src/index.ts', import.meta.url)),
}));
},
}],
});
expect(bundle.success).toBe(true);
const code = await bundle.outputs[0]?.text();
expect(code).toBeDefined();
for (const forbidden of ['config-instance', 'PostgresClient', 'engine.node', 'createBuiltinStrategy']) {
expect(code).not.toContain(forbidden);
}
});
it('recovery and the ledger port do not depend on concrete adapters, strategies or the service container', () => {
for (const entry of [
'execution/SimulationExecution.ts',