screen-locker/scripts
Krzysztof kuhy Rudnicki b6e89b93dc
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / lock-popup-safety (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
workout_app: run the break countdown in a foreground service with notifications
The between-set break never finished once the phone's screen was off. Three
independent causes (worked through on-device on 2026-09-12; left
uncommitted awaiting the go-ahead, committed here as-is plus one pin bump):

1. The countdown was not wall-clock: `_breakRemaining--` on a
   Timer.periodic, which Android throttles and Doze suspends in a
   backgrounded isolate, so the counter stalled and _onBreakFinished()
   never fired. Now a BreakClock deadline on the wall clock.
2. An expired break was silently dropped on restore (`if (remaining > 0)`
   only) — now cued and logged.
3. No notification infrastructure at all: no package, no
   POST_NOTIFICATIONS / FOREGROUND_SERVICE / WAKE_LOCK.

Now: flutter_foreground_task runs the countdown in a service isolate that
survives BACK and the screen lock; flutter_local_notifications shows an
ongoing "Workout A · break m:ss / Next: …" notification with −1 rep / Done
actions and a "Break over" alert on its own channel (raw break_end sound,
vibration). Button presses go through a persisted BreakIntent queue the
screen drains on resume, so a press with the app killed is not lost.
Finish and Reset stop the service; a startup reaper handles the crash case.

Verified on the phone with the screen off and locked: service alive and
ticking while Dozing, both notifications on the lock screen, channel
importance 5 with the break_end sound. Not verifiable from adb (receiver is
RECEIVER_NOT_EXPORTED): an actual action-button tap, and a true recents
swipe — see stronglift_replacement/TODO-workout-app-v2.md.

Also fixed en route: the break-end sound had never played in any widget
test (AssetSource needs path_provider, which nothing faked, and the failure
was swallowed by catchError); the queue's prune wrote back a stale list.

This commit additionally:
- takes the freshness gate's bump flutter_local_notifications 22.3.1;
- restores web/package.json to HEAD (the tree held a stale pre-bump copy);
- gives scripts/check_flutter_coverage.sh a FLUTTER_TEST_CONCURRENCY knob:
  the default one-isolate-per-core run peaks over 4 GiB and is OOM-killed
  under the resource cap. Default behaviour unchanged.

Gate: flutter analyze clean, 511 tests, 3187/3187 lines (100%), pre-commit
green. Not re-installed on the phone for the 22.3.1 pin: no device attached
at commit time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7vgacLhb4WJjxuVj2QLEP
2026-09-13 20:28:36 +02:00
..
__init__.py Finish the Python side: scripts, conftest, and the last test modules 2026-08-15 20:57:29 +02:00
_popup_form_check.py Take gatelock 0.8.1: nested LockConfig 2026-09-12 19:52:38 +02:00
_xvfb_reexec.py Finish the Python side: scripts, conftest, and the last test modules 2026-08-15 20:57:29 +02:00
add_scheduled_skip.py Re-point paths for the ~ reorganisation (home-tidy) 2026-09-11 18:46:28 +02:00
annotate_duplicate_credits.py Replay today's earned shutdown credit in the daily base reset 2026-09-13 20:00:05 +02:00
check_dependency_freshness.sh Re-point paths for the ~ reorganisation (home-tidy) 2026-09-11 18:46:28 +02:00
check_enforcement_armed.py Serve the lock decision, its history and its health at 127.0.0.1:8770 2026-08-29 22:50:19 +02:00
check_file_length.py Enforce the 250-line cap for real, and on Dart 2026-08-15 22:42:57 +02:00
check_flutter_coverage.sh workout_app: run the break countdown in a foreground service with notifications 2026-09-13 20:28:36 +02:00
check_md_naming.sh Re-point paths for the ~ reorganisation (home-tidy) 2026-09-11 18:46:28 +02:00
check_no_crdt_sync_override.sh Re-point paths for the ~ reorganisation (home-tidy) 2026-09-11 18:46:28 +02:00
check_requirements_sync.py Add CI-mirror pre-push gate + requirements-sync check 2026-07-11 17:42:45 +02:00
check_silent_failures_dart.py Split storage_service.dart (781) into part extensions 2026-08-15 21:12:08 +02:00
check_silent_failures.py Re-arm the locker, and make a disarmed enforcer impossible to miss 2026-08-17 16:47:25 +02:00
ci_mirror.sh Add CI-mirror pre-push gate + requirements-sync check 2026-07-11 17:42:45 +02:00
demo_workout_handoff.py Take gatelock 0.8.1: nested LockConfig 2026-09-12 19:52:38 +02:00
disarm_guard.sh Make disarming survive the install scripts, not just systemd 2026-08-22 12:54:13 +02:00
finish_2026_08_24.sh Tell "could not check" apart from "no workout", and stop double-granting bonuses 2026-08-24 13:07:20 +02:00
fix_2026_07_26_sport.py Grade against 3.14 too, not just run on it 2026-08-29 11:42:47 +02:00
migrate_scheduled_skips.py Replace scheduled skips with the shared free-day pool 2026-09-07 15:42:41 +02:00
refresh_refactor_todo.py Re-point paths for the ~ reorganisation (home-tidy) 2026-09-11 19:07:30 +02:00
rekey_log_entry.py Key every workout day on the LOCAL calendar day, not UTC 2026-09-13 09:50:06 +02:00
restore_and_bonus.py Make the recovery scripts say why they failed, not just print it 2026-08-24 13:10:53 +02:00
revoke_sick_day.py Grade against 3.14 too, not just run on it 2026-08-29 11:42:47 +02:00
setup_mcp.sh Add read-only MCP server exposing workout/lock status 2026-07-10 21:28:09 +02:00
split_dart_test.py Add todo_finish_dart_250_prompt.md and the Dart test splitter 2026-08-15 21:49:15 +02:00
tombstone_sync_record.py Tombstone sync records durably: a ledger the PC re-pushes every tick 2026-09-13 20:20:06 +02:00
verify_lock_popup_safety.py Finish the Python side: scripts, conftest, and the last test modules 2026-08-15 20:57:29 +02:00
verify_screen_fits.py Re-point paths for the ~ reorganisation (home-tidy) 2026-09-11 18:46:28 +02:00
verify_workout_credited.py Make the recovery scripts say why they failed, not just print it 2026-08-24 13:10:53 +02:00