From a57fa8335ad22c6a5e1735f4ee22283dd4b24dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 22 Oct 2026 07:25:08 +0200 Subject: [PATCH] style(mcp): tighten the metric index note --- src/lib/mcp/rich-reads.ts | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/lib/mcp/rich-reads.ts b/src/lib/mcp/rich-reads.ts index a7b8cb000..391afdd26 100644 --- a/src/lib/mcp/rich-reads.ts +++ b/src/lib/mcp/rich-reads.ts @@ -551,21 +551,13 @@ export async function metricStatusDiscoveryRows(userId: string): Promise< // // Every OTHER measurement type is still entered, value-less, because // ambiguity has to be judged over the whole label space rather than over the -// exposed slice of it. French and Italian once called body fat and fat mass -// by one phrase ("masse grasse" / "massa grassa") while only one of the two -// was exposed, so an index that knew about the exposed one alone would have -// seen no collision and answered kilograms to someone who asked for a -// percentage. Those labels are distinct now; the whole-space check stays so a -// future bundle cannot reintroduce the trap unseen. -// -// The alias tables stay as they are and stay English: `resting_hr`, `spo2`, -// `vo2max` are protocol slugs, not translations of anything. -let localisedMetricIndexCache: - ReturnType | undefined; -/** Built on first use, not at module load: it reads every shipped catalog. */ -function localisedMetricIndex(): ReturnType { - return (localisedMetricIndexCache ??= buildLocalisedMetricIndex()); -} +// exposed slice of it: French and Italian once named body fat and fat mass +// alike while only one was exposed, which answered kilograms to a question +// about a percentage. The alias tables stay English (`resting_hr`, `spo2` +// are protocol slugs). Built on first use: the index reads every catalog. +let metricIndex: ReturnType | undefined; +const localisedMetricIndex = () => + (metricIndex ??= buildLocalisedMetricIndex()); function buildLocalisedMetricIndex() { const exposed = new Map(); const claim = (metric: RichMetric | null) => {