From e3bd708838ce17a4da0bc2b4d6be701b72625dd8 Mon Sep 17 00:00:00 2001 From: Boki Date: Sat, 24 Oct 2026 01:26:07 -0400 Subject: [PATCH] feat(research): add workspace and evidence-linked finding UI --- apps/stock/web-app/src/app/App.tsx | 5 + .../web-app/src/components/layout/Layout.tsx | 11 +- .../backtest/BacktestDetailPageV2.tsx | 36 + .../features/research/ResearchListPage.tsx | 234 +++ .../features/research/ResearchProjectPage.tsx | 632 ++++++ .../components/CreateResearchEntry.tsx | 207 ++ .../research/components/ResearchEntry.tsx | 513 +++++ .../research/components/ResearchEvidence.tsx | 102 + .../research/components/SaveFindingDialog.tsx | 493 +++++ .../web-app/src/features/research/index.ts | 2 + .../features/research/services/researchApi.ts | 228 +++ apps/stock/web-app/src/lib/constants.ts | 5 +- docs/development/ROADMAP.md | 19 +- docs/development/backlog/README.md | 8 +- docs/development/backlog/manifest.json | 1798 ++++------------- docs/development/backlog/tasks/R04.md | 22 +- test/e2e/fixture.ts | 3 + test/e2e/workbench.test.ts | 148 +- test/integration/research-client.test.tsx | 150 ++ test/integration/research-finding-ui.test.tsx | 650 ++++++ .../research-workspace-ui.test.tsx | 679 +++++++ 21 files changed, 4566 insertions(+), 1379 deletions(-) create mode 100644 apps/stock/web-app/src/features/research/ResearchListPage.tsx create mode 100644 apps/stock/web-app/src/features/research/ResearchProjectPage.tsx create mode 100644 apps/stock/web-app/src/features/research/components/CreateResearchEntry.tsx create mode 100644 apps/stock/web-app/src/features/research/components/ResearchEntry.tsx create mode 100644 apps/stock/web-app/src/features/research/components/ResearchEvidence.tsx create mode 100644 apps/stock/web-app/src/features/research/components/SaveFindingDialog.tsx create mode 100644 apps/stock/web-app/src/features/research/index.ts create mode 100644 apps/stock/web-app/src/features/research/services/researchApi.ts create mode 100644 test/integration/research-client.test.tsx create mode 100644 test/integration/research-finding-ui.test.tsx create mode 100644 test/integration/research-workspace-ui.test.tsx diff --git a/apps/stock/web-app/src/app/App.tsx b/apps/stock/web-app/src/app/App.tsx index 2c1ff740..7ebdc1c0 100644 --- a/apps/stock/web-app/src/app/App.tsx +++ b/apps/stock/web-app/src/app/App.tsx @@ -5,6 +5,7 @@ import { DashboardPage } from '@/features/dashboard'; import { ExchangesPage } from '@/features/exchanges'; import { MonitoringPage } from '@/features/monitoring'; import { PipelinePage } from '@/features/pipeline'; +import { ResearchListPage, ResearchProjectPage } from '@/features/research'; import { StrategyDetailPage, StrategyListPage, StrategyVersionPage } from '@/features/strategies'; import { SymbolDetailPage, SymbolsPage } from '@/features/symbols'; import { AuthGate } from './AuthGate'; @@ -43,6 +44,10 @@ export function App() { } /> + + } /> + } /> + Settings Page - Coming Soon} diff --git a/apps/stock/web-app/src/components/layout/Layout.tsx b/apps/stock/web-app/src/components/layout/Layout.tsx index c20fe049..66920f53 100644 --- a/apps/stock/web-app/src/components/layout/Layout.tsx +++ b/apps/stock/web-app/src/components/layout/Layout.tsx @@ -10,8 +10,13 @@ export function Layout() { // Determine title from current route const getTitle = () => { const path = location.pathname.replace('/', ''); - if (!path || path === 'dashboard') {return 'Dashboard';} - + if (path === 'research' || path.startsWith('research/')) { + return 'Research'; + } + if (!path || path === 'dashboard') { + return 'Dashboard'; + } + // Handle nested routes if (path.includes('/')) { const parts = path.split('/'); @@ -20,7 +25,7 @@ export function Layout() { return parts[1].charAt(0).toUpperCase() + parts[1].slice(1); } } - + return path.charAt(0).toUpperCase() + path.slice(1); }; diff --git a/apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx b/apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx index 873fed04..80409446 100644 --- a/apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx +++ b/apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx @@ -2,6 +2,7 @@ import { ArrowLeftIcon, PlusIcon } from '@heroicons/react/24/outline'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { Link, useNavigate, useParams } from 'react-router-dom'; import { isCanonicalRunResult } from '@stock-bot/stock-config/canonical-research'; +import { SaveFindingDialog } from '@/features/research/components/SaveFindingDialog'; import { catalogExecutionReason, supportedLegacyStrategy, @@ -34,6 +35,7 @@ export function BacktestDetailPageV2() { const navigate = useNavigate(); const [activeTab, setActiveTab] = useState('details'); const [showNewRun, setShowNewRun] = useState(false); + const [showFinding, setShowFinding] = useState(false); const [showArchiveDialog, setShowArchiveDialog] = useState(false); const [showCanonicalSetup, setShowCanonicalSetup] = useState(false); const navigationGeneration = useRef(0); @@ -62,6 +64,17 @@ export function BacktestDetailPageV2() { refreshRun, } = useBacktestV2(); const archived = Boolean(backtest?.archivedAt); + const findingResult = + !isLoading && + currentRun?.status === 'completed' && + currentRun.id === runId && + currentRun.backtestId === id && + runResults?.status === 'completed' && + runResults.runId === runId && + runResults.backtestId === id && + backtest?.id === id + ? runResults + : null; const catalog = Boolean(backtest?.strategyVersionId) || backtest?.strategy === 'catalog'; const unsupportedLegacy = Boolean( backtest && !catalog && !supportedLegacyStrategy(backtest.strategy) @@ -87,6 +100,7 @@ export function BacktestDetailPageV2() { setShowNewRun(false); setShowArchiveDialog(false); setShowCanonicalSetup(false); + setShowFinding(false); return () => { navigationGeneration.current++; }; @@ -469,6 +483,21 @@ export function BacktestDetailPageV2() { {/* Run Controls */} + {currentRun && ( + + )} {backtest && ( + +

+ Organize hypotheses, strategies and findings with links to the exact backtests supporting + them. +

+ {open && ( + +
void create(event)} + > + +