From 706aa5fd73619f568b12627b129d30f1e2eb7ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 10 May 2026 20:46:55 +0200 Subject: [PATCH] feat(settings): comparison-overlay becomes a global dashboard preference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Up to v1.4.21 the comparison-baseline toggle lived in two places: the canonical Settings → Dashboard picker (where it's persisted) and an on-surface duplicate above the Daily Briefing on `/insights`. Per the "no split" rule the duplicate is removed: the toggle is a global preference, so it belongs in Settings only. Every chart on `/insights` still consumes the resolved `comparisonBaseline` from the same dashboard-layout query the picker writes to, so flipping the Settings toggle keeps propagating to every overlay on next refetch — only the duplicate UI affordance is gone. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/app/__tests__/insights-polish.test.ts | 28 +++++++++++++++++++++++ src/app/insights/page.tsx | 2 -- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/app/__tests__/insights-polish.test.ts b/src/app/__tests__/insights-polish.test.ts index 2aac0daeb..f2bb50a6f 100644 --- a/src/app/__tests__/insights-polish.test.ts +++ b/src/app/__tests__/insights-polish.test.ts @@ -180,3 +180,31 @@ describe("v1.4.19 A3 — chart-token leak hardening", () => { expect(parseChartTokens("metric:WEIGHT")).toEqual(["metric:WEIGHT"]); }); }); + +describe("v1.4.22 A3 — comparison toggle is global Settings only", () => { + /** + * The comparison-overlay toggle is a global preference. Up to v1.4.21 + * the toggle existed both in `/settings/dashboard` (canonical) and + * `/insights` (via `} />`). + * Per `feedback_settings_no_split.md` the toggle now lives in + * Settings only — the on-surface affordance is gone from `/insights`. + * Every chart still consumes the resolved `comparisonBaseline` value + * the same way it did before, so flipping the Settings toggle still + * propagates to the page on next refetch. + */ + it("/insights does NOT mount anywhere", () => { + const src = load(INSIGHTS_PATH); + expect(src).not.toMatch(/ { + // Drift guard — the page must still hand `compareBaseline` to every + // chart so the global Settings toggle keeps driving the overlay. + const src = load(INSIGHTS_PATH); + expect(src).toContain("comparisonBaseline"); + expect(src).toContain("compareBaseline"); + }); +}); diff --git a/src/app/insights/page.tsx b/src/app/insights/page.tsx index 360caaf43..b4fbbbbce 100644 --- a/src/app/insights/page.tsx +++ b/src/app/insights/page.tsx @@ -49,7 +49,6 @@ import { CorrelationRow } from "@/components/insights/correlation-row"; import { useInsightsAdvisorQuery } from "@/components/insights/use-insights-advisor"; import type { CorrelationResult } from "@/lib/insights/correlations"; import { toWeekISO } from "@/lib/insights/week-iso"; -import { CompareToggle } from "@/components/comparison/compare-toggle"; // Recharts is ~108 KiB Brotli — defer-load it via a self-contained scatter // wrapper so the bundle only lands once a correlation card actually renders. // Every scatter card sits inside a `length >= 5` gate and below the fold, @@ -979,7 +978,6 @@ export default function InsightsPage() { loading={advisor.isLoading} onRegenerate={advisor.regenerate} regenerating={advisor.isRegenerating} - metaSlot={} /> {/* v1.4.20 phase B3 — Correlation discovery row. Three pre-defined