refactor(orchestrator): return validated worker results (CL20)

This commit is contained in:
Boki 2026-10-26 20:40:58 -04:00
parent 6055aeeee9
commit 8a5d0c3ef2
8 changed files with 145 additions and 23 deletions

View file

@ -15,7 +15,6 @@ import {
type BacktestExecutionEngine,
} from './execution-engine';
import type { NativeBacktestResult } from './native-result';
import { parseRetainedStrategyResult } from './native-worker-protocol';
import { NativeBacktestWorker } from './NativeBacktestWorker';
export type BacktestResult = NativeBacktestResult;
@ -65,7 +64,7 @@ export class RustBacktestAdapter extends EventEmitter implements BacktestExecuti
async (signal, aborted) => {
const dataset = await Promise.race([resolveDataset(signal), aborted]);
signal.throwIfAborted();
const raw = await this.worker.execute(
const result = await this.worker.executeRetained(
{
type: 'runRetainedStrategy',
request,
@ -80,7 +79,6 @@ export class RustBacktestAdapter extends EventEmitter implements BacktestExecuti
this.publish('progress', progress);
}
);
const result = parseRetainedStrategyResult(raw, request);
this.currentTime = dataset.manifest.bounds.tradeEnd;
return { financial: result.financial, analytics: result.analytics };
}