diff --git a/apps/stock/orchestrator/src/backtest/BacktestEngine.ts b/apps/stock/orchestrator/src/backtest/BacktestEngine.ts index 6fb04aad..1a819f12 100644 --- a/apps/stock/orchestrator/src/backtest/BacktestEngine.ts +++ b/apps/stock/orchestrator/src/backtest/BacktestEngine.ts @@ -14,7 +14,7 @@ import type { BacktestConfig } from '../types'; import { BacktestMarket } from './BacktestMarket'; import { BacktestPlayback, type PlaybackProgress } from './BacktestPlayback'; import { BacktestReport } from './BacktestReport'; -import type { BacktestExecutionEngine } from './execution-engine'; +import type { LegacyBacktestExecutionEngine } from './execution-engine'; import { closedTradesSchema } from './native-result'; import { backtestStrategies } from './strategy-plan'; import type { BacktestResult } from './typescript-result'; @@ -23,7 +23,7 @@ export type { BacktestResult } from './typescript-result'; const speeds = { max: null, realtime: 1, '2x': 2, '5x': 5, '10x': 10 } as const; /** Composes one run's playback, market projection and report. The runner owns durable lifecycle. */ -export class BacktestEngine extends EventEmitter implements BacktestExecutionEngine { +export class BacktestEngine extends EventEmitter implements LegacyBacktestExecutionEngine { private playback?: BacktestPlayback; private active?: Promise; private completedReport?: BacktestReport; diff --git a/apps/stock/orchestrator/src/backtest/BacktestRunner.ts b/apps/stock/orchestrator/src/backtest/BacktestRunner.ts index 8fe67fe7..e02135e8 100644 --- a/apps/stock/orchestrator/src/backtest/BacktestRunner.ts +++ b/apps/stock/orchestrator/src/backtest/BacktestRunner.ts @@ -57,7 +57,6 @@ export class BacktestRunner extends EventEmitter { constructor( private readonly dependencies: { engine: BacktestExecutionEngine; - engineName: Exclude; repository: BacktestRunRepository; logger: Pick; heartbeatMs?: number; @@ -222,9 +221,6 @@ export class BacktestRunner extends EventEmitter { }; this.dependencies.engine.on('progress', onProgress); try { - if (!this.dependencies.repository.startCanonical) { - throw new Error('Canonical run repository is unavailable'); - } this.active = await this.dependencies.repository.startCanonical(config); if ( this.active.executionDeadlineAt !== undefined && @@ -283,18 +279,13 @@ export class BacktestRunner extends EventEmitter { { const engine = this.dependencies.engine; const repository = this.dependencies.repository; - const loadCanonicalDataset = repository.loadCanonicalDataset; - if (!engine.runCanonical || !loadCanonicalDataset || !repository.completeCanonical) { - throw new Error('Canonical execution capabilities are unavailable'); - } const claim = this.active; // Resolve retained data through the owning attempt. The adapter supplies its // abort signal; neither this callback nor the worker fetches fresh provider bars. const report = await engine.runCanonical( executionConfig, signal => - loadCanonicalDataset.call( - repository, + repository.loadCanonicalDataset( claim.runId, claim.attemptId, executionConfig.datasetHash, @@ -324,12 +315,8 @@ export class BacktestRunner extends EventEmitter { if (this.leaseFailure) { throw this.leaseFailure; } - const completeCanonical = this.dependencies.repository.completeCanonical; - if (!completeCanonical) { - throw new Error('Canonical result persistence is unavailable'); - } checkDeadline(); - await completeCanonical.call(this.dependencies.repository, result, this.active.attemptId); + await this.dependencies.repository.completeCanonical(result, this.active.attemptId); // Observers cannot turn a committed success into a failed run. this.publish('complete', result); return result; @@ -450,36 +437,21 @@ export class BacktestRunner extends EventEmitter { await this.dependencies.engine.shutdown(); } } - /** Compatibility control; the engine must accept it before SQL records a pause. */ - async pauseBacktest(runId?: string) { - const active = this.requireActive(runId); - await this.dependencies.engine.pauseBacktest(); - await this.dependencies.repository.updateControl( - active.runId, - { status: 'paused' }, - active.attemptId - ); + /** Retained control routes reject playback operations without mutating durable state. */ + async pauseBacktest(runId?: string): Promise { + this.requireActive(runId); + throw new Error('Native backtests do not support pause'); } - async resumeBacktest(runId?: string) { - const active = this.requireActive(runId); - await this.dependencies.engine.resumeBacktest(); - await this.dependencies.repository.updateControl( - active.runId, - { status: 'running' }, - active.attemptId - ); + async resumeBacktest(runId?: string): Promise { + this.requireActive(runId); + throw new Error('Native backtests do not support resume'); } - async setSpeedMultiplier(speed: number | null, runId?: string) { + async setSpeedMultiplier(speed: number | null, runId?: string): Promise { if (speed !== null && (!Number.isFinite(speed) || speed <= 0)) { throw new Error('Backtest speed must be positive or null'); } - const active = this.requireActive(runId); - this.dependencies.engine.setSpeedMultiplier(speed); - await this.dependencies.repository.updateControl( - active.runId, - { speedMultiplier: speed }, - active.attemptId - ); + this.requireActive(runId); + throw new Error('Native backtests run at maximum speed'); } /** Local worker projection; persisted run status remains authoritative after restart. */ getStatus() { diff --git a/apps/stock/orchestrator/src/backtest/RustBacktestAdapter.ts b/apps/stock/orchestrator/src/backtest/RustBacktestAdapter.ts index 9c92ffc8..d4ba39d6 100644 --- a/apps/stock/orchestrator/src/backtest/RustBacktestAdapter.ts +++ b/apps/stock/orchestrator/src/backtest/RustBacktestAdapter.ts @@ -7,7 +7,6 @@ import { } from '@stock-bot/stock-config/canonical-research'; import type { HistoricalDatasetV2 } from '@stock-bot/types'; import type { DatasetResolver } from '../data/historical-dataset'; -import type { StorageService } from '../services/StorageService'; import type { BacktestConfig } from '../types'; import { BacktestCancelledError, @@ -33,7 +32,6 @@ export class RustBacktestAdapter extends EventEmitter implements BacktestExecuti constructor( private readonly dependencies: { logger: Pick; - storage: Pick; }, options: { timeoutMs?: number; workerUrl?: URL } = {} ) { diff --git a/apps/stock/orchestrator/src/backtest/execution-engine.ts b/apps/stock/orchestrator/src/backtest/execution-engine.ts index 636da88a..8d31cce5 100644 --- a/apps/stock/orchestrator/src/backtest/execution-engine.ts +++ b/apps/stock/orchestrator/src/backtest/execution-engine.ts @@ -9,21 +9,14 @@ import type { BacktestConfig } from '../types'; import type { NativeBacktestResult } from './native-result'; import type { BacktestResult } from './typescript-result'; -/** The runner depends on execution capabilities, not backend implementations. */ +/** Capabilities required by the canonical durable runner. No provider loading or playback. */ export interface BacktestExecutionEngine extends Pick { - runBacktest( - config: BacktestConfig, - dataset?: DatasetResolver - ): Promise; - runCanonical?( + runCanonical( request: CanonicalRunRequest, resolveDataset: (signal: AbortSignal) => Promise, controls?: { executionDeadlineAt?: number } ): Promise>; stopBacktest(): Promise; - pauseBacktest(): Promise; - resumeBacktest(): Promise; - setSpeedMultiplier(speed: number | null): void; getStatus(): { isRunning: boolean; isPaused: boolean; @@ -33,6 +26,18 @@ export interface BacktestExecutionEngine extends Pick; } +/** Retained algorithm/playback examples only; cannot satisfy the durable runner contract. */ +export interface LegacyBacktestExecutionEngine + extends Pick { + runBacktest( + config: BacktestConfig, + dataset?: DatasetResolver + ): Promise; + pauseBacktest(): Promise; + resumeBacktest(): Promise; + setSpeedMultiplier(speed: number | null): void; +} + /** Cancellation has no result when a native worker is forcibly stopped. */ export class BacktestCancelledError extends Error { constructor() { diff --git a/apps/stock/orchestrator/src/backtest/run-repository.ts b/apps/stock/orchestrator/src/backtest/run-repository.ts index 56e2dcc5..fc86a604 100644 --- a/apps/stock/orchestrator/src/backtest/run-repository.ts +++ b/apps/stock/orchestrator/src/backtest/run-repository.ts @@ -21,34 +21,21 @@ export interface CanonicalRunClaim extends RunIdentity { config: CanonicalRunRequest; } -/** Every execution write must prove ownership of an unexpired attempt. */ +/** Canonical execution only; every write proves ownership of an unexpired attempt. + * Concrete compatibility methods for older saved runs are outside this contract. */ export interface BacktestRunRepository { - start(config: BacktestConfig): Promise; /** Only already admitted canonical rows may be claimed; no implicit creation. */ - startCanonical?(request: CanonicalRunRequest): Promise; - loadCanonicalDataset?( + startCanonical(request: CanonicalRunRequest): Promise; + loadCanonicalDataset( runId: string, attemptId: string, requestedHash: string, signal?: AbortSignal ): Promise; - completeCanonical?(result: CanonicalRunResult, attemptId: string): Promise; + completeCanonical(result: CanonicalRunResult, attemptId: string): Promise; load(runId: string): Promise<{ status: string; config: unknown } | null>; rejectPending(runId: string, error: string): Promise; heartbeat(runId: string, attemptId: string): Promise<{ cancelRequested: boolean }>; - loadDataset( - runId: string, - attemptId: string, - requestedHash?: string, - signal?: AbortSignal - ): Promise; - freezeDataset( - runId: string, - attemptId: string, - dataset: HistoricalDataset, - signal?: AbortSignal - ): Promise; - complete(result: BacktestRunResult, attemptId: string): Promise; updateProgress( runId: string, progress: number, @@ -57,11 +44,6 @@ export interface BacktestRunRepository { ): Promise; fail(runId: string, error: string, attemptId: string): Promise; cancel(runId: string, attemptId: string): Promise; - updateControl( - runId: string, - update: { status?: 'running' | 'paused'; speedMultiplier?: number | null }, - attemptId: string - ): Promise; } export class BacktestConflictError extends Error {} export class BacktestLeaseLostError extends BacktestConflictError {} @@ -71,6 +53,16 @@ export class UnavailableBacktestRunRepository implements BacktestRunRepository { private unavailable(): never { throw new Error('Backtest execution requires a PostgreSQL run repository'); } + async startCanonical(_request: CanonicalRunRequest): Promise { + return this.unavailable(); + } + async loadCanonicalDataset(): Promise { + return this.unavailable(); + } + async completeCanonical(_result: CanonicalRunResult, _attemptId: string): Promise { + this.unavailable(); + } + /** Compatibility diagnostics for callers of the retired repository surface. */ async start(_config: BacktestConfig): Promise { return this.unavailable(); } diff --git a/apps/stock/orchestrator/src/container.ts b/apps/stock/orchestrator/src/container.ts index a851cc34..9d97f75b 100644 --- a/apps/stock/orchestrator/src/container.ts +++ b/apps/stock/orchestrator/src/container.ts @@ -152,10 +152,9 @@ export async function registerOrchestratorServices( () => new BacktestRunner({ engine: new RustBacktestAdapter( - { logger: services.logger, storage: storageService }, + { logger: services.logger }, { timeoutMs: options.nativeExecutionTimeoutMs } ), - engineName: 'native', repository: services.postgres ? new PostgresBacktestRunRepository(services.postgres) : new UnavailableBacktestRunRepository(), diff --git a/docs/development/backlog/manifest.json b/docs/development/backlog/manifest.json index d09f2cfd..58649cf6 100644 --- a/docs/development/backlog/manifest.json +++ b/docs/development/backlog/manifest.json @@ -2706,7 +2706,7 @@ "epic": "E11", "priority": "P1", "severity": "High", - "status": "in_progress", + "status": "done", "dependencies": [], "decision_dependencies": [], "task_file": "backlog/tasks/CL14.md", @@ -2734,10 +2734,17 @@ "completed_commit": null, "blocker": null, "release_gates": [], - "integration_state": "not_started", + "integration_state": "validated_pending_commit", "integration_base": "700ee09c", "completion_evidence": "orchestrator-engine-cleanup.md", - "worktree": "/tmp/stock-bot-engine-cleanup-20261026/cl14" + "worktree": "/tmp/stock-bot-engine-cleanup-20261026/cl14", + "reviewed_by": "/root (independent of implement_cl14)", + "review_notes": "Accepted required canonical interfaces and preserved retirement/control behavior. Root validation:91 focused tests,33 canonical/legacy durable PostgreSQL tests; types/contracts/build pass.", + "validation": { + "focused": "91 pass,6888 assertions across6 files", + "postgres": "33 pass,181 assertions across canonical-durable-backtest and durable-backtest; disposable stock_bot_safety database/Redis15", + "static": "Orchestrator build, application typecheck, negative contract fixtures and diff checks pass" + } }, { "id": "CL15", @@ -2775,10 +2782,10 @@ ], "assignment": "/root/implement_cl15", "branch": "cleanup/cl15-rust-scaffolding", - "completed_commit": null, + "completed_commit": "bc2b8a89", "blocker": null, "release_gates": [], - "integration_state": "validated_pending_commit", + "integration_state": "validated_committed", "integration_base": "700ee09c", "completion_evidence": "orchestrator-engine-cleanup.md", "worktree": "/tmp/stock-bot-engine-cleanup-20261026/cl15", @@ -2789,7 +2796,8 @@ "focused": "75 pass,6625 assertions; bindings/terminal-equity/market-data/architecture", "rust": "150 pass,4 ignored", "diff": "git diff --check passed" - } + }, + "implementation_commit": "bc2b8a89" }, { "id": "CL16", diff --git a/docs/development/orchestrator-engine-cleanup.md b/docs/development/orchestrator-engine-cleanup.md index 3b68d2dd..c5d556be 100644 --- a/docs/development/orchestrator-engine-cleanup.md +++ b/docs/development/orchestrator-engine-cleanup.md @@ -30,3 +30,11 @@ Implementation records will be appended here as tasks pass review and validation Removed 24 unused adapter/alternate-architecture files; moved two uncompiled reporting prototypes byte-for-byte into `engine/reference/legacy-reporting/` with explicit limitations. `MIGRATION.md` records every removal/preservation and current boundaries. Only compiled-code change removes the unused adapter module; canonical finance, legacy algorithms and native exports are unchanged. Implemented by `/root/implement_cl15`; independently reviewed/integrated by `/root`. Both preserved files were compared against baseline bytes. Root rebuilt the addon and ran `bun test scripts/test/native-bindings.test.ts test/integration/native-terminal-equity.test.ts test/integration/native-market-data.test.ts scripts/test/architecture.test.ts`: 75 passed. `cargo test -p engine --lib --offline`: 150 passed, 4 ignored. `git diff --check` passed. The sandbox initially prevented NAPI from spawning `/bin/sh`; the authorized rebuild succeeded. No performance claim or stored-artifact migration. + +### CL14 — accepted + +The durable runner now requires canonical engine/repository capabilities. Legacy playback uses an explicit separate interface; concrete compatibility methods and historical formats remain. Removed unused adapter storage and runner engineName. Existing pause/resume/speed routes keep their production rejection behavior without SQL control writes. Negative type fixtures reject missing canonical capabilities. + +Implemented by `/root/implement_cl14`; independently reviewed/integrated by `/root`. Root rebuilt the orchestrator and passed application typecheck/contract tests. Focused runner/workflow/worker/pool/isolation/architecture suite: 91 passed, 6,888 assertions. Disposable PostgreSQL canonical and retained durable-run suites: 33 passed, 181 assertions. No SQL/native/economic policy changes. Worker tests required execution outside the sandbox; two transient worktree Bun dependency-reading failures passed on separate reruns and root integration. Legacy-only provider-spy assertions were removed with the unused injection, not replaced with fabricated coverage. Full combined repository gate follows CL16 integration. + +CL15 implementation commit: `bc2b8a89`. diff --git a/test/contracts/canonical-runner.type-test.ts b/test/contracts/canonical-runner.type-test.ts new file mode 100644 index 00000000..f25548d3 --- /dev/null +++ b/test/contracts/canonical-runner.type-test.ts @@ -0,0 +1,36 @@ +import { BacktestRunner } from '../../apps/stock/orchestrator/src/backtest/BacktestRunner'; +import type { + BacktestExecutionEngine, + LegacyBacktestExecutionEngine, +} from '../../apps/stock/orchestrator/src/backtest/execution-engine'; +import type { BacktestRunRepository } from '../../apps/stock/orchestrator/src/backtest/run-repository'; +import { RustBacktestAdapter } from '../../apps/stock/orchestrator/src/backtest/RustBacktestAdapter'; + +function canonicalDependencies( + engine: BacktestExecutionEngine, + legacy: LegacyBacktestExecutionEngine, + repository: BacktestRunRepository, + withoutReplay: Omit, + withoutClaim: Omit, + withoutDataset: Omit, + withoutCompletion: Omit +) { + const logger = { error() {} }; + new BacktestRunner({ engine, repository, logger }); + // @ts-expect-error Canonical replay is mandatory; a legacy playback engine is insufficient. + new BacktestRunner({ engine: legacy, repository, logger }); + // @ts-expect-error The current runner cannot be composed without canonical execution. + new BacktestRunner({ engine: withoutReplay, repository, logger }); + // @ts-expect-error Canonical claim custody is mandatory. + new BacktestRunner({ engine, repository: withoutClaim, logger }); + // @ts-expect-error Retained canonical dataset loading is mandatory. + new BacktestRunner({ engine, repository: withoutDataset, logger }); + // @ts-expect-error Canonical completion persistence is mandatory. + new BacktestRunner({ engine, repository: withoutCompletion, logger }); + // @ts-expect-error Current execution does not accept provider storage dependencies. + new RustBacktestAdapter({ logger, storage: { getHistoricalBars: async () => [] } }); + // @ts-expect-error The canonical runner cannot select a competing engine by name. + new BacktestRunner({ engine, repository, logger, engineName: 'typescript' }); +} + +void canonicalDependencies; diff --git a/test/e2e/fixture.ts b/test/e2e/fixture.ts index 12e83b91..b88659d8 100644 --- a/test/e2e/fixture.ts +++ b/test/e2e/fixture.ts @@ -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 { 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 = { - 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)); diff --git a/test/e2e/workbench.test.ts b/test/e2e/workbench.test.ts index c4987b85..29022910 100644 --- a/test/e2e/workbench.test.ts +++ b/test/e2e/workbench.test.ts @@ -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(); } diff --git a/test/fixtures/backtest-crash-owner.ts b/test/fixtures/backtest-crash-owner.ts index e7b9afef..5ea3ab16 100644 --- a/test/fixtures/backtest-crash-owner.ts +++ b/test/fixtures/backtest-crash-owner.ts @@ -5,7 +5,6 @@ import { PostgreSQLClient } from '@stock-bot/postgres'; import { BacktestRunner } from '../../apps/stock/orchestrator/src/backtest/BacktestRunner'; import { PostgresBacktestRunRepository } from '../../apps/stock/orchestrator/src/backtest/PostgresBacktestRunRepository'; import { RustBacktestAdapter } from '../../apps/stock/orchestrator/src/backtest/RustBacktestAdapter'; -import { StorageService } from '../../apps/stock/orchestrator/src/services/StorageService'; setLoggerConfig({ logLevel: 'fatal', logConsole: false }); const url = process.env.PIPELINE_TEST_DATABASE_URL; @@ -35,9 +34,7 @@ repository.loadCanonicalDataset = async () => { const runner = new BacktestRunner({ engine: new RustBacktestAdapter({ logger, - storage: new StorageService({ logger }, null, null, null), }), - engineName: 'native', repository, logger, heartbeatMs: 50, diff --git a/test/fixtures/canonical-runner.ts b/test/fixtures/canonical-runner.ts index 3e31fed1..51cf0a9b 100644 --- a/test/fixtures/canonical-runner.ts +++ b/test/fixtures/canonical-runner.ts @@ -68,9 +68,6 @@ export function canonicalRunnerFixture() { let heartbeatFailure = false; let status = 'pending'; const repo: BacktestRunRepository = { - async start() { - throw new Error('legacy claim must not run'); - }, async startCanonical(input) { events.push('claim'); status = 'running'; @@ -95,20 +92,11 @@ export function canonicalRunnerFixture() { } return { cancelRequested: false }; }, - async loadDataset() { - throw new Error('v1 data must not run'); - }, - async freezeDataset() { - throw new Error('provider freeze must not run'); - }, async loadCanonicalDataset(_id, _attempt, hash) { expect(hash).toBe(dataset.manifest.hash); events.push('dataset'); return dataset; }, - async complete() { - throw new Error('legacy completion must not run'); - }, async completeCanonical(input) { events.push('complete'); result = input; @@ -125,12 +113,8 @@ export function canonicalRunnerFixture() { events.push('cancel'); status = 'cancelled'; }, - async updateControl() {}, }; const engine = Object.assign(new EventEmitter(), { - async runBacktest(): Promise { - throw new Error('legacy simulator must not run'); - }, async runCanonical( _input: typeof request, resolve: (signal: AbortSignal) => Promise @@ -146,9 +130,6 @@ export function canonicalRunnerFixture() { async stopBacktest() { events.push('stop'); }, - async pauseBacktest() {}, - async resumeBacktest() {}, - setSpeedMultiplier() {}, getStatus() { return { isRunning: false, isPaused: false, progress: 0, currentTime: 0 }; }, @@ -157,7 +138,6 @@ export function canonicalRunnerFixture() { const runner = new BacktestRunner({ engine, repository: repo, - engineName: 'native', logger, heartbeatMs: 5, heartbeatTimeoutMs: 50, diff --git a/test/fixtures/research-pool.ts b/test/fixtures/research-pool.ts index bffc1c26..cb962df8 100644 --- a/test/fixtures/research-pool.ts +++ b/test/fixtures/research-pool.ts @@ -148,11 +148,6 @@ export async function researchPoolFixture(dataset?: HistoricalDatasetV2) { const engines = repositories.map((_repository, slot) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars(): Promise { - throw new Error('Retained trials must not read a provider'); - }, - }, }); if (options.beforeExecute) { const execute = engine.runCanonical.bind(engine); @@ -168,7 +163,6 @@ export async function researchPoolFixture(dataset?: HistoricalDatasetV2) { new BacktestRunner({ engine, repository: repositories[i]!, - engineName: 'native', logger, heartbeatMs: options.heartbeatMs ?? 5000, }) diff --git a/test/integration/backtest-workflow.test.ts b/test/integration/backtest-workflow.test.ts index 5e628730..718b8e1c 100644 --- a/test/integration/backtest-workflow.test.ts +++ b/test/integration/backtest-workflow.test.ts @@ -82,15 +82,8 @@ describe('canonical production workflow and legacy retirement', () => { } ); test('legacy adapter and worker envelopes refuse before mutable storage or child process access', async () => { - let reads = 0; const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - reads++; - return []; - }, - }, }); await expect(engine.runBacktest(legacy)).rejects.toThrow(LEGACY_EXECUTION_RETIRED); const request = { type: 'run', config: legacy, data: [] }; @@ -98,7 +91,6 @@ describe('canonical production workflow and legacy retirement', () => { await expect( new NativeBacktestWorker().execute(request as never, new AbortController().signal, () => {}) ).rejects.toThrow(); - expect(reads).toBe(0); expect(engine.getStatus().isRunning).toBe(false); await engine.shutdown(); }); diff --git a/test/integration/canonical-durable-runner.test.ts b/test/integration/canonical-durable-runner.test.ts index 129111bf..04e64df3 100644 --- a/test/integration/canonical-durable-runner.test.ts +++ b/test/integration/canonical-durable-runner.test.ts @@ -1,9 +1,9 @@ import { describe, expect, test } from 'bun:test'; +import { BacktestCancelledError } from '../../apps/stock/orchestrator/src/backtest/execution-engine'; import { - BacktestCancelledError, - type BacktestExecutionEngine, -} from '../../apps/stock/orchestrator/src/backtest/execution-engine'; -import { BacktestLeaseLostError } from '../../apps/stock/orchestrator/src/backtest/run-repository'; + BacktestLeaseLostError, + UnavailableBacktestRunRepository, +} from '../../apps/stock/orchestrator/src/backtest/run-repository'; import { deferred, canonicalRunnerFixture as setup } from '../fixtures/canonical-runner'; describe('canonical jobs share the durable runner lifecycle', () => { @@ -47,31 +47,20 @@ describe('canonical jobs share the durable runner lifecycle', () => { expect(f.events).toEqual([]); await f.runner.shutdown(); }); - test('a runner without canonical execution fails without preparation or legacy/provider fallback', async () => { + test('unavailable canonical storage refuses before any execution or provider fallback', async () => { const f = setup(); - const engine: BacktestExecutionEngine = f.engine; - delete engine.runCanonical; - const fail = f.repo.fail.bind(f.repo); - let savedFailure: string | undefined; - f.repo.fail = async (runId, error, attemptId) => { - savedFailure = error; - await fail(runId, error, attemptId); - }; - try { - await expect(f.runner.runQueued(f.request.runId)).rejects.toThrow( - 'Canonical execution capabilities are unavailable' - ); - expect(savedFailure).toBe('Canonical execution capabilities are unavailable'); - expect(f.events).toEqual(['claim', 'heartbeat', 'fail']); - expect(f.result).toBeUndefined(); - expect(await f.runner.runQueued(f.request.runId)).toEqual({ - runId: f.request.runId, - status: 'failed', - }); - expect(f.events).toEqual(['claim', 'heartbeat', 'fail']); - } finally { - await f.runner.shutdown(); - } + const unavailable = new UnavailableBacktestRunRepository(); + f.repo.startCanonical = unavailable.startCanonical.bind(unavailable); + await expect(f.runner.runQueued(f.request.runId)).rejects.toThrow( + 'Backtest execution requires a PostgreSQL run repository' + ); + expect(f.events).toEqual([]); + expect(f.result).toBeUndefined(); + await expect(unavailable.loadCanonicalDataset()).rejects.toThrow('PostgreSQL run repository'); + await expect(unavailable.completeCanonical({} as never, 'attempt')).rejects.toThrow( + 'PostgreSQL run repository' + ); + await f.runner.shutdown(); }); test('cancel waits for execution to finish before committing cancellation', async () => { const f = setup(), diff --git a/test/integration/canonical-worker-lifecycle.test.ts b/test/integration/canonical-worker-lifecycle.test.ts index 0b57184c..a8b9b1bd 100644 --- a/test/integration/canonical-worker-lifecycle.test.ts +++ b/test/integration/canonical-worker-lifecycle.test.ts @@ -95,16 +95,9 @@ test('canonical adapter cancellation during retained dataset reads prevents a la const f = canonicalRunnerFixture(), entered = deferred(), release = deferred(); - let providerReads = 0, - progress = 0; + let progress = 0; const engine = new RustBacktestAdapter({ logger: { error() {} }, - storage: { - async getHistoricalBars() { - providerReads++; - return []; - }, - }, }); engine.on('progress', () => progress++); const result = engine @@ -119,7 +112,6 @@ test('canonical adapter cancellation during retained dataset reads prevents a la expect(await result).toBeInstanceOf(BacktestCancelledError); release.resolve(); await Promise.resolve(); - expect(providerReads).toBe(0); expect(progress).toBe(0); expect(engine.getStatus().isRunning).toBe(false); await engine.shutdown(); @@ -130,11 +122,6 @@ test('canonical adapter timeout covers retained input loading and shutdown close const engine = new RustBacktestAdapter( { logger: { error() {} }, - storage: { - async getHistoricalBars() { - throw new Error('provider must not run'); - }, - }, }, { timeoutMs: 20 } ); diff --git a/test/integration/ingestion-backtest.test.ts b/test/integration/ingestion-backtest.test.ts index 1abc5a0f..1fdf8358 100644 --- a/test/integration/ingestion-backtest.test.ts +++ b/test/integration/ingestion-backtest.test.ts @@ -341,9 +341,7 @@ describe('deterministic ingestion → storage → native backtest', () => { }); test('retired provider-at-execution entry refuses before storage or native strategy resolution', async () => { - const { mongodb } = memoryStore(); - const storage = new StorageService({ logger }, mongodb, null, null); - const engine = new RustBacktestAdapter({ logger, storage }); + const engine = new RustBacktestAdapter({ logger }); const config = BacktestConfigSchema.parse({ mode: 'backtest', symbols: ['FIXTURE.TEST'], diff --git a/test/integration/intraday-storage.test.ts b/test/integration/intraday-storage.test.ts index 03a584f1..7988b02d 100644 --- a/test/integration/intraday-storage.test.ts +++ b/test/integration/intraday-storage.test.ts @@ -181,7 +181,7 @@ describe('EOD intraday ingestion → research storage', () => { expect(validateDataset(JSON.parse(JSON.stringify(legacy))).manifest.hash).toBe( legacy.manifest.hash ); - const engine = new RustBacktestAdapter({ logger, storage }); + const engine = new RustBacktestAdapter({ logger }); await expect(engine.runBacktest(config(), async () => legacy)).rejects.toThrow( 'Legacy backtest execution is retired' ); diff --git a/test/integration/research-pool.test.ts b/test/integration/research-pool.test.ts index c01250e8..c459f3e1 100644 --- a/test/integration/research-pool.test.ts +++ b/test/integration/research-pool.test.ts @@ -2,10 +2,7 @@ import { randomUUID } from 'node:crypto'; import { afterEach, describe, expect, test } from 'bun:test'; import { Hono } from 'hono'; import { createBacktestRoutes } from '../../apps/stock/orchestrator/src/api/rest/backtest'; -import { - BacktestCancelledError, - type BacktestExecutionEngine, -} from '../../apps/stock/orchestrator/src/backtest/execution-engine'; +import { BacktestCancelledError } from '../../apps/stock/orchestrator/src/backtest/execution-engine'; import { ResearchBacktestPool } from '../../apps/stock/orchestrator/src/backtest/ResearchBacktestPool'; import { canonicalRunnerFixture, deferred } from '../fixtures/canonical-runner'; import { logger } from '../fixtures/execution'; @@ -300,25 +297,26 @@ describe('run-scoped controls and event streams', () => { f.slots[0]!.release.resolve(); await work[0]; }); - test('exactly one active run retains no-ID pause/resume/speed controls', async () => { + test('one active run preserves explicit rejection of unsupported playback controls', async () => { const f = fixture(1), work = await started(f), - controls: unknown[] = [], slot = f.slots[0]!; - slot.engine.pauseBacktest = async () => { - controls.push('pause'); - }; - slot.engine.resumeBacktest = async () => { - controls.push('resume'); - }; - (slot.engine as BacktestExecutionEngine).setSpeedMultiplier = speed => { - controls.push(speed); - }; - for (const action of ['pause', 'resume']) { - expect((await post(f.app, action)).status).toBe(200); + for (const [action, message] of [ + ['pause', 'Native backtests do not support pause'], + ['resume', 'Native backtests do not support resume'], + ['speed', 'Native backtests run at maximum speed'], + ] as const) { + for (const runId of [undefined, slot.request.runId]) { + const response = await post(f.app, action, { + ...(runId ? { runId } : {}), + ...(action === 'speed' ? { speed: null } : {}), + }); + expect(response.status).toBe(500); + expect(await response.json()).toMatchObject({ error: message }); + } } - expect((await post(f.app, 'speed', { speed: null })).status).toBe(200); - expect(controls).toEqual(['pause', 'resume', null]); + expect(slot.runner.getStatus().isPaused).toBe(false); + expect(slot.events).not.toContain('complete'); slot.release.resolve(); await work[0]; }); diff --git a/test/postgres/ai-research-workflow.test.ts b/test/postgres/ai-research-workflow.test.ts index 3520e975..90acc130 100644 --- a/test/postgres/ai-research-workflow.test.ts +++ b/test/postgres/ai-research-workflow.test.ts @@ -116,15 +116,9 @@ async function fixture() { app.route('/', createExperimentRoutes(container)); const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Research must use the frozen dataset'); - }, - }, }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); diff --git a/test/postgres/canonical-durable-backtest.test.ts b/test/postgres/canonical-durable-backtest.test.ts index 5203b498..0423c3dc 100644 --- a/test/postgres/canonical-durable-backtest.test.ts +++ b/test/postgres/canonical-durable-backtest.test.ts @@ -158,16 +158,10 @@ async function fixture(options: { corruptDataset?: boolean; buildMismatch?: bool await pool.query('INSERT INTO backtest_dispatch(run_id) VALUES ($1)', [runId]); }; const repository = new PostgresBacktestRunRepository(postgres, 5000); - const storage = { - async getHistoricalBars(): Promise { - throw new Error('Canonical replay must never fetch provider data'); - }, - }; - const engine = new RustBacktestAdapter({ logger, storage }, { timeoutMs: 10000 }); + const engine = new RustBacktestAdapter({ logger }, { timeoutMs: 10000 }); const runner = new BacktestRunner({ engine, repository, - engineName: 'native', logger, heartbeatMs: 20, }); diff --git a/test/postgres/canonical-research.test.ts b/test/postgres/canonical-research.test.ts index 3f628793..bc9def36 100644 --- a/test/postgres/canonical-research.test.ts +++ b/test/postgres/canonical-research.test.ts @@ -109,15 +109,9 @@ async function fixture(dataset = canonicalSmaFixture().dataset) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Canonical execution must never load provider data'); - }, - }, }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); diff --git a/test/postgres/chronological-validation-durable.test.ts b/test/postgres/chronological-validation-durable.test.ts index 4656caa7..d04266e9 100644 --- a/test/postgres/chronological-validation-durable.test.ts +++ b/test/postgres/chronological-validation-durable.test.ts @@ -173,13 +173,8 @@ async function fixture(poolMax = 1, withValidation = true) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('No provider reads allowed'); - }, - }, }); - const runner = new BacktestRunner({ engine, engineName: 'native', repository, logger }); + const runner = new BacktestRunner({ engine, repository, logger }); try { await runner.runQueued(id); } finally { diff --git a/test/postgres/cost-sensitivity.test.ts b/test/postgres/cost-sensitivity.test.ts index 8705fe81..d051d563 100644 --- a/test/postgres/cost-sensitivity.test.ts +++ b/test/postgres/cost-sensitivity.test.ts @@ -167,13 +167,8 @@ async function fixture(poolMax = 1, withCosts = true, capital = 10000) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('No provider reads allowed'); - }, - }, }); - const runner = new BacktestRunner({ engine, engineName: 'native', repository, logger }); + const runner = new BacktestRunner({ engine, repository, logger }); try { await runner.runQueued(id); } finally { diff --git a/test/postgres/durable-backtest.test.ts b/test/postgres/durable-backtest.test.ts index 5ab8520d..9c8fd773 100644 --- a/test/postgres/durable-backtest.test.ts +++ b/test/postgres/durable-backtest.test.ts @@ -203,10 +203,9 @@ async function fixture(historical = false) { }); }, } as unknown as StorageService; - const engine = new RustBacktestAdapter({ logger, storage }, { timeoutMs: 5_000 }); + const engine = new RustBacktestAdapter({ logger }, { timeoutMs: 5_000 }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository, logger, heartbeatMs: 50, diff --git a/test/postgres/experiment-comparison.test.ts b/test/postgres/experiment-comparison.test.ts index 61e8d0af..28f6802c 100644 --- a/test/postgres/experiment-comparison.test.ts +++ b/test/postgres/experiment-comparison.test.ts @@ -168,13 +168,8 @@ async function fixture(poolMax = 1, withCosts = true, capital = 10000) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('No provider reads allowed'); - }, - }, }); - const runner = new BacktestRunner({ engine, engineName: 'native', repository, logger }); + const runner = new BacktestRunner({ engine, repository, logger }); try { await runner.runQueued(id); } finally { diff --git a/test/postgres/experiment-retries.test.ts b/test/postgres/experiment-retries.test.ts index 91cf7ad5..34633f9e 100644 --- a/test/postgres/experiment-retries.test.ts +++ b/test/postgres/experiment-retries.test.ts @@ -123,15 +123,9 @@ async function fixture(poolMax = 4, withRetries = true) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Canonical execution must never load provider data'); - }, - }, }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); @@ -191,11 +185,6 @@ async function failBeforeClaim( async function nativeResult(f: Fixture, request: CanonicalRunRequest): Promise { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Provider access forbidden'); - }, - }, }); try { return { diff --git a/test/postgres/experiments.test.ts b/test/postgres/experiments.test.ts index 7e7014d1..d4fbfc09 100644 --- a/test/postgres/experiments.test.ts +++ b/test/postgres/experiments.test.ts @@ -119,15 +119,9 @@ async function fixture(poolMax = 4, withExperiments = true) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Canonical execution must never load provider data'); - }, - }, }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); @@ -488,11 +482,6 @@ describe.skipIf(!url)('retained-input experiments', () => { await f.pool.query("UPDATE runs SET status='paused' WHERE id=$1", [requests[2]!.runId]); const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Provider access forbidden'); - }, - }, }); let computed; try { diff --git a/test/postgres/isolated-candidates.test.ts b/test/postgres/isolated-candidates.test.ts index fb14fd54..36f2f7e4 100644 --- a/test/postgres/isolated-candidates.test.ts +++ b/test/postgres/isolated-candidates.test.ts @@ -105,15 +105,9 @@ async function fixture() { const execute = async (runId: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Candidate must use retained data only'); - }, - }, }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); diff --git a/test/postgres/paper-deployments.test.ts b/test/postgres/paper-deployments.test.ts index 301d037d..8f90a71a 100644 --- a/test/postgres/paper-deployments.test.ts +++ b/test/postgres/paper-deployments.test.ts @@ -151,13 +151,8 @@ async function fixture(max = 1, withPromotion = true, candidate = false) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('No provider allowed'); - }, - }, }); - const runner = new BacktestRunner({ engine, engineName: 'native', repository, logger }); + const runner = new BacktestRunner({ engine, repository, logger }); try { await runner.runQueued(id); } finally { diff --git a/test/postgres/research-agents.test.ts b/test/postgres/research-agents.test.ts index ec0a8fd3..04cd65a7 100644 --- a/test/postgres/research-agents.test.ts +++ b/test/postgres/research-agents.test.ts @@ -126,15 +126,9 @@ async function fixture(poolMax = 4, withAgents = true, dataset = canonicalSmaFix const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Canonical execution must never load provider data'); - }, - }, }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); @@ -810,11 +804,6 @@ describe.skipIf(!url)('authoritative research principals and budgets', () => { request = await requestFor(f, id); const engine = new RustBacktestAdapter({ logger, - storage: { - getHistoricalBars: async () => { - throw new Error('Provider forbidden'); - }, - }, }); let economic: Pick; try { diff --git a/test/postgres/research-source-evidence.test.ts b/test/postgres/research-source-evidence.test.ts index 3daf3984..86131e25 100644 --- a/test/postgres/research-source-evidence.test.ts +++ b/test/postgres/research-source-evidence.test.ts @@ -150,13 +150,8 @@ async function fixture(poolMax = 1, withSources = true) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('No provider reads allowed'); - }, - }, }); - const runner = new BacktestRunner({ engine, engineName: 'native', repository, logger }); + const runner = new BacktestRunner({ engine, repository, logger }); try { await runner.runQueued(id); } finally { diff --git a/test/postgres/research-workspace.test.ts b/test/postgres/research-workspace.test.ts index cc399b03..92f82a42 100644 --- a/test/postgres/research-workspace.test.ts +++ b/test/postgres/research-workspace.test.ts @@ -155,13 +155,7 @@ async function fixture(applyWorkspace = true, maxConnections = 10) { const runner = new BacktestRunner({ engine: new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('No provider fallback'); - }, - }, }), - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); diff --git a/test/postgres/run-reproduction.test.ts b/test/postgres/run-reproduction.test.ts index 9c093055..27694a14 100644 --- a/test/postgres/run-reproduction.test.ts +++ b/test/postgres/run-reproduction.test.ts @@ -116,15 +116,9 @@ async function fixture(poolMax = 4, withReproduction = true) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('Canonical execution must never load provider data'); - }, - }, }); const runner = new BacktestRunner({ engine, - engineName: 'native', repository: new PostgresBacktestRunRepository(postgres), logger, }); diff --git a/test/postgres/walk-forward.test.ts b/test/postgres/walk-forward.test.ts index 0ea4ebb3..c34db13e 100644 --- a/test/postgres/walk-forward.test.ts +++ b/test/postgres/walk-forward.test.ts @@ -163,13 +163,8 @@ async function fixture(poolMax = 1, withWalkForward = true) { const execute = async (id: string) => { const engine = new RustBacktestAdapter({ logger, - storage: { - async getHistoricalBars() { - throw new Error('No provider reads allowed'); - }, - }, }); - const runner = new BacktestRunner({ engine, engineName: 'native', repository, logger }); + const runner = new BacktestRunner({ engine, repository, logger }); try { await runner.runQueued(id); } finally { diff --git a/tsconfig.contracts.json b/tsconfig.contracts.json index 683ae2da..4e26c81c 100644 --- a/tsconfig.contracts.json +++ b/tsconfig.contracts.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.check.json", "include": [ "libs/core/services/test/contracts.type-test.ts", - "test/contracts/strategy-runtime.type-test.ts" + "test/contracts/strategy-runtime.type-test.ts", + "test/contracts/canonical-runner.type-test.ts" ] }