Repository navigation
fix(scores): one health score on the start page, last night by one rule - #1579
Merged
Merged
Conversation
resolveServerLocale now reads the ambient request headers, lets a Bearer request's Accept-Language outrank the cookie and the stored language, and falls back to the operator default before English. The nutrient catalogue, ingredient labels and mood insights resolve through it instead of the stored language alone.
…r its rollups The dashboard snapshot holds its second phase, and the health score with it, back while the rollup tier does not cover blood pressure, weight or steps. /api/analytics computes the score without that gate. An account whose history reached the table without the write hooks (seeded, restored, imported directly) keeps readings older than the 90 days the read path folds, so its coverage only closed at the next boot: the start page, the digest and the morning said "not enough data" while Insights showed a number for the same day. computeAndRecordUserHealthScore now keeps each report in a per-day cell under the account's analytics prefix. A held-back snapshot serves that report and asks for the account's full fold, coalesced on the boot key and throttled per process, so the phase converges without a restart. Also pins that the snapshot's pillar rows follow the app's language on a token request.
The morning decides whether last night is in by the night of the sleep score (resolveLastNight); the digest still used a rolling 24 hours since the newest sleep row. A night that ended 23 hours ago counted as last night in the digest, which settled the day and dropped sleepPending while the morning beside it still waited for tonight's sleep. Both loaders now read last night through lastNightFromSnapshot in a neutral module. The digest takes the sleep score from the morning's own day cell when the morning has been read, without computing one, and falls back to the latest sleep row's wake day as the morning does. The builder's phase, sleepPending and overview sleep line follow the result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes for the 1.50 freeze.
Health score on
/said "not enough data" while/api/analyticsshowed a number. The dashboard snapshot holds its second phase (and the score with it) back while the rollup tier does not cover blood pressure, weight or steps;/api/analyticscomputes without that gate. An account whose history was written straight to the table (seed, restore, direct import) keeps readings older than the 90 days the read path folds, so coverage never closed before the next boot.computeAndRecordUserHealthScorenow keeps its report in a per-day cell under the account's analytics prefix; a held-back snapshot serves it and requests the account's full fold (coalesced on the boot key, throttled per process). Snapshot, digest and morning all read the snapshot's score, so they now match analytics. Integration testdashboard-health-score-parityfails on the old code (snapshot scoreundefinedvs analytics 95; fold never closes coverage).Digest reads last night by the morning's rule.
sleepPendingand the phase used a rolling 24 h window; they now go throughresolveLastNightvia a sharedlastNightFromSnapshot(neutral module, so the digest still never imports the morning loader). The sleep score comes from the morning's day cell when present, without new reads.Snapshot pillar labels in the app's language. Brings main's resolver change (Bearer
Accept-Languagefirst, operator default before English) to the release branch as an identical cherry-pick, and pins the snapshot's pillar names and reasons on a token request in an integration test. Labels reuse the existinginsights.healthScore.pillar.*keys (all ten locales), so there is no client growth.No wire shape change. Query budgets unchanged (
query-budget-hot-routesgreen).