Repository navigation
fix(notify): keep the minutes of startOfDay - #427
TimeToBuildBob wants to merge 2 commits into
Conversation
Git-Session-Id: 04989cff-efe2-4235-a5a7-899fd0b1c4ba
|
What changed: 3 files, +43/-38 in Review guideKey files
Suggested verification
Auto-posted by |
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge, with the previous test-coverage finding addressed. Summary
Reviews (2) · Last reviewed commit: "test(notify): pin query and dedup to the..." · Reviewed by Greptile |
| assertEquals(ListenableWorker.Result.success(), runWorker(backend)) | ||
| val endpoints = org.json.JSONArray(backend.queriedTimeperiod!!).getString(0).split('/') | ||
| assertEquals(listOf(30, 30), endpoints.map { org.threeten.bp.OffsetDateTime.parse(it).minute }) |
There was a problem hiding this comment.
The new test checks only the minutes on the query endpoints. It would still pass if the worker selected today's date at 04:15 with startOfDay set to "04:30", or saved the fired threshold under the wrong date. Freeze the clock inside that interval and assert the full query window and saved triggered_ key. This would protect the query and duplicate-alert behavior this PR fixes.
There was a problem hiding this comment.
Fixed in 5ff88c1. The worker test now injects 2026-12-03 04:15 local time with startOfDay=04:30, asserts the complete Dec 2 04:30 → Dec 3 04:30 query window and the Dec 2 triggered_ preference, then dismisses the notification and reruns the worker to verify no duplicate alert. I independently mutated the query date and the dedup date to the calendar date; each mutation failed the corresponding assertion. All 55 NotifyWorker, LogicalDay and widget updater tests pass locally. The production time source remains ZonedDateTime.now(zone).
🤖 AI code reviewThe PR replaces Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No findings. The diff looks correct to me on this pass. Files changed (3) — the diff as I read it
Previous review passes
Reviewed Maintainer commands
|
Git-Session-Id: 62faa06d-13ed-5e7f-a04b-26b92672b1af
|
@greptileai review |
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
|
Adjudication deferred by the review-freshness check: current head is |
Item 3 of #409.
NotifyWorkerkept only the hour ofstartOfDay, so04:30became 04:00. Between 04:00 and 04:30, alerts queried the new day and used its date for notification dedup, while the widget and web UI were still on the previous day.The worker now parses a full
LocalTimeand uses one logical date for both the query and the dedup key. Legacy integer hours and the 04:00 fallback still work. It keeps its own parser because the widget's doesn't accept integer hours.A new
NotifyWorkerExecutionTestcase runs the worker with a fake backend set to04:30and checks both query endpoints. The twologicalDayDatetests are removed with that wrapper;LogicalDayTestcovers the shared helper.Tested locally on
48711405: theNotifyWorker,LogicalDayand widget updater tests (55) pass, and dropping the minutes again makes tests fail. Not run on a device.