feat(research): add workspace and evidence-linked finding UI

This commit is contained in:
Boki 2026-10-24 01:26:07 -04:00
parent ee45257507
commit e3bd708838
21 changed files with 4566 additions and 1379 deletions

View file

@ -1,6 +1,6 @@
# Canonical development backlog
**First twenty-three waves committed; R03 is validated and uncommitted.** The initial R05 slice is accepted as `618fb9e`; broader R05 remains in progress. R03 adds research projects, revisioned hypotheses/notes/findings and exact retained metric citations through the shared API. R04 supplies the workspace UI next. Performance work remains paused. See [current handoff](../ROADMAP.md#twenty-fourth-wave-handoff--2026-10-23) and manifest execution scope.
**First twenty-four waves committed; R04 is validated and uncommitted.** R03 is accepted as `ee45257`. The workspace now connects projects, revisioned narratives, linked strategies and exact saved-run findings through the existing APIs. Broader R05 remains in progress. Performance work remains paused. See [current handoff](../ROADMAP.md#twenty-fifth-wave-handoff--2026-10-24) and manifest execution scope.
## One source of truth
@ -74,8 +74,8 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
| --- | --- | --- | --- | --- |
| [R01 Persist immutable strategy versions and parameter schemas](tasks/R01.md) | P1 / done | O01, ADR-006 | — | Full-stack research product / M |
| [R02 Deliver strategy catalog and version-aware backtest setup](tasks/R02.md) | P1 / done | R01, W03, ADR-006 | W04 | Full-stack research product / M |
| [R03 Add projects, hypotheses and evidence-linked findings APIs](tasks/R03.md) | P1 / review | R01, R10, ADR-006 | — | Full-stack research product / M |
| [R04 Deliver research workspace and save-findings flow](tasks/R04.md) | P1 / blocked | R03, W02, ADR-006 | W04 | Full-stack research product / M |
| [R03 Add projects, hypotheses and evidence-linked findings APIs](tasks/R03.md) | P1 / done | R01, R10, ADR-006 | — | Full-stack research product / M |
| [R04 Deliver research workspace and save-findings flow](tasks/R04.md) | P1 / review | R03, W02, ADR-006 | W04 | Full-stack research product / M |
| [R05 Freeze complete provenance and cut over durable canonical runs](tasks/R05.md) | P0 / in_progress | F08, S02, R01, R10, D01, W03, C06, ADR-006 | Multi-asset default mark-policy disposition | Full-stack research product / M |
| [R06 Create immutable experiments and bounded sweep expansion](tasks/R06.md) | P1 / blocked | R05, ADR-006 | — | Full-stack research product / M |
| [R07 Deliver sweep configuration and comparable-result views](tasks/R07.md) | P1 / blocked | R06, ADR-006 | W04 | Full-stack research product / M |
@ -118,4 +118,4 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
Before any wave: unique IDs; existing task/ADR references; acyclic implementation graph; no scheduled task dependent on merged/deferred work; approvals/readiness; actual file locks; isolated native build outputs/workspace dependencies and test databases. Release gates are checked separately at activation.
The first twenty-one waves are committed, including R10 (`8cca0ee`). **R02 catalog and versioned setup is validated and awaiting acceptance/commit; performance work remains deferred by the owner.** ADR-006 is approved; R03/R05 prerequisites are integrated but those tasks are outside this wave. R05 is next: verified retained-artifact execution through the existing canonical runtime and durable runner. The multi-asset mark-policy gate still blocks default activation. No default/paper activation, push or PR is included in this continuation.
R03 is committed; R04 awaits acceptance/commit after independent review and full integration/browser checks. R12 original-run reproduction is the recommended next product slice, but its current manifest dependency on full R05 remains blocked. Before execution, explicitly scope it to retained, single-asset, same-installed-build inputs and pin guarded reproduction admission without weakening current authorization. R05 source preparation and broader cutover remain incomplete; R06/S06 are not unblocked. Performance and multi-asset/default/paper activation remain excluded.

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,8 @@ Scheduling source of truth: [manifest entry R04](../manifest.json). No task is a
## Evidence and root cause
- **WEB-01 — Verified:** The real backtest list/detail/API/SQL flow already exists. Strategy/project/experiment work should extend it; App strategy/analytics views are placeholders. [apps/stock/web-app/src/app/App.tsx:24](../../../../apps/stock/web-app/src/app/App.tsx#L24); [apps/stock/web-api/src/services/backtest-v2.service.ts:211](../../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L211).
- **WEB-04 — Verified:** Existing results snapshot configuration and datasets but do not capture an immutable strategy artifact/engine build/model/seed bundle. Legacy projection can fall back to mutable definition fields. [libs/core/types/src/backtest-run.ts:4](../../../../libs/core/types/src/backtest-run.ts#L4); [apps/stock/web-api/src/services/backtest-result.ts:107](../../../../apps/stock/web-api/src/services/backtest-result.ts#L107).
- **WEB-01 — Verified:** The real backtest list/detail/API/SQL flow already exists. Strategy/project/experiment work should extend it; The existing strategy catalog, immutable versions and retained canonical single-asset run path are integrated; this task adds the research workspace around them. [apps/stock/web-app/src/app/App.tsx:24](../../../../apps/stock/web-app/src/app/App.tsx#L24); [apps/stock/web-api/src/services/backtest-v2.service.ts:211](../../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L211).
- **WEB-04 — Historical finding, partially resolved by R01/R05:** Retained canonical runs now bind immutable strategy and engine inputs. Legacy projections can still use mutable definition fallbacks; the workspace must preserve each result kind and its evidence limitations. [libs/core/types/src/backtest-run.ts:4](../../../../libs/core/types/src/backtest-run.ts#L4); [apps/stock/web-api/src/services/backtest-result.ts:107](../../../../apps/stock/web-api/src/services/backtest-result.ts#L107).
## Intended behavior and implementation scope
@ -23,10 +23,10 @@ No general workflow framework, browser IDE, multi-tenant identity platform or se
- apps/stock/web-app/src/features/research/ (new)
- apps/stock/web-app/src/app/App.tsx
- apps/stock/web-app/src/lib/constants/navigation.ts
- apps/stock/web-app/src/lib/constants.ts
- apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx
Write locks: web-research, web-backtest-detail. One agent owns this change. Lock names do not override actual overlapping files.
Write locks: web-research, web-backtest-detail. Root coordinates separate workspace and save-finding UI owners; actual file assignments are recorded in the manifest. Lock names do not override actual overlapping files.
## Dependencies and blockers
@ -66,3 +66,17 @@ Keep migrations additive and previous results readable. Do not add a switch that
## 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.
## Implemented surface — 2026-10-24
- `/research` lists and creates projects; `/research/:projectId` edits metadata, links catalog strategies, and creates or browses hypotheses, notes and findings. Query selectors `hypothesis`/`artifact` plus optional immutable `revision` identify the displayed narrative.
- Revisions append with `expectedRevision`. A conflict preserves the draft and requires deliberate history review. Historical revisions and archived projects remain readable. Child writes are blocked when project authority cannot be verified.
- Completed matching backtest results offer **Save finding**. Choose an active project, optional exact hypothesis revision, declared content origin and allowlisted measurements. The browser sends reference identities only; R03 resolves values from retained results. Canonical strategy versions come from the original request; legacy results retain their qualifications.
- Evidence displays raw and formatted values, units, unavailable reasons, actual financial engine, dataset identity and exact run/version links. Declared AI/human origin is separate from authenticated submitter; citations never validate the narrative.
- Pending mutations reject duplicate clicks. Lost, malformed or server-error creation responses freeze the draft; users check saved records before explicitly starting another request. Reads and mutation callbacks reject obsolete navigation responses.
- Existing Card/Dialog, strategy parameter form styles, navigation, authentication and APIs are reused. No backend, database, financial or execution contract changed.
The browser acceptance extends the existing retained canonical execution fixture through project creation, an AI-labelled hypothesis, linked strategy selection, backtest setup/run, exact finding, revision history, reload and archived-project reading. It retains the hand-derived two-fill/equity/fee assertions and verifies that original results stay unchanged. Focused DOM tests exercise failure/empty/loading states, conflicts, unavailable evidence, ambiguous saves, archive races and stale replies.
Current integration state and exact checks are in `manifest.json` → `twenty_fifth_wave_validation`; this section does not independently change scheduling status. UI origins are declared labels, not authenticated AI identities; agent credentials/execution, experiment management and automated validation remain separate tasks.