docs(research): plan multi-session preparation and horizon clarity
This commit is contained in:
parent
91cc7e48de
commit
76eb1b1255
5 changed files with 83 additions and 3 deletions
17
docs/development/backlog/tasks/RP03.md
Normal file
17
docs/development/backlog/tasks/RP03.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# RP03 — Prepare stored data from explicitly declared sessions
|
||||
|
||||
Parent: E12. Priority P1 / High. Complexity M. Owner continuation authorizes this next research-product slice; optional performance work stays deferred. Dependencies: RP01 and D01. ADR-003/006 remain unchanged.
|
||||
|
||||
Problem/evidence: `apps/stock/web-api/src/services/stored-dataset-preparation.ts` reads one continuous warmup-to-end range before strict OHLCV validation. Interior after-hours null-volume rows therefore block multi-session preparation. RP02 avoided the issue with one session. The existing v2 dataset/calendar and Rust replay already support multiple sessions; `StorageService` must remain strict.
|
||||
|
||||
Contract: preserve `{metadata}` and its current response. Opt in with `{metadata, selection: "declared-sessions"}` at the existing stored-source endpoint; its response adds the same selection literal alongside unchanged captured `input` and `preparation`. No new dataset hash format or database migration. The calendar plus captured bars remain replay provenance; selection describes how source rows were captured.
|
||||
|
||||
Scope: one series/provider as today. Intersect the selected series' declared calendar sessions with `[warmupStart, tradeEnd)`, read each nonempty window sequentially through the strict reader, validate against that individual window, snapshot values before another await, combine and assign deterministic global ordinals. Empty selected sessions fail; invalid selected rows abort the entire preparation. An interval crossing the declared close fails normalizer validation; never shrink the query to hide it. Check aborts between reads. No interpolation, post-filtering, calendar inference, source writes, new caps/cache or financial-policy changes. Sparse nonempty sessions retain existing semantics; do not claim complete coverage.
|
||||
|
||||
Web scope: a third input choice, "Stored EOD — declared sessions only", reuses metadata upload, preview and captured-input retention. Show the explicit session scope and intersected UTC windows. Verify the echoed response selection; reject missing/wrong mode. Existing loading/error/empty states and mode-change cancellation apply. An unresolved retention receipt locks the input/mode and retries the same input/hash without source reads. Inspector diagnostics remain independent and do not establish calendar coverage.
|
||||
|
||||
Likely files/locks: `apps/stock/config/src/contracts/canonical-research.ts`, `apps/stock/web-api/src/services/stored-dataset-preparation.ts`, `apps/stock/web-app/src/features/backtest/services/backtestApiV2.ts`, `.../components/DatasetPreparation.tsx`, focused stored-preparation API/UI tests. Root owns backlog, documentation, integration and browser test file. One implementation owner; disjoint from RP04.
|
||||
|
||||
Acceptance/tests: unchanged default query/output; two sessions with an intervening invalid close marker succeed only in explicit session mode; selected null/OHLC/identity/duplicate errors and missing sessions fail; per-window out-of-range adapter results fail; DST, early close and clipped bounds use declared instants; partial bars fail; metadata/earlier-row mutation cannot affect captured results; abort prevents later reads; repeated same capture has the same v2 hash; wrong response mode and late replies fail; retention retry never rereads. Extend the real browser preparation workflow. Validate a read-only actual stored multi-session preview against exact selected source rows; no new research execution is required.
|
||||
|
||||
Gates: focused regressions, types/strict lint, full repository check, relevant disposable PostgreSQL retention tests and Chromium workbench. Independent backend/frontend acceptance before completion. Risk: hiding source defects outside incorrectly declared sessions or implying gap-free data; declarations remain explicit and unverified by the UI.
|
||||
11
docs/development/backlog/tasks/RP04.md
Normal file
11
docs/development/backlog/tasks/RP04.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# RP04 — Explain the evaluation horizon and CAGR in canonical results
|
||||
|
||||
Parent: E12. Priority P1 / High (research interpretation). Complexity S. Dependency: RP02. Owner continuation authorizes this presentation correction. ADR-006; no financial or analytics semantic change.
|
||||
|
||||
Evidence: `libs/research/src/results.ts` computes CAGR using actual elapsed calendar time divided by 365 days. `CanonicalResults.tsx` shows CAGR without its evaluation duration and labels a separate policy generically as "Annualization: periods/year". RP02's five-and-a-half-hour total return of approximately -0.054575% produces -58.08% CAGR. The saved finding excludes that extrapolation, but the result UI should explain it itself.
|
||||
|
||||
Scope: in `apps/stock/web-app/src/features/backtest/components/CanonicalResults.tsx`, show retained financial reporting start/end in UTC and elapsed calendar duration. Explain alongside CAGR that it extrapolates this interval to a 365-day year, includes nontrading elapsed time, and is not an observed annual return or forecast. Clarify that `periodsPerYear` governs periodic statistics. Preserve existing metric values, null/reason rendering, units, result contracts, rankings, engine behavior and old saved results. No arbitrary sample cutoff, hiding/recalculation of CAGR, new warning framework or financial calculations in the frontend.
|
||||
|
||||
Acceptance/tests: realistic partial-session result displays exact UTC interval/duration and CAGR explanation with stored CAGR unchanged; multi-day/overnight duration is calendar elapsed time; null CAGR reason and existing fill-only view remain correct; periodic annualization label is unambiguous. Add focused production-component regression assertions in the existing result/UI suite; root may add browser assertions to its owned workbench scenario. Loading/error/empty behavior stays in the existing parent run view; no new backend/data dependency or request.
|
||||
|
||||
Locks: CanonicalResults and its focused result tests only. Parallel with RP03; do not modify shared workbench E2E or manifest. Gates: focused UI tests, authored test/app types, strict lint and production build, root combined check/browser gate, independent review. Regression risk low; the primary risk is misstating the existing computation's time basis.
|
||||
Loading…
Add table
Add a link
Reference in a new issue