From 30954901ac5ec30141d0ef183d260585583debeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 19 Jul 2026 12:44:23 +0200 Subject: [PATCH] chore: reconcile the catalogue and metric-unit guards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The widget catalogue grew to 42 ids, so the snapshot round-trip count follows. The mood card's unit key carries "/5" rather than an empty string — the locale-integrity guard forbids empty values, and the scale is the honest thing to print next to a 1-to-5 score. It joins the identical-across-locales allowlist alongside the other unit notations. --- messages/de.json | 2 +- messages/en.json | 2 +- messages/es.json | 2 +- messages/fr.json | 2 +- messages/it.json | 2 +- messages/pl.json | 2 +- src/__tests__/i18n-english-leak-guard.test.ts | 1 + src/lib/dashboard-layout.ts | 2 -- src/lib/dashboard/__tests__/snapshot.test.ts | 6 +++--- 9 files changed, 10 insertions(+), 11 deletions(-) diff --git a/messages/de.json b/messages/de.json index 7ad5bd619..ae2306d65 100644 --- a/messages/de.json +++ b/messages/de.json @@ -440,7 +440,7 @@ "totalBodyWater": "kg", "boneMass": "kg", "oxygenSaturation": "%", - "mood": "", + "mood": "/5", "bmi": "kg/m²" } } diff --git a/messages/en.json b/messages/en.json index ec57a5d9b..09e95c31b 100644 --- a/messages/en.json +++ b/messages/en.json @@ -440,7 +440,7 @@ "totalBodyWater": "kg", "boneMass": "kg", "oxygenSaturation": "%", - "mood": "", + "mood": "/5", "bmi": "kg/m²" } } diff --git a/messages/es.json b/messages/es.json index 8c9a05e17..67516c0a6 100644 --- a/messages/es.json +++ b/messages/es.json @@ -440,7 +440,7 @@ "totalBodyWater": "kg", "boneMass": "kg", "oxygenSaturation": "%", - "mood": "", + "mood": "/5", "bmi": "kg/m²" } } diff --git a/messages/fr.json b/messages/fr.json index 4a46342e9..27211eaf0 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -440,7 +440,7 @@ "totalBodyWater": "kg", "boneMass": "kg", "oxygenSaturation": "%", - "mood": "", + "mood": "/5", "bmi": "kg/m²" } } diff --git a/messages/it.json b/messages/it.json index 420f19bb4..42060354e 100644 --- a/messages/it.json +++ b/messages/it.json @@ -440,7 +440,7 @@ "totalBodyWater": "kg", "boneMass": "kg", "oxygenSaturation": "%", - "mood": "", + "mood": "/5", "bmi": "kg/m²" } } diff --git a/messages/pl.json b/messages/pl.json index 7514d89fb..b85c044dd 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -440,7 +440,7 @@ "totalBodyWater": "kg", "boneMass": "kg", "oxygenSaturation": "%", - "mood": "", + "mood": "/5", "bmi": "kg/m²" } } diff --git a/src/__tests__/i18n-english-leak-guard.test.ts b/src/__tests__/i18n-english-leak-guard.test.ts index ec7d7962e..ff16c934f 100644 --- a/src/__tests__/i18n-english-leak-guard.test.ts +++ b/src/__tests__/i18n-english-leak-guard.test.ts @@ -82,6 +82,7 @@ const LEGIT_IDENTICAL = new Set([ "charts.vo2Max", "cycle.insights.crosstab.unitGlucose", "dashboard.metric.unit.bmi", + "dashboard.metric.unit.mood", "dashboard.metric.unit.glucose", "dashboard.vo2Max", "dashboard.vo2MaxShort", diff --git a/src/lib/dashboard-layout.ts b/src/lib/dashboard-layout.ts index 56501338b..54447cc5d 100644 --- a/src/lib/dashboard-layout.ts +++ b/src/lib/dashboard-layout.ts @@ -605,8 +605,6 @@ export const LAYOUT_FIELD_MERGE_DISPOSITION = { heroRingOrder: "preserve", } as const satisfies Record; -export type LayoutFieldMergeDisposition = typeof LAYOUT_FIELD_MERGE_DISPOSITION; - /** * The top-level layout fields the widgets PUT carries forward from the stored * layout when the request omits them. Derived from diff --git a/src/lib/dashboard/__tests__/snapshot.test.ts b/src/lib/dashboard/__tests__/snapshot.test.ts index f267aa23e..19ef63e60 100644 --- a/src/lib/dashboard/__tests__/snapshot.test.ts +++ b/src/lib/dashboard/__tests__/snapshot.test.ts @@ -752,11 +752,11 @@ describe("buildDashboardSnapshot — layoutCatalogue (35-id round-trip)", () => isFullyCovered.mockReturnValue(false); }); - it("emits all 38 catalogue ids with visibility + order", async () => { + it("emits all 42 catalogue ids with visibility + order", async () => { const snap = await buildDashboardSnapshot(fakePrisma, baseUser()); - expect(snap.layoutCatalogue).toHaveLength(38); + expect(snap.layoutCatalogue).toHaveLength(42); const ids = new Set(snap.layoutCatalogue.map((w) => w.id)); - expect(ids.size).toBe(38); + expect(ids.size).toBe(42); // iOS-only ids appended default-invisible. const walkingSpeed = snap.layoutCatalogue.find( (w) => w.id === "walkingSpeed",