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

20 lines
3.3 KiB
Markdown

# RP24 — Verify single-run finding acknowledgements in the web app
Parent E12. Priority P2 / Medium workflow defect. Complexity S. Dependencies R04, R09, RP23. Owner continuation authorizes implementation and commits. All seven conditional tasks remain deferred.
Verified baseline: `SaveFindingDialog.tsx` checks returned source/evidence identities only when `source.context !== null`. `singleRunFindingSource` always has null context, so a successful response with missing evidence or a different cited run/version/metric is displayed as saved. The existing canonical UI success fixture even returns an empty evidence array. This differs from the strict identity checks used by report findings and the typed research client.
Scope: compare returned source and selected evidence identities for every finding. Treat absent/null source as equivalent, and absent/null strategy version as equivalent for unversioned historical references. Keep exact canonical strategy versions and selected run/metric identities. Preserve legacy result support and server-resolved measurements. A response that cannot be verified must retain the draft, block duplicate creation and use the existing uncertain-save recovery UI.
Affected modules: `apps/stock/web-app/src/features/research/components/SaveFindingDialog.tsx`; `test/integration/research-finding-ui.test.tsx`; existing source-dialog and browser research tests if required. Backend/schema, financial engine and data capture are excluded. Do not add a simulator, generic response framework, new recovery flow or financial recomputation.
Acceptance and tests:
- A single-run acknowledgement with empty/missing/extra or substituted run/version/metrics evidence, or an unexpected aggregate source, never displays saved success. It preserves the draft, exposes the existing uncertain-save notice and sends no retry.
- Canonical selected references succeed with omitted/null aggregate source and exact returned identities. Legacy references with absent/null version continue to succeed, retain their qualifications and never acquire a version.
- A matching attached report/experiment still succeeds; changed source/evidence still fails. Existing preflight, cancellation, stale-response and draft-recovery tests remain green.
- Run the focused finding/source UI tests, authored/application types, strict scoped lint/formatting, web build and the research browser workflow where available. Record actual outcomes and any limitations. No new real-data research or paper/live activation.
Definition of done: reproduce the skipped identity check before changing source, apply the smallest correction, review the diff against both canonical and legacy response shapes, pass the relevant checks, update canonical task state and commit. No new architecture decision is required.
Accepted after root review: plan `2da899da`, implementation `f80ae2f3`. Nine baseline regressions failed before the fix (incorrect saved success, including a crash on missing evidence). Finding/source UI suites passed 62 tests / 328 assertions; the complete built Chromium workbench passed 23 / 852, including actual committed-write recovery and unchanged run counts. Application/authored types, contracts, explicit scoped lint, formatting, secrets and diff checks passed. Disposable stores were stopped. [Execution evidence](../../real-data-research.md#rp24--single-run-finding-acknowledgements).