Separate backtest playback, market projection, and reporting

This commit is contained in:
Boki 2026-10-21 14:03:54 -04:00
parent 694c48bbdb
commit 366d39001b
12 changed files with 1642 additions and 1007 deletions

View file

@ -98,4 +98,21 @@ describe('orchestrator architecture boundaries', () => {
expect(readFileSync(file, 'utf8')).not.toMatch(/switch\s*\(\s*config\.name/);
expect(imports.get(join(root, 'strategies/StrategyRegistry.ts'))).toEqual([]);
});
it('backtest playback cannot depend on trading, data, reporting or service adapters', () => {
const dependencies = [...reachable(join(root, 'backtest/BacktestPlayback.ts'))].map(file => relative(root, file)).sort();
expect(dependencies).toEqual(['backtest/BacktestPlayback.ts', 'backtest/execution-engine.ts']);
});
it('backtest reports are independent of run control, native engines, data loading and financial mutation', () => {
for (const entry of ['backtest/BacktestReport.ts', 'backtest/report-format.ts']) {
for (const file of reachable(join(root, entry))) {
expect(relative(root, file)).not.toMatch(/^(services|strategies|core|data|execution)\//);
expect(relative(root, file)).not.toMatch(/backtest\/(BacktestEngine|BacktestMarket|BacktestRunner|BacktestPlayback)/);
for (const specifier of imports.get(file) ?? []) {
expect(specifier.startsWith('.') || ['simple-statistics', 'zod', '@stock-bot/invariants', '@stock-bot/logger'].includes(specifier)).toBe(true);
}
}
}
});
});