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

2.7 KiB

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.