From 3a2d5486109fd69991e13bc3e2093ecb0d1ed43f Mon Sep 17 00:00:00 2001
From: Dennis Thiessen
Date: Tue, 11 Aug 2026 23:25:11 +0200
Subject: [PATCH] feat(backtest): make the tiles answer "is that good?", and
stop the layout jumping
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Five UI problems, all reported from using the page.
Expanding "How this is measured" shoved every control down, because the
disclosure and the run controls shared one flex row. They no longer do: run
status and the controls that start a new run sit together on one line, and the
explainer is below them where growing it moves nothing.
A long strategy name wrapped the dropdown trigger onto three lines and dragged
the row out of alignment. The trigger now truncates with the full text on hover
— a wrapping dropdown is broken anywhere, so the fix is in the primitive — and
the twelve-character "Production: " prefix is a bullet.
"Sortino 2.72" answered nothing. Each risk-adjusted metric now carries a meter:
a track showing where the value sits, ticks at the band edges, and the band word.
Colour never travels alone. Bands are deliberately stricter than textbook ranges
because this universe is today's survivors replayed backward, which flatters
every ratio — that caveat is stated next to them rather than left implied.
The two tile rows were different sizes, which read as inconsistent rather than
as hierarchy. Every tile is the same size now and grouping carries the ranking:
top row is raw outcome and takes no meters, second row is risk-adjusted ratios
and all take meters. Sharpe moved down to join them — it is one of those ratios,
and leaving it above made it the only metered tile in a row of bare ones.
The recommendation led with a long bold sentence that describes the
configuration, not a verdict, while the actual findings were small grey text.
Findings now come first, each split into label and detail on the colon the
backend strings already carry, and the configuration is a footer.
Co-Authored-By: Claude Opus 5
---
.../src/components/signals/BacktestPanel.tsx | 75 +++++++++-------
.../signals/BacktestRecommendationCard.tsx | 88 +++++++++++++------
.../signals/PortfolioMonitorPanel.tsx | 52 +++++++----
frontend/src/components/ui/Dropdown.tsx | 7 +-
frontend/src/components/ui/StatTile.tsx | 60 ++++++++++---
frontend/src/lib/metricBands.ts | 77 ++++++++++++++++
6 files changed, 273 insertions(+), 86 deletions(-)
create mode 100644 frontend/src/lib/metricBands.ts
diff --git a/frontend/src/components/signals/BacktestPanel.tsx b/frontend/src/components/signals/BacktestPanel.tsx
index c1e314e..a777f58 100644
--- a/frontend/src/components/signals/BacktestPanel.tsx
+++ b/frontend/src/components/signals/BacktestPanel.tsx
@@ -70,23 +70,30 @@ export function BacktestPanel() {
return (
-
-
-
- The backtest replays the current config at the selected cadence — at each point the setup is
- rebuilt using only data up to that day (no lookahead) and the following ~30 trading days decide
- its outcome — then simulates one capital-constrained book against the S&P 500. Sentiment and
- fundamentals are held neutral (no point-in-time history). ~6 months is roughly one market regime,
- so read it as directional.
-
-
- Live GTL is the exact target path the scanner and the
- scheduled backtest use; Structural S/R is a comparison
- arm sourcing targets from chart structure. Weekly steps
- five sessions at a time and is what the server runs; Daily
- {' '}is roughly 5× the replay work.
-
-
+ {/* Run status and the controls that start a new run, on one line. The
+ explainer sits BELOW this row rather than beside it — sharing a flex
+ row meant expanding it shoved every control down the page. */}
+
{/* flex-wrap is load-bearing: two dropdowns plus the button overflow a
narrow viewport otherwise. */}
@@ -112,11 +119,30 @@ export function BacktestPanel() {
/>
+
+
+
+ The backtest replays the current config at the selected cadence — at each point the setup is
+ rebuilt using only data up to that day (no lookahead) and the following ~30 trading days decide
+ its outcome — then simulates one capital-constrained book against the S&P 500. Sentiment and
+ fundamentals are held neutral (no point-in-time history). ~6 months is roughly one market regime,
+ so read it as directional.
+
+
+ Live GTL is the exact target path the scanner and the
+ scheduled backtest use; Structural S/R is a comparison
+ arm sourcing targets from chart structure. Weekly steps
+ five sessions at a time and is what the server runs; Daily
+ {' '}is roughly 5× the replay work.
+
+
+
+
{/* Only surfaced for non-default choices — zero noise on the common path,
but a non-production selection still announces itself, which is what
the old always-amber cards were really for. */}
@@ -142,19 +168,6 @@ export function BacktestPanel() {
{report && (
<>
-
)}
+ {/* The config description, demoted: it says what the strategy IS, which
+ is context for the findings above rather than a finding itself. */}
+ {recommendation.headline && (
+
+
Configuration under test
+
{recommendation.headline}
+
+ )}
+
{recommendation.note && (
{recommendation.note}
)}
@@ -77,12 +117,10 @@ export function BacktestRecommendationCard({
{/* Outside the card body on purpose: Disclosure renders its own glass-sm
panel, so nesting it inside the bordered card double-frames it. */}
{secondary.length > 0 && (
-
-
+
+
{secondary.map((item) => (
-
- {item.text}
-
+
))}
diff --git a/frontend/src/components/signals/PortfolioMonitorPanel.tsx b/frontend/src/components/signals/PortfolioMonitorPanel.tsx
index 29d296e..091ba3b 100644
--- a/frontend/src/components/signals/PortfolioMonitorPanel.tsx
+++ b/frontend/src/components/signals/PortfolioMonitorPanel.tsx
@@ -70,7 +70,10 @@ export function PortfolioMonitorPanel({
onChange={onStrategyChange}
options={monitor.strategies.map((s) => ({
value: s.strategy,
- label: `${s.is_production ? 'Production: ' : ''}${s.label}`,
+ // "Production: " prefix dropped — a bullet costs one character
+ // instead of twelve, and the full config is spelled out under
+ // the chart anyway.
+ label: `${s.is_production ? '● ' : ''}${s.label}`,
}))}
/>
@@ -97,7 +100,12 @@ export function PortfolioMonitorPanel({
/>
-
+
@@ -109,39 +117,49 @@ export function PortfolioMonitorPanel({
) : (
-
Risk-adjusted quality
+
+
Risk-adjusted quality
+
+ Bands are set stricter than textbook ranges — this universe is today's
+ survivors replayed backward, which flatters every ratio.
+
+
+
-
)}
diff --git a/frontend/src/components/ui/Dropdown.tsx b/frontend/src/components/ui/Dropdown.tsx
index 3a5f742..4d02ccf 100644
--- a/frontend/src/components/ui/Dropdown.tsx
+++ b/frontend/src/components/ui/Dropdown.tsx
@@ -86,7 +86,12 @@ export function Dropdown({
onClick={() => setOpen((v) => !v)}
className="input-glass flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-sm"
>
-
+ {/* truncate, not wrap: a long option name used to push the trigger to
+ three lines and shove the whole control row out of alignment. */}
+
{selected ? selected.label : placeholder}