feat(research): prepare stored data by declared sessions (RP03)

This commit is contained in:
Boki 2026-10-27 01:07:45 -04:00
parent 302ba60e53
commit d2b78eacdf
10 changed files with 805 additions and 72 deletions

View file

@ -63,6 +63,33 @@ Historical Bun 1.2.17 sample, recorded before removal of the size-limit machiner
Results vary with machine load and garbage collection. This optional diagnostic remains
available; it does not impose input limits or change v1 content identity.
## Stored EOD preparation across declared sessions (v2)
In backtest **Settings → Prepare dataset from source export**, choose **Stored EOD —
declared sessions only** and upload the complete v2 metadata JSON. The panel displays
the selected series' declared session windows, clipped to the warmup/evaluation bounds,
in UTC. Preview reads these windows sequentially; retain saves the captured input and
hash without querying the mutable source again.
The reads are not an atomic database snapshot; the captured rows define the retained
dataset. Cancellation prevents subsequent reads/results but does not interrupt an
already dispatched Mongo query.
The existing API opts in explicitly:
```json
{ "metadata": { "...": "complete v2 metadata" }, "selection": "declared-sessions" }
```
Send this to `POST /api/v2/datasets/canonical/stored-source`. The response echoes
`selection` alongside `input` and `preparation`; retain uses that exact `input` and
`preparation.hash`. Omitting `selection` preserves the continuous-range query.
Empty selected sessions, invalid selected rows, duplicates and bars crossing a session
boundary fail preparation. Rows outside the declared windows are never read. Sessions,
corporate-action coverage and source timing remain explicit operator declarations:
successful preparation does not certify them or establish gap-free data. The source
inspector diagnoses its own selected range independently of these capture windows.
## Verification
`bun run check` includes complete-range reads without row caps, acceptance beyond the