stock-bot/docs/development/backlog/tasks/RP13.md

19 lines
3 KiB
Markdown

# RP13 — Restore browser reproduction of isolated candidate runs
Parent E12. Priority P1 / High workflow defect. Complexity S. Dependencies R12 and A02. Owner continuation authorizes this correction to existing research behavior.
Verified baseline: `backtestApiV2.reproductionPreview` requires a non-null `currentReviewId` for every available preview. `verifyReproductionInputs` deliberately allows an unreviewed candidate in isolation, returning null, while built-ins require approval. The browser therefore rejects a valid candidate preview and disables confirmation. `/tmp/stock-bot-rp13-baseline.log` records the failing actual component/transport regression using a schema-valid candidate. `test/postgres/isolated-candidates.test.ts` already exercises null-review reproduction, economic matching, explicit revocation and retained receipts.
Scope: apply the existing origin-specific review requirement in browser validation; show absent candidate review as absent, without implying approval or a failed eligibility check. Correct the shared preview field comment. Preserve full request/runtime validation, exact original identity, backend eligibility, frozen receipt retries and built-in approval checks. No change to isolation, financial semantics, reproduction admission, paper/live permissions or legacy behavior. No new endpoint or strategy abstraction.
Ownership: implementation agent owns `apps/stock/web-app/src/features/backtest/services/backtestApiV2.ts`, `components/RunReproduction.tsx` under the same feature, `apps/stock/config/src/contracts/canonical-research.ts` (comment only), and `test/integration/run-reproduction-ui.test.tsx`. Root owns shared browser/real PostgreSQL regressions, planning records and commits. Independent review required. Other discovered navigation defects are separate work.
Acceptance/tests:
- An available schema-valid candidate preview with null original/current review opens the exact retained inputs and enables explicit reproduction. Preview alone performs no write.
- Reviewed candidates still work; built-ins without current approval remain rejected. Unavailable/revoked candidates, incompatible runtime payloads and wrong run/parent identities cannot authorize a fresh submission.
- Candidate submission uses only the original run and the existing idempotency key. An uncertain response retries that exact receipt without using edited template settings.
- The browser completes an unreviewed candidate reproduction through the existing durable isolated runner, reopens the server's economic-match result and preserves original provenance. No human approval is created by reproduction.
- Existing PostgreSQL candidate reproduction and revocation/receipt tests continue passing; original built-in browser reproduction remains covered.
Gates: focused reproduction UI/API tests, application/authored types, lint/build, root repository check, focused disposable PostgreSQL candidate regression, and the full browser suite. No development runs or paper/live activation; conditional performance tasks stay deferred.