# R02 — Deliver strategy catalog and version-aware backtest setup Parent epic: E6. Priority/severity: P1 / High. Relative complexity: M. Recommended specialization: Full-stack research product. Scheduling source of truth: [manifest entry R02](../manifest.json). No task is authorized until the plan is approved. Dependencies and decision references below describe the design; the manifest controls current readiness. ## Evidence and root cause - **WEB-01 — Verified:** The real backtest list/detail/API/SQL flow already exists. Strategy/project/experiment work should extend it; App strategy/analytics views are placeholders. [apps/stock/web-app/src/app/App.tsx:24](../../../../apps/stock/web-app/src/app/App.tsx#L24); [apps/stock/web-api/src/services/backtest-v2.service.ts:211](../../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L211). - **STR-01 — Verified:** Registry is a useful small boundary, but its factories receive mode/execution services; BaseStrategy mixes author decisions, order submission and hidden signal filtering. [apps/stock/orchestrator/src/strategies/StrategyRegistry.ts:7](../../../../apps/stock/orchestrator/src/strategies/StrategyRegistry.ts#L7); [apps/stock/orchestrator/src/strategies/BaseStrategy.ts:315](../../../../apps/stock/orchestrator/src/strategies/BaseStrategy.ts#L315). ## Intended behavior and implementation scope Replace only the strategy placeholder with catalog/detail/version views; allow metadata edits, clone, parameter editing and read-only source/version diff. Add version selection and supported capability filtering to existing backtest form. First release authors code in repository or submits an artifact; no browser IDE. Measurable benefit: Makes strategy work a coherent product flow. ## Exclusions No general workflow framework, browser IDE, multi-tenant identity platform or second simulator. ## Likely files and ownership - apps/stock/web-app/src/app/App.tsx - apps/stock/web-app/src/features/strategies/ (new) - apps/stock/web-app/src/features/backtest/components/CreateBacktestDialog.tsx - apps/stock/web-app/src/features/backtest/components/BacktestConfiguration.tsx - apps/stock/web-app/src/components/ - apps/stock/web-api/src/services/backtest-v2.service.ts - libs/core/types/src/backtest-run.ts Write locks: web-backtest-detail, web-strategies. One agent owns this change. Lock names do not override actual overlapping files. ## Dependencies and blockers Implementation requires [R01](R01.md), [W03](W03.md) integrated. Architecture decisions: ADR-006. Agents may not independently amend their policies. Feature activation/release gates: [W04](W04.md). These do not block implementing or integrating this component against its own tests. Parallel eligibility: only with disjoint actual files and reserved write locks; read FIRST-WAVE.md for the initial exact ownership boundaries. ## Acceptance criteria - User can create/clone metadata, choose immutable version and schema-valid parameters, then open the existing run flow. - Unavailable native/custom strategy choices are not offered as runnable. - Version detail links deployment/backtest history when available; absent histories show empty states. - Catalog browsing, metadata, version comparison and parameter forms can ship after R01. Persist version selection, but disable version-based submission until R05 verifies and executes retained artifacts. Never map canonical catalog versions to legacy name-based strategies. Existing independent legacy runs remain visibly qualified. ## Mandatory tests - catalog_navigation, parameter_form_validation, immutable_version_selection, clone_revision_diff. - Browser strategy->backtest flow and schema/API contract tests. Apply the relevant [quality gates](../../QUALITY-GATES.md); submit exact commands, outcomes and skipped checks. Named cases above are required regression scenarios, not claims that those tests already exist. ## Regression risks and rollback Schema/API backward compatibility, historical provenance and UI state regression. Keep migrations additive and previous results readable. Do not add a switch that restores a correctness defect. Versioned cutover/migration is required only when persisted contracts or active engines change; never silently fall back to old economics. ## Web/API contract and user states - API: R01 catalog/version endpoints plus exact version ID and normalized parameters in saved backtest templates. R05 owns versioned run admission and immutable request snapshots; R02 creates no catalog run/outbox. - Backend/data dependencies: R01 schema; current engine capability metadata. Unsupported version/runtime combinations fail before submit. - Loading/error/empty behavior: Skeleton list/detail; no-strategies create CTA; schema error next to parameter; retry fetch; unsaved edit warning. - User-facing completion is demonstrated by the acceptance criteria and interaction tests above; a backend-only implementation is insufficient where a UI is in scope. ## Handoff Report scope changes (if any), fixture expectations, API/schema changes, measurements, remaining limitations and commit/PR references once authorized. Request independent review; only the integration/planning owner may mark the manifest done. ## Wave22 execution contract R10 committed `8cca0ee`; owner authorized R02. Reuse existing catalog APIs, React routes and backtest templates. Publish author code through existing repository/artifact APIs; no browser IDE or new compilation/runtime service. Read-only artifact comparison shows retained bundled JavaScript, schema and identities, not reconstructed original TypeScript. Migration18 adds `strategy_version_id` (restrictive FK) and separate scalar `strategy_parameters`. The saved template uses `strategy: 'catalog'`; the version never becomes a legacy alias. Creation requires explicit `autoStart:false`. Save validates retained checksums, exact version parameters, data/execution settings and selected-dataset compatibility. Preserve omitted selection on partial updates; an explicit new version requires explicit parameters. Both legacy/catalog mode conversions are rejected; create another template instead. New selections reject archived families under their row lock; existing references remain readable and editable unless the template itself is archived. V2 submission rejects before run/outbox insertion; V1 rejects catalog input before saving. Direct repository marker checks and the existing SQL run-admission trigger close alternate paths. Legacy receipt replay remains first. Keep the pure legacy parser's pre-strip rejection intact, including null version fields. Map trusted legacy DTOs explicitly instead of weakening that guard. All versions remain non-runnable, including approved built-ins. The UI supports exact version selection, schema fields, server validation and saved setups with fresh submission disabled. Existing supported legacy strategies remain a separate qualified workflow. No inferred version/deployment histories from names; show absent integration honestly. Schema forms preserve optional omissions, false, zero, typed enums and decimal strings. Retained bundle text is never executed. Metadata/clone drafts preserve input and use explicit discard warnings; clone retries retain their original key/body. ## Validated handoff — 2026-10-23 Implemented the pinned Wave22 contract in 39 source/shared-contract/migration/test files. Catalog family metadata, immutable version selection, clone retries, exact schema validation, escaped bundle comparison and existing save/reopen/settings flows are integrated. API, repository and SQL gates keep all catalog versions non-runnable; legacy receipt ordering and supported legacy runs remain unchanged. Migration 18 retains version/parameters without creating catalog runs or request snapshots. Review fixes include explicit empty-string versus omitted parameters, normalized value display, frozen clone source identity during navigation, catalog settings omitting legacy pacing, and authoritative archive/restore resets that invalidate stale parameter validation. Browser coverage proves exact saved values, immutable selection after new publication, clone lineage, safe bundle display, and zero runs/outbox. Each browser fixture has its own context/server/schema/queue within one suite-owned Chromium process after repeated driver teardown exposed pipe loss under Bun 1.2.17; no retry hides failures. Validation: full repository checks passed (541 integration, 150 Rust, 93 tooling, 43 utility, 44 calculation plus build/types/contracts/lint/secrets); full PostgreSQL/Redis 137 tests/1052 assertions; all 8 browser workflows/117 assertions; strict new/modern test types and scoped lint/format/diff checks. Source hashes, commands, logs, independent review and stopped fixture IDs are in `manifest.json` → `twenty_second_wave_validation`. Release addon matches the prior wave; Rust financial source is unchanged. Read-only source is retained bundled JavaScript, not original TypeScript. Code publication stays in repository/offline tooling or existing artifact APIs; no embedded editor/upload UI. Version-linked backtest/deployment histories remain unavailable. Unsaved warnings cover local discard actions/document unload, not a new global routing framework. Clone retry identity lasts within the mounted detail view. Current legacy economics remain explicitly qualified. R05 owns verified retained-artifact execution and full provenance; A02 gates candidates, and the multi-asset default policy remains unresolved. No R02 commit/push/PR, default cutover, trading activation or performance work.