feat(measurements): add WHOOP source, native score types, and source-priority ladders

Add the WHOOP integration data layer (migration 0111): seven new
MeasurementType values (HRV_RMSSD, DAY_STRAIN, WORKOUT_STRAIN,
SLEEP_PERFORMANCE, SLEEP_EFFICIENCY, SLEEP_CONSISTENCY, SLEEP_NEED,
ENERGY_EXPENDITURE_KJ), a WHOOP MeasurementSource, the WhoopConnection
and WhoopOAuthState models, and the per-user encrypted BYO-key columns
on User. Day-strain takes DAY_STRAIN (not the COMPUTED STRAIN_SCORE) and
RMSSD takes HRV_RMSSD (not the SDNN HEART_RATE_VARIABILITY) so a native
value never shares a bucket with a derived proxy.

Carry the new types through the completeness walls (units, value ranges,
chart tokens, PR direction, categories, list-meta colours/icons/labels,
HealthKit-mapping exclusions) and feed the cross-source picker: recovery
ladder (WHOOP native above the COMPUTED proxy), WHOOP inserted into the
overlapping vital ladders and the workout ladder, plus skinTemperature
and respiratoryRate metric keys.
This commit is contained in:
Marc-André Bombeck committed 2026-06-04 00:49:31 +02:00
1 parent 747a62516a
commit 6db3bef413
21 files changed
+649 -31

No files matched your search

@@ -258,6 +258,8 @@ describe("i18n locale file integrity", () => {
"medications.wizard.steps.step3.unit.mg",
"medications.wizard.steps.step3.unit.ml",
"medications.wizard.steps.step3.unit.g",
// v1.11.0 — "WHOOP" is a brand name, identical across every locale.
"settings.sections.sources.sourceLabels.WHOOP",
]);
it.each(ALL_LOCALES)("$locale locale has no empty values", ({ path }) => {
@@ -77,10 +77,19 @@ const EXPECTED_TYPES = [
"RECOVERY_SCORE",
"STRESS_SCORE",
"STRAIN_SCORE",
// ── v1.11.0 — WHOOP-native score classes ──
"HRV_RMSSD",
"DAY_STRAIN",
"WORKOUT_STRAIN",
"SLEEP_PERFORMANCE",
"SLEEP_EFFICIENCY",
"SLEEP_CONSISTENCY",
"SLEEP_NEED",
"ENERGY_EXPENDITURE_KJ",
] as const;
describe("measurementTypeEnum coverage", () => {
it("exposes the 53 canonical measurement types", () => {
it("exposes the 60 canonical measurement types", () => {
expect([...measurementTypeEnum.options].sort()).toEqual(
[...EXPECTED_TYPES].sort(),
);
@@ -180,6 +189,19 @@ describe("measurementTypeEnum coverage", () => {
"RECOVERY_SCORE",
"STRESS_SCORE",
"STRAIN_SCORE",
// v1.11.0 — WHOOP-native score classes. Device-derived strain / recovery
// / sleep-quality composites and a kJ energy total, not measured clinical
// vitals. They surface on their own Insights cluster with a "descriptive,
// not clinical" disclaimer and never belong in the clinical vitals PDF.
// See doctor-report-pdf-core.ts for the matching exclusion rationale.
"HRV_RMSSD",
"DAY_STRAIN",
"WORKOUT_STRAIN",
"SLEEP_PERFORMANCE",
"SLEEP_EFFICIENCY",
"SLEEP_CONSISTENCY",
"SLEEP_NEED",
"ENERGY_EXPENDITURE_KJ",
]);
it("doctor-report PDF vital types cover the canonical enum minus documented exclusions", () => {