70 lines
5.3 KiB
Markdown
70 lines
5.3 KiB
Markdown
# 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](../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
|
|
|
|
- **KEEP-02 — Verified:** Preserve frozen/hash-verified historical snapshots and fenced durable runner attempts; extend them instead of creating a second job engine. [apps/stock/orchestrator/src/data/historical-dataset.ts:98](../../../../apps/stock/orchestrator/src/data/historical-dataset.ts#L98); [apps/stock/orchestrator/src/backtest/BacktestRunner.ts:190](../../../../apps/stock/orchestrator/src/backtest/BacktestRunner.ts#L190).
|
|
- **DAT-01 — Verified:** Dataset v1 has one bar timestamp and interval in the manifest, without explicit bar-end/availability semantics. Session dates cannot safely be treated as observation times. [libs/core/types/src/historical-data.ts:90](../../../../libs/core/types/src/historical-data.ts#L90); [apps/stock/orchestrator/src/services/StorageService.ts:177](../../../../apps/stock/orchestrator/src/services/StorageService.ts#L177).
|
|
- **WEB-04 — Verified:** Existing results snapshot configuration and datasets but do not capture an immutable strategy artifact/engine build/model/seed bundle. Legacy projection can fall back to mutable definition fields. [libs/core/types/src/backtest-run.ts:4](../../../../libs/core/types/src/backtest-run.ts#L4); [apps/stock/web-api/src/services/backtest-result.ts:107](../../../../apps/stock/web-api/src/services/backtest-result.ts#L107).
|
|
|
|
## 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](D01.md), [O01](O01.md) integrated.
|
|
|
|
Architecture decisions: ADR-003, 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 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](../../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
|
|
|
|
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.
|