Skip to content

fix(i18n): name every measurement source instead of showing its enum - #889

Merged
MBombeck merged 3 commits into
mainfrom
fix/source-priority-labels
Sep 2, 2026
Merged

fix(i18n): name every measurement source instead of showing its enum#889
MBombeck merged 3 commits into
mainfrom
fix/source-priority-labels

Conversation

@MBombeck

@MBombeck MBombeck commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Settings, Sources listed four of the ranked sources by their internal name: a reader saw GOOGLE_HEALTH, OURA, POLAR and STRAVA where the others said Withings, Fitbit, Apple Health. Noticed while capturing screenshots for the documentation.

The cause is a label catalogue that was written when there were seven sources and never grew. There are fourteen. Seven had no label at all; the screenshot only showed four of them because Nightscout, Telegram and the connector do not appear in the default ladders. The same gap sat in a second catalogue used by the measurement list and its source filter, and a third enum had one hole, so a dose synced from Apple Health read "via APPLE_HEALTH" in the intake history.

The class is closed, not the four strings. All three catalogues move into one module keyed by the enum type, so an omission is now a type error rather than a string that falls through to the raw value at runtime. A test derives the member list from the schema enum and fails naming any member without a label; it reported seven, seven and one against the current tree, and both of its arms were mutation-checked. A private workaround map that had grown in the sleep discrepancy tooltip is gone, since it now reads the shared catalogue.

Labels added to all seven locales, with the brand spellings, which are the same in every language.

Gate: typecheck, lint, format, full unit suite.

Settings, Sources listed GOOGLE_HEALTH, OURA, POLAR and STRAVA by their
internal name: the catalogue was written for seven sources and every
provider added since fell through to the raw value. The measurement list
carried the same fall-through in its source filter and its table column,
and the medication intake history read "via APPLE_HEALTH" for a dose
synced from Apple Health.

The three catalogues move into one module keyed by the enum, so an
omission is a type error rather than a raw value on screen, and the sleep
discrepancy tooltip drops the private brand-name map it had grown to work
around the gap.
The four raw values in the sources ladder shipped because nothing checks
the catalogues against the enum they render. The new guard reads
MeasurementSource and IntakeSource out of prisma/schema.prisma, not out
of a copy, and fails naming every member no catalogue labels; it also
asserts the key each entry names resolves in all seven bundles, since a
key that resolves nowhere renders no better than the enum value. Run red
against the tree before the labels landed, it reported seven unlabelled
measurement sources per catalogue and one unlabelled intake source.

The schema reader now carries each enum's declared members so the guard
can read them.
@MBombeck
MBombeck merged commit 71a6dd0 into main Sep 2, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant