# CL14 — Require canonical capabilities in durable research contracts Parent epic: E11. Priority/severity: P1 / High. Complexity: M. Specialist: TypeScript contracts and durable research. Scheduling and commit evidence: [manifest](../manifest.json). Scope baseline: `700ee09c`. Owner authorized planning, implementation and one commit per completed task on 2026-10-26; CL21 remains conditional. Follow [quality gates](../../QUALITY-GATES.md) and [agent instructions](../../agents/implementation.md). ## Outcome and evidence execution-engine.ts:13 requires retired execution/playback but makes runCanonical optional. run-repository.ts:25 does the same for canonical claim/load/complete. BacktestRunner.ts:225,287,327 probes mandatory capabilities at runtime. RustBacktestAdapter.ts:35 storage and BacktestRunner.ts:60 engineName are unused. The concrete benefit is a smaller supported execution surface with unchanged financial behavior. Findings are verified at the baseline; recheck caller/module evidence before edits. This does not imply active financial corruption. ## Scope - Define required canonical engine/repository capabilities for the current runner. Preserve legacy interfaces where retained consumers actually need them. - Remove unused storage and engineName constructor requirements and their caller/fixture plumbing. - Remove only redundant optional-capability probes; preserve parsing of untrusted input, explicit unavailable-store errors, retired queue/HTTP rejection, and every lease/terminal-write rule. - Keep legacy repository methods in place unless a tiny interface separation suffices; physical relocation is not required. Likely files/modules: - `apps/stock/orchestrator/src/backtest/execution-engine.ts` - `apps/stock/orchestrator/src/backtest/run-repository.ts` - `apps/stock/orchestrator/src/backtest/BacktestRunner.ts` - `apps/stock/orchestrator/src/backtest/RustBacktestAdapter.ts` - `apps/stock/orchestrator/src/backtest/PostgresBacktestRunRepository.ts` - `apps/stock/orchestrator/src/container.ts` - `test/fixtures/canonical-runner.ts` ## Exclusions No changes to financial semantics, SQL schema, lease policy, historical readers, native exports or persisted request/result shapes. Preserve retained strategy packages/datasets/results, useful algorithms, reviewed calculations, durable recovery and the existing .env files. No pushes, PRs or paper/live activation. ## Dependencies and ownership Prerequisites: None; inspect existing integrated baseline rather than reopening earlier cleanup tasks. Write locks: `canonical-runner-contract`, `orchestrator-composition`. Parallelism: May run alongside CL15. Serialize actual container.ts edits with CL16; this is a file lock, not a semantic prerequisite. ## Acceptance criteria 1. Current runner cannot type-check against an engine/repository lacking required canonical methods. 2. Canonical success, cancellation, lease loss and unavailable storage retain their behavior; old queued requests cannot execute. 3. Existing historical writers/readers and retirement diagnostics remain available to their existing consumers. ## Mandatory verification - bun run typecheck - bun test test/integration/canonical-durable-runner.test.ts test/integration/backtest-workflow.test.ts test/integration/canonical-worker-lifecycle.test.ts test/integration/research-pool.test.ts test/integration/research-runtime-isolation.test.ts scripts/test/architecture.test.ts - Disposable PostgreSQL: test/postgres/canonical-durable-backtest.test.ts Use isolated worktrees/build outputs and disposable safety databases/Redis only. Never rebaseline financial fixtures to hide changed behavior. Integrator runs repository checks on the combined source. Performance work remains deferred; no speed claims are part of acceptance. ## Risks and definition of done Weakening fail-closed boundaries or dropping compatibility methods while narrowing types. Done requires scoped tests, independent reviewer acceptance, integration verification, and a focused commit. The manifest owns status and evidence; implementers do not edit it. Root records each completed commit in the next bookkeeping update; the task completion commit includes its tests/reviewer evidence, avoiding self-referential hashes. Unrelated prior CL01–CL13 review status remains unchanged.