Repository navigation
DST: doses on clock-change days were deleted and never rang - #20
Merged
Merged
Conversation
The helper's commit fixed the day loop; the time of day had the same flaw. On spring-forward day midnight + 480 minutes is 09:00, not 08:00: the dose was saved an hour late, _reconcileOrphanedDoses saw it wasn't a listed slot and deleted it with its alarm, so nothing rang that day. DoseScheduler.slot builds the time from date parts. Same fix for the Today window (ended at 23:00 on the 25-hour day) and the adherence grid (26 weeks back crosses a clock change, so older cells landed on 23:00 the day before and showed the previous day's data). CI runs the tests in Europe/Warsaw so the new DST test means something. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
What was wrong
DoseScheduler._materialiseDosesbuilt dose times by addingDurations to local midnight, and in Dart that's exact elapsed time. Across a DST change, wall-clock time is off by an hour._reconcileOrphanedDosessaw that 09:00 isn't one of the medication's slots (coversSlot), cancelled its alarm and deleted it. Every dose after 02:00 that day silently didn't ring. It happened again on every sync.start + 24h, so on the 25-hour day it ended at 23:00 and doses between 23:00 and midnight weren't listed.What changed
DoseScheduler.slot(day, minutes)builds the time from date parts (DateTime(y, m, d, 0, minutes)). The day loop usesDateTime(y, m, d + n).today_page.dartandadherence_grid.dartuse the same date-part construction instead ofadd/subtract(Duration(days: …)).test/dst_test.dart: on both 2026 clock-change days, each slot keeps its date and wall-clock minute andcoversSlotaccepts it.flutter testwithTZ=Europe/Warsaw. In UTC this test can't fail, so without it CI wouldn't catch a regression.Validation
flutter analyze: no issues.flutter test: 29 passed under bothTZ=Europe/WarsawandTZ=UTC.day.add(Duration(minutes: …))and the new test fails in Warsaw (Expected: <480>, Actual: <540>).flutter testrun after a change sometimes fails with "loading …widget_test.dart". It happens on untouchedmastertoo and passes on rerun, so it isn't from this change.Who did what
The Codex helper (gpt-6-luna) found the day-loop half (first commit). I found the time-of-day, Today and grid cases, wrote the test and the CI change, and ran everything (second commit).
🤖 Generated with Claude Code
Summary by CodeRabbit