Skip to content

v1.37.24 — stop waiting for sleep that never comes - #801

Merged
MBombeck merged 3 commits into
mainfrom
release/v1.37.24
Aug 16, 2026
Merged

v1.37.24 — stop waiting for sleep that never comes#801
MBombeck merged 3 commits into
mainfrom
release/v1.37.24

Conversation

@MBombeck

Copy link
Copy Markdown
Owner

The hero card on the start page told anyone without a sleep source, every morning, that last night's sleep was not in yet. The freshness rule asked only whether last night had landed, and sleepLastSeenDaysAgo is null when sleep has never been recorded, so a record with no tracker read as permanently waiting. Not everyone owns one, and people put them away.

Waiting now requires that sleep actually reaches the record: a night within the last seven days. A flat battery or a few nights without the device keeps the note, because tonight's sleep really is still expected. A week of silence retires it.

The same rule settles the day itself. It used to park on provisional forever for those records, and the daily push line reads the same field, so the notification carried the identical untrue aside.

Two existing tests pinned the old behaviour by name ("is provisional when sleep has never been recorded", "stays provisional when sleep never arrives"). They described the defect rather than a contract worth keeping, so they assert the opposite now, and a third covers the boundary between an ordinary gap (7 days, still waiting) and a source that has gone quiet (8 days, settled). Reverting isSleepExpected to the old always-true behaviour turns all three red.

Gate: typecheck, lint, format:check, 1885 test files / 21446 tests, and next build all green locally.

The hero card on the start page told anyone without a sleep source, every
morning, that last night's sleep was not in yet. The freshness rule only
asked whether last night's sleep had landed, so a record that has never had
a night in it, or whose owner has stopped wearing the tracker, read as
permanently waiting. Not everyone owns one, and people put them away.

Waiting now requires that sleep is actually reaching the record: a night
within the last seven days. A flat battery or a few nights without the
tracker keeps the note, since tonight's sleep really is still expected. A
week of silence retires it.

The same rule settles the day itself. It used to park on `provisional`
forever for those records, which the daily push line reads too, so the
notification carried the same untrue "last night's sleep is still missing"
aside.

Two existing tests pinned the old behaviour by name ("is provisional when
sleep has never been recorded", "stays provisional when sleep never
arrives"). They described the defect rather than a contract worth keeping,
so they now assert the opposite, and a third covers the boundary between an
ordinary gap and a source that has gone quiet.
The scenario purges every sleep row so last night can be the arrival that
flips the day. That left an account with no sleep source at all, which now
reads `final` on purpose, so the provisional assertion could not be reached.

Seeding a night from three days ago restores what the scenario means: a
record that does track sleep, waiting for last night's. Written through the
same ingest route as the fresh night and swept by the same purge.
@MBombeck
MBombeck merged commit e00d013 into main Aug 16, 2026
23 checks passed
@MBombeck
MBombeck deleted the release/v1.37.24 branch August 16, 2026 08:44
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