3.2 KiB
RP05 — Reuse retained datasets beyond the first catalog page
Parent E12. Priority P1 / High workflow defect. Complexity M. Dependencies RP03 and R11. Owner's "commit and continue" authorizes this narrow research follow-up; conditional performance work remains deferred.
Evidence: backtestApiV2.listCanonicalDatasets hardcodes limit=50&offset=0; CanonicalSetup provides only that selector. A fresh template cannot select an older retained dataset or an agent-supplied known hash. The backend already supports pagination and validated exact-hash lookup. Legacy HistoricalDataSelection demonstrates the existing load-more interaction. The two canonical transport methods also return unchecked successful JSON, which can crash rendering instead of presenting a recoverable error.
Scope: parameterize the existing canonical catalog request; add explicit load-more and known-hash selection in canonical setup. Preserve loaded pages and the selection on a failed next page; retry that same page, deduplicate overlapping hashes, and reset/fence stale page responses on refresh/retention. The exact-hash action uses the existing detail endpoint and must validate identity/eligibility before saving. A known selected hash remains visible outside the current page. Validate list/detail response envelopes and manifest shape at these existing transport boundaries; preserve valid unavailable entries and v2 manifests with non-null parentDatasetHash (the preparation-only schema currently forbids those). No new backend endpoint, database, generic picker, search service, automatic all-history load or financial changes.
Acceptance: choose and save a dataset beyond the first 50; choose an exact known hash even when absent from the list; malformed hashes do not fetch or submit; missing, unavailable, mismatched or malformed responses show errors and cannot authorize save; a later stale lookup/page cannot replace current state. Loading/empty/error states distinguish no loaded entries from lookup failure; loaded entries survive paging failures; loading controls cannot skip a failed page. Inspecting or typing a hash never submits the enclosing form. Saving uses the verified chosen hash and its exact bounds; no run starts automatically. Refresh after retention includes the new dataset without duplicating rows or losing current selection.
Files/locks: CanonicalSetup.tsx, backtestApiV2.ts, focused test/integration/canonical-workbench.test.tsx (add a focused transport test file if necessary). Root owns the shared browser test and all planning state. Parallel with RP06, which owns only the parent page and its lifecycle tests. Frontend implementation agent; independent transport/UI review.
Required tests: >50 entries and exact hash; appended page failure/retry and overlapping responses; stale refresh/lookup; unavailable/corrupt/malformed entries including valid converted v2 parent hash; final saved input and no unintended submission. Extend real authenticated browser/database workflow. Run focused tests, application/authored-test types, strict lint, production build; root combined repository and browser gates. Risk: stale data changing selection or falsely accepting malformed metadata; existing server admission remains authoritative.