stock-bot/docs/development/architecture/decisions/006-research-product.md

2.5 KiB
Raw Blame History

ADR-006 — Web-first research product and minimal persistence

Status: proposed for plan approval; web as primary product is user-mandated.

Selected approach

Extend current React features, Hono v2 APIs, SQL definitions/runs/results, durable outbox/queue, frozen datasets and websocket projection. The browser and AI clients use the same business APIs.

Add only strategies, immutable strategy_versions, research_projects, hypotheses, experiments and analysis_artifacts. Attach candidate/experiment identity to existing runs; keep backtests as editable templates. A later paper deployment record is optional. Store stable single-owner/agent identity without implementing full multi-tenancy.

Retain artifact bytes or immutable retained references, not hashes alone. Archive referenced evidence; no automatic purge by default. Future operator retention must respect references and explicit consent.

Evidence

Existing submission transaction, existing result contract, schema deletion cascade, existing UI routes.

Alternatives / tradeoffs

A separate research database, job service, AI-only APIs or general laboratory/workflow system duplicates working infrastructure. SQL metadata and bounded job expansion suffice. Existing JSONB results are acceptable until measurement warrants paged/normalized detail. Source editing initially uses repository/artifact submission plus schema forms and version diff; no browser IDE prerequisite.

Migration

W01–W04 deliver the existing exploratory workflow while engine work proceeds. R01–R04 add strategy/workspace value independently of Rust cutover. R05 turns that same workbench into a reproducible canonical-engine workflow; R06–R09 add experiments/validation. Legacy results stay read-only and visibly qualified. See product contracts.

Reduced product dependencies

API/data contracts gate implementation, not unrelated screens. Catalog/workspace/experiment/dataset UI tasks can use focused tests before W04 is complete, but shared browser coverage remains a feature-release gate. Basic experiment comparison needs a frozen dataset ID, not the entire project workspace or dataset picker. Findings reference immutable metric paths rather than creating another metric store. R06 ships summary projections; P05 is only a later measured detail optimization.