fix(illness,sleep): document the sleep average DTO and gate the recovery driver

Add averagePerNight to the SleepRhythmResource OpenAPI schema so the new
average-per-night card's field is part of the iOS-consumed contract (the
endpoint already returned it; the Zod source had not been updated, so the
in-sync check could not catch the omission).

Tag each vital return with whether it deviated in the illness-adverse
direction and tally only adverse returns when naming the recovery driver,
so a neutral move (e.g. weight drift) can no longer be surfaced as the
vital someone recovered ahead of.
This commit is contained in:
Marc-André Bombeck committed 2026-06-21 14:23:24 +02:00
1 parent b9f396c72a
commit e2ce064254
5 files changed
+116 -6

No files matched your search

+29
View File
@@ -11860,9 +11860,38 @@ components:
- workNightsCounted
- freeNightsUntilReady
additionalProperties: false
averagePerNight:
type: object
properties:
state:
type: string
enum:
- partial
- ready
averageMinutes:
type: integer
minimum: 0
maximum: 9007199254740991
description: Mean asleep minutes per scorable night (0 while partial).
nightsCounted:
type: integer
minimum: 0
maximum: 9007199254740991
nightsUntilReady:
type: integer
minimum: 0
maximum: 9007199254740991
description: Scorable nights still needed before the average is asserted.
required:
- state
- averageMinutes
- nightsCounted
- nightsUntilReady
additionalProperties: false
required:
- sleepDebt
- chronotype
- averagePerNight
additionalProperties: false
description: "Server-authoritative sleep-rhythm read: cumulative sleep debt over the rolling window + MCTQ chronotype
(MSF/MSFsc band, social jetlag). Free vs work nights default to weekend = free in the user's timezone (no work