fix(personal-records): map the new derived metric types to a null PR direction

ANS charge, cardio load, the sleep score, and the body-temperature
deviation reached the MeasurementType enum without a branch in
getPRDirection, which left the exhaustive switch non-total — typecheck
fell through to an implicit undefined return and the drift guard failed.

These are derived / homeostatic composites with no goal axis, so they
join the other scores and temperature metrics on the null PR direction.
This commit is contained in:
Marc-André Bombeck committed 2026-06-15 00:21:42 +02:00
1 parent cf31211fbc
commit 347143c4b7
1 file changed
+10
+10
View File
@@ -176,6 +176,16 @@ export function getPRDirection(
// WALKING_HEART_RATE_AVERAGE case above. Defer to a null PR direction.
case "AVERAGE_HEART_RATE":
case "MAX_HEART_RATE":
// Derived / homeostatic device composites with no goal axis. ANS
// charge, cardio load, and the sleep score are recomputed daily from
// their own underlying signals (a PR on them would double-count the
// inputs' PRs), and the body-temperature deviation is a baseline-
// relative reading where neither direction is an achievement — they
// stay null like the other derived scores + temperature metrics above.
case "ANS_CHARGE":
case "CARDIO_LOAD":
case "SLEEP_SCORE":
case "BODY_TEMPERATURE_DEVIATION":
return null;
}
}