The rest timer alerts at zero with a scheduled local notification #106
All Vouch review confidence checks passed
Residual risk 0.40 = Change Risk (0.52) × (1 − Review Confidence (0.24)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 40% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #106"
general
weight: 0.35
chatgpt-codex-connector[bot]
Summary
Read this first: the goal is met only in part on Android, and the rest is your call. With the package and the one permission you accepted, the alert comes two seconds after zero when the app is open or he left it less than about a minute ago. When the phone has been locked for longer than that, which is the ordinary case for a rest of two or three minutes, the alert came 41 to 45 seconds late on the emulator (Android 16). An alert on time there needs an exact alarm, and that needs a second Android permission with Play policy attached. I did not add one. See "Your call", item 1.
What it does: when a rest timer reaches zero, the phone shows a notification that says only "Rest is over", also when the phone is locked or he is in another app. Your decision of 2026-11-28; this pull request is the proposal of the package:
flutter_local_notifications22.3.3.RestAlertsinmobile/lib/src/alerts/. One adapter imports the package. The web and desktop get a capability that reports "not supported". A test fails if any other file imports the package.RestAlertKeeperreads the running rests from the store (rest_ends_at_utc_ms, the instant the timer on the page counts down to) and makes the phone hold exactly one alert for each. The store and the phone are its only record: every run compares the two, and leaves alone an alert the phone already holds for the same end. It runs after every rest timer button, after Finish, at app start and on resume.Skill used:
flutter-vertical-slice. I (Claude) wrote this functional Flutter change and may not be its independent reviewer.Your call
1. Android: an exact-alarm permission, yes or no, and which.
What was measured (emulator
FS_S1_Restart_API_36, Android 16, 2026-11-28; app sent to the background and the screen locked straight after Start):| Case | Rest | After zero |
|---|---|---|
| This build, app open | 60 s | 2.2 s |
| This build, background and locked, process still running | 60 s | 2.1 s |
| This build, background and locked, a rest of three minutes: Android froze the app's process 67 s after he left it | 180 s | 41.2 s |
| This build, process killed | 60 s | 44.9 s |
| A build with
SCHEDULE_EXACT_ALARMdeclared, not granted, process killed | 60 s | 43.1 s || The same build, permission granted through
adb, process killed | 60 s | 0.6 s |Without an exact-alarm permission Android gives the app an inexact alarm. Its documentation promises only that such an alarm "never goes off before the supplied trigger time" and that "the system invokes the alarm within one hour of the supplied trigger time". The window Android actually set was three quarters of the time left (132 s for the rest of three minutes). So 41 to 45 seconds is what I saw, not a limit. I found no way to an alert within a few seconds of zero with a locked phone that does not use an exact alarm.
The two permissions, in Android's and Google Play's own words:
SCHEDULE_EXACT_ALARM. Android's reference: "All apps using exact alarms for secondary features (which should still be user facing) should continue using this permission." On Android 14 and later it is "no longer being pre-granted to most newly installed apps targeting Android 13 and higher (will be set to denied by default)". He grants it under Settings > Apps > Special app access > Alarms & reminders. "Both the user and the system can revoke the SCHEDULE_EXACT_ALARM permission." Cost: a second permission, and a trip into the phone's settings that the app has to send him on; the fifth row above shows it does nothing until he does. A screen that sends him there is not built. I know of no Play declaration form for this one, and did not find one.USE_EXACT_ALARM. Android's reference: "Allows apps to use exact alarms just like with SCHEDULE_EXACT_ALARM but without needing to request this permission from the user." "This is only intended for use by apps that rely on exact alarms for their core functionality. You should continue using SCHEDULE_EXACT_ALARM if your app needs exact alarms for a secondary feature that users may or may not use within your app." "app stores may enforce policies to audit and review the use of this permission. Such audits may involve removal from the app store". Google Play's policy: "apps must only declare this permission if their core functionality supports the need for an exact alarm"; "Apps that request this restricted permission are subject to review", and "those that do not meet the acceptable use case criteria will be disallowed from publishing on Google Play". The acceptable cases it lists: "The app is an alarm or timer app." and "The app is a calendar app that shows event notifications." Also: "Don't use this permission for non-critical features that do not directly contribute to the app's main purpose." Cost: nothing for him, it is granted at install and he cannot revoke it. The risk is Play's review: the policy does not say what a "timer app" is, and says nothing about an app that contains a timer.What the choice changes in the code: one line in
AndroidManifest.xml. The adapter already asks the phone whether exact alarms are allowed and uses one when they are. ForSCHEDULE_EXACT_ALARMthere is also the screen that sends him to the settings page.Sources: developer.android.com (
Manifest.permission, "Schedule exact alarms", "Behavior changes: Android 14") and Google Play's policy page for the exact alarm permission (support.google.com/googleplay/android-developer/answer/9888170), read 2026-11-28. A third route, a foreground service that keeps the app awake during a rest, is not in Android's alarm documentation as an alternative; it would need its own permission and a notification that stays up, and I did not build or measure it.2. Should logging a set start or end a rest? Today, and in the prototype, it does neither: a rest starts with its Start button. Your goal sentence reads "He logs a set and the rest timer starts", and your list of ways a rest ends includes "logs the next set". I did not change what starts or ends a rest: that is a product rule and not in the contract. A test pins today's behavior (logging a set changes neither timer nor alert). If logging should start or end a rest, the keeper needs no change: it follows the store.
3. Two dependency lines, not one.
timezone: 0.11.2is a second direct dependency. The package already brings it in at that version; it is named because the scheduling call takes a date of its type and the adapter has to import it. Nothing else imports it.4. Two permissions in the built app, not one. The plugin's own manifest adds
VIBRATEbesidePOST_NOTIFICATIONS.VIBRATEis granted at install with no prompt. It can be removed with a manifest line; I have not tested what that does to the alert's vibration.5. The package version: 22.3.3, not the newest (23.0.4). 23.0.4 needs Android SDK platform 37 and a newer Android Gradle plugin than this workstation has, and I was told to install nothing. 22.3.3 lacks two later fixes: scheduling on an iPhone set to a calendar other than the Gregorian one (23.0.3 and 23.0.4), and a deprecated Android alarm call (23.0.2). The second does not show on Android 16 here. The first is untested and could matter to a man whose iPhone uses another calendar.
6. Should ADR-0005 name the package? My recommendation: no. ADR-0005 decides the client stack (state, navigation, local data). This package sits behind a capability interface and can be replaced by changing one file.
docs/knowledge/FLUTTER-PLATFORMS.mdnow has its row, with what was and was not run. If you want it in an ADR, it is one line.7. The contract. The behavior is in FNS-004 as a section marked proposed, added after your approval of 2026-11-22. It is yours to approve.
Choices I made without you
1. No exact-alarm permission (item 1 above). The adapter uses an exact alarm only where the phone already allows one.
2. What starts and ends a rest is unchanged (item 2).
3. While the app's process runs it does not wait for the phone: two seconds after the stored end the keeper has the alert shown if it is still waiting. Same stored instant, read again; no second clock. The notification is marked "alert only once" and a waiting alert is cancelled before one is shown, so a late alarm does not sound a second time.
4. An alert more than a minute late is not given by the app. If he opens the app and finds a rest over with its alert still waiting, the app gives it if the rest ended less than a minute ago, and otherwise takes it back unseen. The one-minute limit is mine.
5. No screen of the app's own before the phone's prompt. "Asked" is stored before the prompt is shown, so a crash during the prompt does not lead to a second one. A rest timer change that failed to save asks nothing.
6. The quiet line: one place, existing notice style, no new widget, token or text style. It shows only when he was asked and alerts are not allowed. It also shows if he later turns notifications off in the phone's settings, and goes when he turns them on.
7. "The session is closed" read as: the workout is finished. Finish cancels every alert of that workout, waiting or shown.
8. A shown alert of a rest that ran out stays on the phone until he clears it, starts that rest again, resets it or finishes.
9. One alert per resting exercise (each exercise has its own timer). The alert's number is a 31-bit hash of the exercise id.
10. The alert's moment is rounded up to a whole second, never down: the package drops fractions of a second.
11. Android: channel "Rest timer" ("An alert when a rest is over."), importance high, shown on the lock screen (it has no private content), the launcher icon as its icon. iOS: alert and sound asked for, no badge.
12. No boot receiver and no
RECEIVE_BOOT_COMPLETED: a rest lasts ten minutes at most, and the app puts its alerts right when it is next opened.13. The web gets no alert through a conditional import. Flutter still registers the package's own web part, as for every plugin with one, and the package's 3 KB script file ships among the assets of every build. The app never initializes the package on the web.
14. Under a test clock the alarm is set in real time (
restAlertClockAheadProvider); in the app as the phone starts it the difference is zero.15. The device test needs a hand from outside the app (the prompt, Home, the lock). It can take another rest length through a compile-time value, used once to measure three minutes.
16. To measure, I built two throwaway variants with
SCHEDULE_EXACT_ALARMin the manifest. That line is not in this branch.17. The emulator's lock screen was switched off (
locksettings get-disabled= true). For the alert runs I switched it on and set it back afterwards. It reads true again.18. Board row: moved to "Now" with the state Decision needed, because of item 1.
19. I added the new files to two systems in the Architecture Explorer's
model.json.20. After the first review: the keeper remembers, while it runs, which stored end it set each waiting alert for, and does not set it again. The store and the phone remain the only record across a relaunch.
21. The workstation slept twice: from about 04:50 to 14:20, and from about 14:45 to 19:45. My request to start your keep-awake helper was refused by the permission system at the start of the night, and I did not work around it. The emulator did not survive the wake. I started
FS_S1_Restart_API_36again, cold and without a window, removed the app a half-finished run had left on it, and set its lock-screen setting back. So this pull request was opened in the evening of 2026-11-28, not in the morning.22. The second review's findings are listed and not fixed, as you set.
Scope
Docs are part of done
docs/knowledge/WORK.md, thenwork_board.py --write(WORK-BOARD-VIEW.md,docs/HOME.md)docs/knowledge/PROTOTYPE-PARITY.md: the Workout row's last sentencedocs/features/workout-logging/feature.md: the proposed section, the sentences that said the timer makes no sound, test and implementation pathsdocs/design/DESIGN-SYSTEM.md: n/a, no color, type, spacing or shared widget changeddocs/architecture/SYSTEM.md: the permission, the capability boundary, the host files. No new ADR. AlsoFLUTTER-PLATFORMS.md(the package's row),CODE-MAP.mdand the explorer model by their generators,mobile/README.md("The rest alert test")python tooling/knowledge/live_status.py --pullafter opening this pull requestChanged files
mobile/pubspec.yaml,mobile/pubspec.lock(addsflutter_local_notifications22.3.3 with its_linux8.0.2,_platform_interface12.2.0,_web1.0.0,_windows3.1.1, andtimezone0.11.2,dbus0.8.1,petitparser7.1.0,xml7.1.0; no existing entry changed).-
mobile/android/app/src/main/AndroidManifest.xml: the plugin'sScheduledNotificationReceiver, not exported. Without it a scheduled alert is never shown. No permission line.-
mobile/android/app/build.gradle.kts: core library desugaring (desugar_jdk_libs2.1.4), which the plugin's build requires.-
mobile/ios/Runner/AppDelegate.swift: the app becomes the notification center's delegate, which the plugin needs to show an alert while the app is open. Not compiled or run here.mobile/lib/src/alerts/rest_alerts.dart,local_notification_rest_alerts.dart,open_rest_alerts.dart,open_rest_alerts_native.dart,open_rest_alerts_web.dart.mobile/lib/src/features/workout/application/rest_alert_keeper.dart.workout_repository.dart,drift_workout_repository.dart,memory_workout_repository.dart(restEnds, a read);settings_repository.dart(asked once).workout_view_model.dart,workout_page.dart(the one line),forged_sent_app.dart(start and resume),main.dart.mobile/test/features/workout/rest_alert_keeper_test.dart,rest_alert_test.dart,workout_repository_contract.dart;mobile/test/features/settings/settings_repository_test.dart;mobile/test/alerts/local_notification_rest_alerts_test.dart,rest_alerts_import_test.dart;mobile/test/support/fs_test_support.dart;mobile/integration_test/rest_alert_test.dart.docs/features/workout-logging/feature.md,docs/knowledge/WORK.md,WORK-BOARD-VIEW.md,docs/HOME.md,FLUTTER-PLATFORMS.md,PROTOTYPE-PARITY.md,docs/architecture/SYSTEM.md,CODE-MAP.md,explorer/model.json,mobile/README.md.No golden image changed.
The package's stated support: Android from API 24 (this app's minimum); iOS from 13.0 (this app: 15.0); a web part exists and is not used. Its page warns that some Android makers' battery managers (it names Xiaomi and Huawei) can keep scheduled notifications from showing, and that iOS keeps at most 64 pending notifications per app. Nothing this feature relies on is listed as unsupported on Android or iOS.
Acceptance
| # | What | Where it is tested |
|---|---|---|
| 1 | Starting a rest schedules exactly one alert for the stored end time |
rest_alert_keeper_test.dart,rest_alert_test.dart, adapter test (the instant, in UTC, at the method channel) || 2 | Each way a rest ends early cancels it | the same two files: Pause, Reset, Finish, a new start; 15 seconds more or less moves it |
| 3 | Refused: nothing scheduled, timer runs, not asked again | the same two files, also after a relaunch; settings store test (asked survives close and reopen) |
| 4 | Kill and relaunch during a rest: one alert, right time | the same two files: alert kept, lost, already shown, cleared |
| 5 | On the emulator, from the system's own record | below |
| 6 | The existing device tests still pass | below |
Verification (required)
Two commits:
008c1b2(the change) and35dacd8(the fixes after the first review). All on Windows, Flutter 3.47.8 (the pinned version; local build737ba8f885), on35dacd8, 2026-11-28.| Command | Result |
|---|---|
|
flutter pub get, twice;git diff --exit-code -- pubspec.lockafter the second | exit 0, lock unchanged ||
dart format --output=none --set-exit-if-changed lib test integration_test| 162 files, 0 changed ||
flutter analyze --no-pub| No issues found ||
flutter test --no-pub| 836 passed (733 before this change). The pre-push hook ranflutter analyzeandflutter testagain: 836 passed ||
flutter build apk --debug| built ||
flutter build web --release --no-pub, with a temporary web host made as CI makes it, removed afterwards | built, on008c1b2; not repeated on35dacd8, which changed no file the web build compiles differently (the keeper and tests) ||
python tooling/knowledge/check.py| valid ||
python tooling/knowledge/work_board.py --write,python tooling/architecture/generate.py --check,python tooling/architecture/build_explorer.py --check| current ||
python tooling/policy/check.py| passed ||
python -m unittest discoverfortooling/policy,knowledge,prototype,skills,architecture,review,preview,onboarding;embed_seed.py --check;skills/sync.py --check| all OK ||
python tooling/review/review.py --dry-run --base origin/main --reviewers codex --minimum 1| reviewable, 2 slices |Review
python tooling/review/review.py --author claude --reviewers codex --minimum 1(codex-cli 0.171.0; the tool does not record the model). Two rounds, as you set. Both ended NOT_VERIFIED, and the second still has findings. I stopped there: no third round, and no code changed after the second review. These reviews are advisory and are not an approval.Round 1, on
008c1b2. Slice 1 of 2: CHANGES_REQUIRED, 1 High and 3 Medium. Slice 2 of 2: PASS, with 1 Medium. The four Medium findings were addressed in35dacd8:Round 2, on
35dacd8. Slice 1 of 2: CHANGES_REQUIRED. Slice 2 of 2: PASS. Open findings, all of them, none addressed:1. High,
local_notification_rest_alerts.dart:136. The same as in round 1: without an exact alarm, a frozen or killed app has only the inexact alarm, and the alert came 41.2 and 44.9 seconds late. "Resolve the Android exact-alarm policy decision before treating locked-screen delivery at zero as implemented." I agree. It is item 1 under "Your call", and the board row says Decision needed.2. Medium,
rest_alert_keeper.dart:236. After a relaunch the keeper's memory is empty, so it sets each waiting alert once more even when the phone still holds the right alarm; if that one call fails, or the app dies between the cancel and the set, the alarm is lost until the app is next opened. Suggested: carry the stored end in the pending alert so a fresh keeper can recognise it. I agree it is real. The fix is small and I did not make it.3. Medium,
rest_alert_keeper.dart:258. The phone's alarm can still go off after the keeper has read what is shown and before it shows the alert itself; the adapter then removes the shown alert and posts it again, and he could hear it twice. The round 1 fix narrowed this and did not close it. I agree. Closing it needs a way to cancel only the waiting alarm, which this version of the package does not offer for one alert.4. Low,
integration_test/rest_alert_test.dart:167. The device test can pass without anyone leaving the app or locking the phone; the proof of background delivery is the system's record, collected from outside. True, andmobile/README.mdsays so.5. Medium,
rest_alert_keeper_test.dart:610. The test named "one alert the phone will not take does not stop the others" has only one rest while the phone refuses, so it does not prove its name. I agree. The code does carry on (each alert is set in its own try), and no test proves it.6. Low,
rest_alert_test.dart:422. A relaunch test says the lost alert is set "once" and checks only the final state. I agree. The keeper test with the reopened database file does check the exact calls.The reviewer also noted, both times, that it could not reproduce the emulator timings and that nothing was verified on iOS.
UI / device evidence (if applicable)
Emulator
FS_S1_Restart_API_36(emulator-5554, Android 16, API 36), already running when I started.The device runs below were made during the night on the first commit,
008c1b2.35dacd8changed the keeper after the first review. A first attempt to repeat them on35dacd8is void: after the workstation slept, a device job I had stopped came back to life and ran beside the new one on the same emulator, and every run of both failed for that reason. One clean repeat is running now. Until this paragraph is replaced with its result, device behavior on35dacd8is NOT VERIFIED.Acceptance 5.
flutter test integration_test/rest_alert_test.dart -d emulator-5554, with a script in a second terminal that tapped Allow on the phone's prompt ("Allow Forged & Sent to send you notifications?"), pressed Home and the power button. The test passed (04:01 +1: All tests passed!). The rest ended at 04:14:11.920.Posted 2.1 seconds after the rest ended, by the app's own process, which was still running. One record. The test then came back to the app, saw Reset clear the alert, ran a second rest with the app open (ended 04:16:55.255, posted 04:16:57.501), and saw Pause take a waiting alert back.
The same with the process killed (the test built as an app, started from the launcher,
adb shell am killafter the lock; only the phone's alarm is left). The rest ended at 04:09:34.172.One alert, posted by a new process that Android started for the alarm, 44.9 seconds after zero.
A rest of three minutes, process left alone. The rest ended at 04:06:00.598.
41.2 seconds after zero. He left the app at 04:03:10; Android froze its process 67 seconds later, so the app's own wake-up did not run.
Acceptance 6. After the alert runs, on the same emulator, each set starting with the app not installed, all on 2026-11-28 between 04:17 and 04:28:
| Command (
flutter test … -d emulator-5554) | Result ||---|---|
|
integration_test/restart_1_complete_test.dart --no-uninstall| All tests passed ||
integration_test/restart_2_verify_test.dart| All tests passed ||
integration_test/journal_restart_1_write_test.dart --no-uninstall| All tests passed ||
integration_test/journal_restart_2_verify_test.dart| All tests passed ||
integration_test/journal_edit_restart_1_change_test.dart --no-uninstall| All tests passed ||
integration_test/journal_edit_restart_2_delete_test.dart --no-uninstall| All tests passed ||
integration_test/journal_edit_restart_3_gone_test.dart| All tests passed ||
integration_test/workout_restart_1_start_test.dart --no-uninstall| All tests passed ||
integration_test/workout_restart_2_finish_test.dart| All tests passed ||
integration_test/workout_sets_restart_1_add_test.dart --no-uninstall| All tests passed ||
integration_test/workout_sets_restart_2_verify_test.dart| All tests passed ||
integration_test/workout_superset_test.dart| All tests passed |The emulator had been up for four hours. At the end: app not installed, device date 2026-11-28 04:28:18 MST.
NOT VERIFIED
AppDelegate.swiftwas changed and never compiled here. The two iOSPackage.resolvedfiles were not checked (this workstation cannot run iOS); the plugin's Swift package names no remote package, so I expect no change, and that is an expectation. CI'sios-simulatorjob proves only that the app builds.am killand still posts one alert"; what happens after the phone restarts. These are host tests only.Security and review
Potential data exposure. The notification can be read on the lock screen. Its text is the fixed string "Rest is over"; its number is a hash of an exercise id. No exercise name, weight, reps, body or journal data is in it, and the capability has no parameter that could carry any. Nothing is sent off the device and nothing is logged. The channel's name and description ("Rest timer", "An alert when a rest is over.") show in the phone's settings.
Unresolved decisions: the seven items under "Your call".
Solo-maintainer policy:
ci-gateis required; another human or AI approval is not required. AI agents must not self-merge. The final merge decision stays with the maintainer.🤖 Generated with Claude Code