refactor(orchestrator): require canonical research contracts (CL14)

This commit is contained in:
Boki 2026-10-26 19:22:01 -04:00
parent bc2b8a89da
commit 21666242f4
37 changed files with 151 additions and 319 deletions

View file

@ -145,7 +145,7 @@ class FixtureEngine extends EventEmitter {
stopped = gate();
mode: 'trades' | 'empty' | 'fail' = 'trades';
private cancelled = false;
private readonly engine = new RustBacktestAdapter({ logger, storage }, { timeoutMs: 15000 });
private readonly engine = new RustBacktestAdapter({ logger }, { timeoutMs: 15000 });
async runBacktest(): Promise<never> {
throw new Error('Legacy execution is retired');
}
@ -325,16 +325,7 @@ export async function fixture(browser: Browser, native = false) {
maxAttempts: 3,
});
const controlled = new FixtureEngine();
const historicalDataReads: string[] = [];
const runStorage: Pick<StorageService, 'getHistoricalBars'> = {
async getHistoricalBars(...args) {
historicalDataReads.push(args[0]);
return storage.getHistoricalBars(...args);
},
};
const engine = native
? new RustBacktestAdapter({ logger, storage: runStorage }, { timeoutMs: 15000 })
: controlled;
const engine = native ? new RustBacktestAdapter({ logger }, { timeoutMs: 15000 }) : controlled;
const canonicalFailures: string[] = [];
if (engine instanceof RustBacktestAdapter) {
const executeCanonical = engine.runCanonical.bind(engine);
@ -348,7 +339,6 @@ export async function fixture(browser: Browser, native = false) {
}
const runner = new BacktestRunner({
engine,
engineName: 'native',
repository: new PostgresBacktestRunRepository(postgres, 2000),
logger,
heartbeatMs: 50,
@ -617,7 +607,6 @@ export async function fixture(browser: Browser, native = false) {
login,
close,
unexpectedNetwork,
historicalDataReads,
storedSourceReads,
setStoredEodBars: (collection: string, bars: StoredEodBar[]) => {
storedEodBars.set(collection, structuredClone(bars));