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

5.3 KiB

R11 — Select and reuse frozen datasets in the workbench

Parent epic: E6. Priority/severity: P1 / High. Relative complexity: M. Recommended specialization: Full-stack market data/research.

Scheduling source of truth: manifest entry R11. 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

Expose metadata-only listing/detail for retained backtest_datasets and add selection by hash to the existing configuration form. Offer either a known frozen dataset or an explicit source request whose data will be prepared asynchronously by the existing runner. Show the eventual pinned hash and coverage; no separate dataset job service.

Measurable benefit: Delivers dataset choice and reuse as a real web workflow.

Exclusions

No new storage service, arbitrary truncation, full corporate-action feed, or synchronous API-side historical loading.

Likely files and ownership

  • apps/stock/web-api/src/routes/ (dataset endpoints)
  • apps/stock/web-api/src/services/ (dataset metadata)
  • apps/stock/web-app/src/features/backtest/components/BacktestConfiguration.tsx
  • apps/stock/web-app/src/features/backtest/components/CreateBacktestDialog.tsx
  • apps/stock/orchestrator/src/backtest/BacktestRunner.ts

Write locks: dataset-contract, web-backtest-detail, web-backtest-service. One agent owns this change. Lock names do not override actual overlapping files.

Dependencies and blockers

Implementation requires D01, O01 integrated.

Architecture decisions: ADR-003, 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 selects a compatible dataset by hash or requests a new source/date/interval range; mismatch rejects before simulation.
  • Source-request submission is labelled unpinned/preparing, not reproducible data; the first prepared snapshot is attached atomically before execution and reused on retry.
  • Listing does not return full bar arrays; missing/corrupt/unknown-coverage datasets show actionable status.

Mandatory tests

  • dataset_list_metadata_only, select_hash_compatibility, source_request_freeze_status, retry_reuses_bound_hash.
  • Browser select existing dataset -> run -> inspect pinned hash; invalid coverage/timeframe feedback.

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

Confusing source-query identity with frozen content identity; maintain legacy v1 snapshots and explicit preparation state. 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: GET dataset metadata/manifest and existing hash-or-source configuration; no new dataset job service.
  • Backend/data dependencies: D01 and existing retained snapshots. Implementation does not require all W04 browser release work.
  • Loading/error/empty behavior: Picker empty/loading/retry/incompatible states; source request remains unpinned until atomic preparation.
  • Release: This flow must pass the shared W04 browser harness before user-facing release; do not build another harness.

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.