69 lines
5.2 KiB
Markdown
69 lines
5.2 KiB
Markdown
# P05 — Separate result summaries from paged detail payloads
|
||
|
||
Parent epic: E7. Priority/severity: P2 / Medium. Relative complexity: M. Recommended specialization: Performance/infrastructure engineering.
|
||
|
||
Scheduling source of truth: [manifest entry P05](../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
|
||
|
||
- **PER-01 — Verified:** EventQueue insertion scans prior events; native run is synchronous/one-shot and returns full JSON. Actual end-to-end bottleneck distribution still needs controlled measurements. [apps/stock/engine/src/backtest/mod.rs:138](../../../../apps/stock/engine/src/backtest/mod.rs#L138); [apps/stock/engine/src/api/backtest.rs:194](../../../../apps/stock/engine/src/api/backtest.rs#L194).
|
||
- **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).
|
||
|
||
## Intended behavior and implementation scope
|
||
|
||
Deferred until measured detail payload/query/rendering costs justify it. R06 already provides summary projections. This task may add stable paged trade/position detail and display-only downsampling; keep full exports and retained authoritative results. Do not normalize all storage or add an artifact service by default.
|
||
|
||
## Exclusions
|
||
|
||
No speculative distributed infrastructure or weakened correctness gates.
|
||
|
||
## Likely files and ownership
|
||
|
||
- apps/stock/web-api/src/services/backtest-v2.service.ts
|
||
- apps/stock/web-api/src/routes/backtests-v2.routes.ts
|
||
- apps/stock/web-app/src/features/backtest/
|
||
- apps/stock/web-app/src/features/experiments/
|
||
|
||
Write locks: result-contract, web-backtest-service, web-experiments. One agent owns this change. Lock names do not override actual overlapping files.
|
||
|
||
## Dependencies and blockers
|
||
|
||
Implementation requires [R06](R06.md), [P01](P01.md) integrated.
|
||
|
||
No additional economic-policy approval is needed for this narrowly scoped task.
|
||
|
||
Deferred: Only after measured trade-detail payload/query/render cost; simple summary projections ship in R06.
|
||
|
||
Parallel eligibility: only with disjoint actual files and reserved write locks; read FIRST-WAVE.md for the initial exact ownership boundaries.
|
||
|
||
## Acceptance criteria
|
||
|
||
- Experiment list retrieves summaries without full OHLC/trade blobs.
|
||
- Detail pagination/export preserves every trade in stable sequence; changing display density does not alter reported metrics.
|
||
- Report API bytes, query latency and rendering time before/after on the large-trade workload.
|
||
|
||
## Mandatory tests
|
||
|
||
- paged_trade_reassembly_hash, stable_cursor, summary_matches_full_result, complete_export.
|
||
- Browser loading/error/empty/pagination test and P01 result-store/load timings.
|
||
|
||
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
|
||
|
||
Performance measurements can hide semantic changes; require economic hash equivalence.
|
||
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 run summary/provenance plus /trades?cursor and display-series projections; full export remains available.
|
||
- Backend/data dependencies: Existing results first; add normalized detail storage only after query profiling and separate approval if scope expands.
|
||
- Loading/error/empty behavior: Summary available while detail loads; retry individual page; explicit no trades/end of list; no fake zero risk.
|
||
- 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.
|
||
|
||
## Conditional review — October 28, 2026
|
||
|
||
No-go for now: experiments already select compact summaries without trade/OHLC blobs; full retained exports exist. No measured detail-query/transfer/render bottleneck was supplied or established by callback measurements. Reopen for a real slow detail workload, preserving complete stable-sequence export. Status remains **deferred**, not implemented or silently cancelled. The owner authorized judgment on all remaining conditions and explicitly resumed performance work. [Current review](../../conditional-review.md). Earlier audit findings above are historical evidence: F02–F07/S06 already resolved competing financial cores and the old insertion queue; they are not reasons to implement this extension now.
|