# R07 — Deliver sweep configuration and comparable-result views Parent epic: E6. Priority/severity: P1 / High. Relative complexity: M. Recommended specialization: Full-stack research product. Scheduling source of truth: [manifest entry R07](../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). - **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). - **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 Deliver experiment preview/progress/comparison directly on R06 APIs. Accept an existing frozen dataset ID and show its manifest; R11's picker is optional convenience, not a prerequisite. A project/workspace link is optional; users need not build project metadata before comparing a sweep. Reuse current charts/metrics and R06 summary projection. ## Exclusions No general workflow framework, browser IDE, multi-tenant identity platform or second simulator. ## Likely files and ownership - apps/stock/web-app/src/features/experiments/ (new) - apps/stock/web-app/src/features/backtest/components/ - apps/stock/web-app/src/components/ui/DataTable/ Write locks: web-experiments. One agent owns this change. Lock names do not override actual overlapping files. ## Dependencies and blockers Component implementation may proceed against root-pinned R06 DTOs; activation requires integrated retained-input R06 admission/results. The initial component did not expose retry; the continuation below adds controls against the separately reviewed R06 retry contract. 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 previews bounded trial count, submits, sees all statuses, cancels and opens exact candidate runs. - Default comparison requires matching data, execution/metrics policy, costs and evaluation windows; mismatches remain visible, not silently ranked. - No full detail blobs on summary list; failed/incomplete counts and null metrics are explicit. ## Mandatory tests - sweep_to_compare_browser, mixed_policy_warning, partial_failure_visibility, reopen_experiment. - Large result table rendering measurement and metric-null 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: R06 experiment/trial listing; summary metrics projection from result contracts; pagination where needed. - Backend/data dependencies: Experiments and canonical provenance; full trade arrays are fetched only on run detail. - Loading/error/empty behavior: Preview loading; invalid grid errors; empty not-yet-submitted; per-trial failed/cancelled; retryable aggregate errors. - 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. ## Authorized component — 2026-10-24 Implement same-experiment preview, submission, progress, cancellation, scalar comparison and exact run reopening against the pinned R06 component API. Component coding may proceed in parallel; release requires integrated R06 component. Cross-experiment comparison and table performance measurements remain outstanding, with all performance work paused. Full R07 remains incomplete. ### Pinned web workflow `/experiments` selects a saved canonical backtest, names a sweep and previews a small parameter grid before submission. `/experiments/:experimentId` shows the frozen inputs, all trial outcomes, comparable scalar metrics with units/null reasons, cancellation state and exact saved-run links. An optional backtest query parameter starts from its detail page. The API is shared with other authorized clients; the browser does not calculate economics or rank incompatible runs. Ambiguous submission preserves its exact body/key, and only an explicit new intent may replace it. Form edits invalidate previews; route changes and late reads/mutations cannot replace another experiment. Loading, empty, failed, missing and incomparable outcomes remain distinct. Refresh/reopen must retain immutable evidence and cancelled/partial outcomes. The browser acceptance executes real retained native trials, mutates the template after admission, replays the submission receipt, opens results and cancels a separate pending batch. ### Validated component handoff The retained-input component is implemented and independently reviewed. Full repository, PostgreSQL and Chromium gates passed; exact source hashes and logs are in `manifest.json` → `twenty_seventh_wave_validation`. See the twenty-seventh-wave roadmap handoff. This first component is committed as `6f64ef6`; it did not alone complete the full task or release its downstream dependencies. ## Retry controls continuation — 2026-10-24 The first experiment UI component is committed as `6f64ef6`. Add per-trial failed-retry review/confirmation and lazy immutable failure-history views against the pinned R06 API. Preserve exact unresolved body/key through refresh and guard late responses, cancellation and route changes; a later failure requires a deliberate new intent. Reopening must show saved failure evidence after successful completion. Broader comparison/table measurement remains outside this continuation; performance work stays paused. ### Validated retry controls handoff The retry/history component is independently reviewed and committed as `b373410`; full R07 remains partial. The actual Chromium workflow retries a failed canonical trial, verifies the original immutable inputs despite template edits, replays the accepted receipt after completion and reopens saved failure history and the native result. Interaction tests cover uncertain responses, stale refresh/route responses, cancellation coordination, null/history/error states and explicit discard/new intent. Exact logs and hashes: `manifest.json` → `twenty_eighth_wave_validation`. Full R07 remains in progress for broader cross-experiment comparison and table measurements. All performance work stays paused. No new finance, statistics or result-ranking logic was added. ## Cross-experiment comparison continuation — 2026-10-24 Compare two standalone saved parameter/cost experiments from the existing list. The explicitly selected left trial is the reference; omitted key means its frozen index zero even if failed or unavailable. Show every original-order outcome. Match retained dataset/window/capital/effective costs/execution/risk/clock/analytics/seed/build/models, normalizing only specified admission/owner IDs; strategy implementation and parameters may intentionally differ. Separate matching settings from compact saved-summary availability. No ranking, financial recomputation or statistical-validity claim. The GET API uses one repeatable read-only transaction and existing compact detail reads. Historical reads survive archival/current approval changes. Strict browser decoder verifies pair/reference/ordered row identities; route changes fence late reads, reload retains the reference, and existing editor navigation protection covers comparison links. Actual native browser acceptance plus pure/API/PostgreSQL/UI tests cover cost overrides, incomplete evidence, policy differences, strict errors and snapshot consistency. Functional acceptance and the explicitly paused large-table measurement are tracked separately. Do not claim the measurement ran. Once this functional component is accepted and committed, downstream R09 can depend on it without waiting for performance work. ### Validated comparison handoff The functional comparison component is independently accepted and awaiting commit. All 17 integrated source/test/config files match reviewed snapshots. Whole repository gates pass (988 integration /150 Rust), final PostgreSQL 228/2013 assertions and Chromium 16/500; all authored tests pass strict types/lint and changed-source formatting. Exact hashes, commands and review corrections: `manifest.json` → `thirty_third_wave_validation`. Historical compact reads share a repeatable read-only transaction; actual native browser acceptance confirms cost references, changed/archived inputs, saved metrics and exact-run reopening. The large-table measurement remains explicitly paused/unrun; full R07 therefore stays partial. After functional component commit, R09 may consume the accepted sweep/comparison/retry UI through a recorded component prerequisite. No new economic formulas, ranking, statistical certification or performance work was added.