Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(frontend): point non-backtest runs to Studio instead of a blank dashboard

Iago Pueyo2a42c0c1c7df
diff --git a/frontend/src/components/charts/StrategyResearchDashboard.tsx b/frontend/src/components/charts/StrategyResearchDashboard.tsx
index bc77c90c5..334c6e017 100644
--- a/frontend/src/components/charts/StrategyResearchDashboard.tsx
+++ b/frontend/src/components/charts/StrategyResearchDashboard.tsx
@@ -207,6 +207,21 @@ export function StrategyResearchDashboard({ run }: { run: RunData }) {
};
}, [dark, equityRows, trades]);
+ // This dashboard is built around a classic equity-curve backtest. A
+ // portfolio-construction / risk-snapshot run (risk_xray, rebalance_notes)
+ // has neither, so every KPI and chart here would silently render as
+ // dashes/blank -- which reads as "broken", not "different run type". Point
+ // to the Studio tab instead, which actually renders that run's data.
+ if (equityRows.length === 0 && trades.length === 0 && (run.risk_xray || run.rebalance_notes)) {
+ return (
+ <div className="mx-auto max-w-[640px] rounded-xl border border-[#dfe2e7] bg-card p-8 text-center shadow-sm">
+ <FlaskConical className="mx-auto h-8 w-8 text-muted-foreground" aria-hidden="true" />
+ <p className="mt-3 text-sm font-medium text-foreground">{t("runDashboard.noBacktestData")}</p>
+ <p className="mt-1 text-sm text-muted-foreground">{t("runDashboard.noBacktestDataStudioHint")}</p>
+ </div>
+ );
+ }
+
const metrics: Record<string, number> = run.metrics || {};
const kpis = [
[t("runDashboard.kpiTotalReturn"), pct(metrics.total_return), BLUE],
diff --git a/frontend/src/components/charts/__tests__/StrategyResearchDashboard.test.tsx b/frontend/src/components/charts/__tests__/StrategyResearchDashboard.test.tsx
new file mode 100644
index 000000000..cdadb99b6
--- /dev/null
+++ b/frontend/src/components/charts/__tests__/StrategyResearchDashboard.test.tsx
@@ -0,0 +1,71 @@
+import { render, screen } from "@testing-library/react";
+import type { RunData } from "@/lib/api";
+import { StrategyResearchDashboard } from "../StrategyResearchDashboard";
+import { echarts } from "@/lib/echarts";
+
+// Regression test for: a portfolio-construction / risk-snapshot run (only
+// risk_xray / rebalance_notes, no equity curve or trades) rendered the full
+// backtest dashboard shell with every KPI and chart silently blank/dashed --
+// indistinguishable from a broken page. It should instead point to the
+// Studio tab, which is where that run's actual numbers render.
+
+vi.mock("@/lib/echarts", () => ({
+ echarts: { init: vi.fn() },
+}));
+
+function makeRun(overrides: Partial<RunData> = {}): RunData {
+ return {
+ status: "success",
+ run_id: "run-riskxray",
+ ...overrides,
+ };
+}
+
+describe("StrategyResearchDashboard empty state", () => {
+ beforeEach(() => {
+ vi.mocked(echarts.init).mockImplementation((() => ({
+ setOption: vi.fn(),
+ resize: vi.fn(),
+ dispose: vi.fn(),
+ group: "",
+ })) as unknown as typeof echarts.init);
+ });
+
+ it("points to Studio instead of a blank KPI shell for a risk_xray-only run", () => {
+ render(<StrategyResearchDashboard run={makeRun({ risk_xray: { concentration: { hhi: 0.018 } } })} />);
+
+ expect(screen.getByText("This run has no backtest data to chart")).toBeInTheDocument();
+ expect(screen.getByText(/Studio tab/)).toBeInTheDocument();
+ expect(screen.queryByText("Sharpe")).not.toBeInTheDocument();
+ });
+
+ it("also applies for a rebalance_notes-only run", () => {
+ render(<StrategyResearchDashboard run={makeRun({
+ rebalance_notes: { summary: { rebalance_count: 3, turnover_total: 0.3, turnover_mean: 0.1, turnover_max: 0.15 } },
+ })} />);
+
+ expect(screen.getByText("This run has no backtest data to chart")).toBeInTheDocument();
+ });
+
+ it("renders the normal dashboard when equity/trade data is present, even alongside risk_xray", () => {
+ render(<StrategyResearchDashboard run={makeRun({
+ risk_xray: { concentration: { hhi: 0.018 } },
+ equity_curve: [
+ { time: "2026-01-01", equity: 100, drawdown: 0 },
+ { time: "2026-01-02", equity: 101, drawdown: 0 },
+ ],
+ metrics: {
+ final_value: 1_010_000,
+ total_return: 0.01,
+ annual_return: 0.01,
+ max_drawdown: -0.01,
+ sharpe: 1.2,
+ win_rate: 0.5,
+ trade_count: 2,
+ },
+ })} />);
+
+ expect(screen.queryByText("This run has no backtest data to chart")).not.toBeInTheDocument();
+ expect(screen.getByText("Sharpe")).toBeInTheDocument();
+ });
+});
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json
index 433bc0480..da817821f 100644
--- a/frontend/src/i18n/locales/ar.json
+++ b/frontend/src/i18n/locales/ar.json
@@ -1399,6 +1399,8 @@
},
"runDashboard": {
"eyebrow": "بحث كمّي · اختبار رجعي",
+ "noBacktestData": "لا توجد بيانات اختبار رجعي لعرضها في هذا التشغيل",
+ "noBacktestDataStudioHint": "يبدو أنه تحليل محفظة/مخاطر بدلاً من ذلك — راجع أرقامه في تبويب Studio.",
"engine": "محرك",
"portfolio": "محفظة",
"systematicStrategy": "استراتيجية منهجية",
diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json
index d074606e2..7e8fb3df2 100644
--- a/frontend/src/i18n/locales/de.json
+++ b/frontend/src/i18n/locales/de.json
@@ -1399,6 +1399,8 @@
},
"runDashboard": {
"eyebrow": "Quantitative Forschung · Backtest",
+ "noBacktestData": "Für diesen Run gibt es keine Backtest-Daten zum Anzeigen",
+ "noBacktestDataStudioHint": "Das sieht eher nach einer Portfolio-/Risikoanalyse aus — die Zahlen dazu finden Sie im Studio-Tab.",
"engine": "Engine",
"portfolio": "Portfolio",
"systematicStrategy": "Systematische Strategie",
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index 5986b954d..53a6f96a2 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -1399,6 +1399,8 @@
},
"runDashboard": {
"eyebrow": "Quantitative research · Backtest",
+ "noBacktestData": "This run has no backtest data to chart",
+ "noBacktestDataStudioHint": "It looks like a portfolio/risk analysis instead — check the Studio tab for its numbers.",
"engine": "engine",
"portfolio": "Portfolio",
"systematicStrategy": "Systematic strategy",
diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json
index 502adce4a..791725f5e 100644
--- a/frontend/src/i18n/locales/es.json
+++ b/frontend/src/i18n/locales/es.json
@@ -1399,6 +1399,8 @@
},
"runDashboard": {
"eyebrow": "Investigación cuantitativa · Backtest",
+ "noBacktestData": "Este run no tiene datos de backtest que graficar",
+ "noBacktestDataStudioHint": "Parece un análisis de cartera/riesgo — consulta sus números en la pestaña Studio.",
"engine": "motor",
"portfolio": "Cartera",
"systematicStrategy": "Estrategia sistemática",
diff --git a/frontend/src/i18n/locales/ja.json b/frontend/src/i18n/locales/ja.json
index c05889a84..1854da5d9 100644
--- a/frontend/src/i18n/locales/ja.json
+++ b/frontend/src/i18n/locales/ja.json
@@ -1399,6 +1399,8 @@
},
"runDashboard": {
"eyebrow": "定量リサーチ · バックテスト",
+ "noBacktestData": "このRunにはグラフ化できるバックテストデータがありません",
+ "noBacktestDataStudioHint": "ポートフォリオ/リスク分析のようです — 数値はStudioタブで確認してください。",
"engine": "エンジン",
"portfolio": "ポートフォリオ",
"systematicStrategy": "システマティック戦略",
diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json
index 40bf82c9b..63b855600 100644
--- a/frontend/src/i18n/locales/ko.json
+++ b/frontend/src/i18n/locales/ko.json
@@ -1399,6 +1399,8 @@
},
"runDashboard": {
"eyebrow": "계량 리서치 · 백테스트",
+ "noBacktestData": "이 실행에는 표시할 백테스트 데이터가 없습니다",
+ "noBacktestDataStudioHint": "포트폴리오/리스크 분석으로 보입니다 — 수치는 Studio 탭에서 확인하세요.",
"engine": "엔진",
"portfolio": "포트폴리오",
"systematicStrategy": "시스테매틱 전략",
diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json
index ff1db00a9..2f1a9238c 100644
--- a/frontend/src/i18n/locales/zh-CN.json
+++ b/frontend/src/i18n/locales/zh-CN.json
@@ -1399,6 +1399,8 @@
},
"runDashboard": {
"eyebrow": "量化研究 · 策略回测",
+ "noBacktestData": "该次运行没有可供绘图的回测数据",
+ "noBacktestDataStudioHint": "这看起来是一次投资组合/风险分析——请在 Studio 标签页查看具体数值。",
"engine": "回测引擎",
"portfolio": "投资组合",
"systematicStrategy": "系统化交易策略",