# W02 — Expose result provenance and legacy correctness limitations Parent epic: E5. Priority/severity: P1 / High. Relative complexity: M. Recommended specialization: Full-stack research UX. Scheduling source of truth: [manifest entry W02](../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-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). - **FIN-01 — Verified:** Both execution paths can act on a completed bar and fill against its current close; this is not a defensible default bar-close policy. [apps/stock/engine/src/backtest/engine.rs:249](../../../../apps/stock/engine/src/backtest/engine.rs#L249); [apps/stock/orchestrator/src/services/ExecutionService.ts:224](../../../../apps/stock/orchestrator/src/services/ExecutionService.ts#L224). - **FIN-07 — Verified:** Daily return grouping, Sharpe/Sortino conventions and placeholder exposure/VaR produce incomparable or misleading native metrics. [apps/stock/engine/src/backtest/simple_results.rs:374](../../../../apps/stock/engine/src/backtest/simple_results.rs#L374); [apps/stock/engine/src/backtest/simple_results.rs:542](../../../../apps/stock/engine/src/backtest/simple_results.rs#L542). ## Intended behavior and implementation scope Add read-only provenance/limitations DTO and panel using data actually stored. Distinguish missing metadata, legacy semantics and project-gated engine versions; label same-bar/funding/attribution limitations. Do not infer a historical code hash or certify results from engine name alone. Measurable benefit: Delivers useful UI now without presenting invalid results as validated. ## Exclusions No unrelated refactor, new service or broker activation. ## Likely files and ownership - apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx - apps/stock/web-app/src/features/backtest/components/BacktestMetrics.tsx - apps/stock/web-api/src/services/backtest-result.ts - libs/core/types/src/backtest-run.ts Write locks: web-backtest-detail, result-contract. One agent owns this change. Lock names do not override actual overlapping files. ## Dependencies and blockers Implementation requires [W01](W01.md) integrated. No additional economic-policy approval is needed for this narrowly scoped task. Parallel eligibility: only with disjoint actual files and reserved write locks; read FIRST-WAVE.md for the initial exact ownership boundaries. ## Acceptance criteria - Every existing run reopens with exact stored configuration where present and explicit unknown fields otherwise. - Legacy/native/TS result limitations are visible next to performance; unproject-gated results cannot be treated as validated promotion evidence. - No zero-valued placeholder is presented as a measured risk metric. ## Mandatory tests - legacy_missing_provenance, frozen_config_not_mutable_definition, limitation_badge, null_metrics. - Existing backtest-result-mapping and analytics-ui 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 Compatibility or lifecycle regression; preserve frozen inputs, old results and existing failure tests. 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: Extend GET /api/v2/runs/:id/results with provenance availability, economics version and limitations; backward-compatible optional fields. - Backend/data dependencies: Existing result configuration/dataset; future R05 extends the same contract. - Loading/error/empty behavior: Separate loading, no-result-yet, failed run, and legacy metadata unavailable; never fabricate defaults as provenance. - 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.