stock-bot/docs/development/backlog/tasks/R02.md

4.9 KiB

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. 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

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, W03 integrated.

Architecture decisions: ADR-006. Agents may not independently amend their policies.

Feature activation/release gates: W04. 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.
  • During legacy migration only registered artifacts matching the current supported build are runnable; version selection is persisted, but legacy runs remain unproject-gated until R05.

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; 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 version ID in saved backtest template/request snapshot.
  • 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.