refactor(orchestrator): require canonical research contracts (CL14)
This commit is contained in:
parent
bc2b8a89da
commit
21666242f4
37 changed files with 151 additions and 319 deletions
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ test('operator_provisions_bounded_agent_views_usage_and_revokes_without_corrupti
|
|||
await f.page.reload();
|
||||
await visible(f.page, /Disabled · Revision 2/);
|
||||
expect(await f.page.getByLabel('New research token', { exact: true }).count()).toBe(0);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -503,7 +502,6 @@ test('saved_experiment_comparison_preserves_cost_reference_native_summaries_and_
|
|||
referenceKey
|
||||
);
|
||||
expect(await durableCounts()).toEqual(before);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -668,7 +666,6 @@ test('cost_sensitivity_freezes_policy_runs_native_scenarios_and_reopens_existing
|
|||
.locator(`a[href="/backtests/${backtest.id}/run/${experiment.trials[2]!.runId}"]`)
|
||||
.click();
|
||||
await visible(f.page, 'Canonical research result');
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -925,7 +922,6 @@ test('walk_forward_freezes_all_windows_runs_native_members_and_reopens_reset_rep
|
|||
);
|
||||
expect((await f.pool.query('SELECT * FROM runs')).rowCount).toBe(8);
|
||||
expect((await f.pool.query('SELECT * FROM analysis_artifacts')).rowCount).toBe(2);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -1053,7 +1049,6 @@ test('chronological_preflight_checks_explicit_windows_without_admitting_or_savin
|
|||
await visible(f.page, /No experiments yet/);
|
||||
expect(await preparedInputs.count()).toBe(0);
|
||||
expect(await evidence()).toEqual(before);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -1250,7 +1245,6 @@ test('durable_chronological_training_fixed_holdouts_report_and_reopen_browser',
|
|||
await visible(f.page, 'Saved chronological validations');
|
||||
await f.page.locator(`a[href="/experiments/validation/${admitted.id}"]`).click();
|
||||
await visible(f.page, 'Execution complete · report saved');
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -1410,7 +1404,6 @@ test('failed_experiment_trial_retry_preserves_history_and_reopens_native_result_
|
|||
await visible(f.page, 'Canonical research result');
|
||||
const result = (await f.request(`/api/v2/runs/${runId}/results`)) as CanonicalRunResult;
|
||||
expect(result.request).toEqual(failed.request_snapshot);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -1593,7 +1586,6 @@ test('retained_experiment_preview_submit_compare_cancel_and_reopen_browser', asy
|
|||
expect(cancelled.trials.every(trial => trial.metrics === null)).toBe(true);
|
||||
expect((await f.pool.query('SELECT * FROM backtest_results')).rowCount).toBe(3);
|
||||
expect((await f.request(`/api/v2/experiments/${experiment.id}`)).experiment).toEqual(completed);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -1989,7 +1981,6 @@ test('browser_legacy_frozen_history_reopens_without_reactivating_retired_executi
|
|||
expect((await f.pool.query('SELECT * FROM runs')).rowCount).toBe(1);
|
||||
expect((await f.pool.query('SELECT * FROM backtest_dispatch')).rowCount).toBe(0);
|
||||
expect(await f.request(`/api/v2/runs/${runId}/results`)).toEqual(result);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
|
|
@ -3003,7 +2994,6 @@ test('research_project_to_finding_browser_with_canonical_strategy_setup_run_and_
|
|||
.rows[0].original_run_id
|
||||
).toBe(run.id);
|
||||
expect((await f.pool.query('SELECT * FROM backtest_results')).rowCount).toBe(3);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
expect(f.storedSourceReads).toHaveLength(2);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
} finally {
|
||||
|
|
@ -3264,7 +3254,6 @@ test('isolated_candidate_publication_research_validation_and_reviewed_paper_hist
|
|||
(await f.request(`/api/v2/paper-deployments/${deployment.id}`)).preview.strategy.versionId
|
||||
).toBe(version.id);
|
||||
expect(f.unexpectedNetwork).toEqual([]);
|
||||
expect(f.historicalDataReads).toEqual([]);
|
||||
} finally {
|
||||
await f.close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue