feat(research): download validated retained datasets (RP07)
This commit is contained in:
parent
43ea2cc9b6
commit
b959779ada
14 changed files with 1076 additions and 11 deletions
|
|
@ -15,3 +15,5 @@ Ownership: backend agent owns `canonical-research.service.ts`, `datasets.routes.
|
|||
Acceptance/tests: full downloaded JSON validates with identical manifest and every bar; converted parent, delayed availableAt, source ordinals and null VWAP survive. Invalid hashes avoid storage; missing/corrupt/mismatched/unsupported data never attach; internal errors are sanitized; cancellation fences delivery. Existing role access and research-token denial hold. Actual PostgreSQL export followed by the existing CLI import is idempotent, with unchanged unrelated tables. Real browser downloads from a selected dataset and an original run whose editable template now points elsewhere; file identity must match each source. Malformed/HTML/mismatched responses and delayed selection changes cannot create a download. No run/template/source writes from export.
|
||||
|
||||
Gates: focused API/UI/read tests, app/authored-test types, strict lint and production build; root full repository check, relevant disposable PostgreSQL tests and Chromium workbench. Document JSON inspection and existing CLI reimport; the file is a retained v2 snapshot, distinct from the source-input preparation uploader. Risk: exporting a mutable template's new dataset instead of original run input, or presenting a transport error as a data file. No broad research framework is needed.
|
||||
|
||||
Accepted October 27, 2026. Independent review accepted API, UI and root fixture changes; 66 focused tests / 591 assertions plus 25 independent probes passed. Root full repository check passed, including 1,316 integration and 150 Rust tests. Disposable PostgreSQL passed 14 tests / 183 assertions, including actual export-to-CLI repeated import with unchanged custody. Chromium passed all 21 scenarios / 721 assertions, downloading real files from selected data and original run provenance after the template changes. [Combined evidence](../../real-data-research.md) records exact checks and limitations; [usage](../../../backtest-datasets.md#downloading-a-retained-snapshot-for-local-exploration) covers local inspection and reimport. No financial semantics, access grants or deferred optimization changed.
|
||||
|
|
|
|||
|
|
@ -133,3 +133,22 @@ Combined validation:
|
|||
- Application and authored-test types, focused lint, formatting/diff checks and production frontend build passed. The browser used isolated PostgreSQL/Redis fixtures, removed after validation. No development dataset, research execution or paper/live state was changed.
|
||||
|
||||
Logs: `/tmp/stock-bot-rp05-root-check.log`, `/tmp/stock-bot-rp05-browser.log`, `/tmp/stock-bot-rp05-browser-focused.log`, `/tmp/stock-bot-rp05-root-test-types.log`, and `/tmp/stock-bot-rp06-baseline-regression.log`. Current manifest: 71 accepted scheduled tasks, seven deferred conditional tasks and four merged redirects, 82 IDs total. No conditional performance or monitoring work was activated.
|
||||
|
||||
## RP07 — Retained dataset export for local research
|
||||
|
||||
Owner continuation on October 27 authorized this follow-up; planning commit `43ea2cc9` records the frozen API/UI contract. Existing catalog endpoints returned descriptors without bars, forcing local exploration to reach into the database. The new `GET /api/v2/datasets/canonical/:hash/export` reuses `readCanonicalDataset` once to return the validated full v2 `{manifest,bars}` snapshot. It preserves canonical identity, converted parent hashes, timestamps, availability delays, source ordinals and null VWAP. JSON formatting and downloaded-file byte hashes are not dataset identity guarantees.
|
||||
|
||||
The loader's typed rejection extends its existing request-error base, preserving admission/catalog catches and messages. Invalid, missing, corrupt/mismatched and unsupported datasets return 400, 404, 409 and 422 respectively; unexpected errors are sanitized. Route-handled responses are no-store/nosniff, and only validated success receives an attachment filename. Cancellation fences delivery. Existing authentication is unchanged; tests use the real research-credential resolver to prove dataset routes remain unavailable to research-agent tokens.
|
||||
|
||||
A shared download action appears for a verified setup selection and full canonical results. Result downloads use the original immutable request hash, independently of the editable template. The browser checks the response envelope/identity, preserves the received text, supports retry, prevents duplicate clicks and fences pending bodies on hash change/unmount. Full content/hash validation stays on the server; there is no browser financial engine or new export format. [Usage](../backtest-datasets.md#downloading-a-retained-snapshot-for-local-exploration) covers VS Code/notebook inspection and the existing CLI importer.
|
||||
|
||||
Independent backend review accepted both implementation halves: 66 focused tests / 591 assertions and 25 additional transport/authentication probes passed. The reviewer also accepted root's PostgreSQL/browser fixtures; independent frontend review accepted the usage documentation. Implementer checks passed application/authored-test types, strict lint and production builds.
|
||||
|
||||
Root validation:
|
||||
|
||||
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,316 integration and 150 Rust tests. Existing 14 conditional integration skips and 4 ignored Rust measurements remain. Build, types, contract checks, strict lint and secret audit passed.
|
||||
- Disposable PostgreSQL: 14 tests / 183 assertions across dataset-source preparation, stored-source preparation and canonical research. The actual export performs one payload read; its received JSON validates, is imported through the real CLI twice, and leaves every fixture table unchanged. Unsupported/corrupt retained rows return no attachment.
|
||||
- Root-authored browser/PostgreSQL test typecheck and formatting/diff checks passed.
|
||||
- Chromium: all 21 workbench scenarios passed with 721 assertions. Actual downloaded files from a verified selection and a reopened native result validate in full. The latter's template is deliberately changed to a distinct retained dataset first; export still delivers the original run dataset and leaves the replacement settings, one run and one dispatch unchanged. The fills-only view exposes no download action.
|
||||
|
||||
Logs: `/tmp/stock-bot-rp07-root-check.log`, `/tmp/stock-bot-rp07-postgres.log`, `/tmp/stock-bot-rp07-browser.log`, `/tmp/stock-bot-rp07-root-test-types.log`, `/tmp/stock-bot-rp07-api-independent.log` and `/tmp/stock-bot-rp07-ui-independent.log`. Tests use disposable PostgreSQL/Redis fixtures; no development research runs or paper/live operations were performed. Export retains the existing eligible single-asset/single-series gate. Performance, monitoring and conditional replay extraction remain deferred.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue