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

4.7 KiB

W04 — Verify the first research vertical slice in a browser

Parent epic: E5. Priority/severity: P1 / High. Relative complexity: M. Recommended specialization: Full-stack test engineering.

Scheduling source of truth: manifest entry W04. No task is authorized until the plan is approved. Dependencies and decision references below describe the design; the manifest controls current readiness.

Evidence and root cause

Intended behavior and implementation scope

Add a narrowly scoped browser runner if the repository lacks one; prefer Playwright for real navigation and use existing Bun/server-render tests for small components. Exercise actual API/dispatcher/disposable DB and a deterministic fixture worker, plus one native smoke run.

Measurable benefit: Protects the primary product path while internals migrate.

Exclusions

No unrelated refactor, new service or broker activation.

Likely files and ownership

  • test/e2e/ (extend)
  • apps/stock/web-app/package.json
  • scripts/test-postgres.ts
  • apps/stock/web-app/src/features/backtest/

Write locks: browser-harness. One agent owns this change. Lock names do not override actual overlapping files.

Dependencies and blockers

Implementation requires W01, W02, W03, C06 integrated.

No additional economic-policy approval is needed for this narrowly scoped task.

Parallel eligibility: only with disjoint actual files and reserved write locks; read FIRST-WAVE.md for the initial exact ownership boundaries.

Acceptance criteria

  • Select supported strategy -> save/configure -> submit -> pending/running -> completed -> trades -> reload URL works.
  • Cancellation, worker failure, empty results, inaccessible run and network reconnect have user-visible outcomes.
  • Initial slice is explicitly exploratory until F08/S02/R05 correctness-gate evidence; no mock fixture is claimed as financial correctness proof.

Mandatory tests

  • browser_saved_run_lifecycle, browser_cancel_failure, browser_reopen_and_switch, native_smoke.
  • Disposable PostgreSQL/Redis suite; browser install is an explicit dependency, not assumed present.

Apply the relevant quality gates; submit exact commands, outcomes and skipped checks. Named cases above are required regression scenarios, not claims that those tests already exist.

Regression risks and rollback

Compatibility or lifecycle regression; preserve frozen inputs, old results and existing failure tests. Keep migrations additive and previous results readable. Do not add a switch that restores a correctness defect. Versioned cutover/migration is required only when persisted contracts or active engines change; never silently fall back to old economics.

Web/API contract and user states

  • API: Exercise existing v2 APIs and websocket projection; no new business endpoints.
  • Backend/data dependencies: Isolated test DB/queue and fixture dataset; never local paper accounts.
  • Loading/error/empty behavior: Assert loading/empty/error/retry/cancelled states in rendered UI.
  • User-facing completion is demonstrated by the acceptance criteria and interaction tests above; a backend-only implementation is insufficient where a UI is in scope.

Handoff

Report scope changes (if any), fixture expectations, API/schema changes, measurements, remaining limitations and commit/PR references once authorized. Request independent review; only the integration/planning owner may mark the manifest done.