mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-22 11:32:28 +01:00
The unlock script started morning-routine.service on every staggered trigger (05:00/05:15/05:30/06:00/07:00) on alarm days. That was a workaround for the always-on lockdown removing the hibernate/resume event the alarm used to ride on — reasonable when nothing else could fire it. Something else fires it now. wake-alarm-trigger.timer ticks every minute and starts morning-routine.service at the time the phone synced, with a catch-up window for a suspended or just-booted machine. Keeping both meant two independent triggers, one of which ignores the phone entirely. That is not hypothetical: on 2026-07-20 the phone was set to 08:00 and the alarm went off at 07:00, started here, with no wake-alarm-trigger "Firing" line in the journal at all. The 08:00 fire then landed as a no-op because this 07:00 run had left morning-routine.service still active. Drop maybe_start_morning_alarm() and both call sites, plus the config that went dead with it (ALARM_DAYS_DOW, MORNING_ROUTINE_UNIT, the alarm_started_date marker). MIN_WAKE_AFTER_LOCKDOWN_HOURS stays — the wake-floor trigger uses it. The lockdown's actual job — console/GUI restore, unmute, unmasking the login surface — is untouched. The only starters of morning-routine.service left are wake-alarm-trigger.timer (primary) and the system-sleep hook (resume backstop). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48 lines
3.3 KiB
JSON
48 lines
3.3 KiB
JSON
{
|
|
"intent": "The PC's wake alarm must fire at the time the phone synced, and only that time. night-lockdown-unlock.sh also started morning-routine.service on a fixed 05:00/05:15/05:30/06:00/07:00 ladder, so on 2026-07-20 the alarm went off at 07:00 while the phone said 08:00. Remove that second, phone-independent trigger.",
|
|
"scope": [
|
|
"linux_configuration/scripts/periodic_background/digital_wellbeing/setup_night_lockdown.sh (generator for /usr/local/bin/night-lockdown-unlock.sh)",
|
|
"Non-goal: the lockdown's own job (console/GUI restore, unmute, login-surface unmask) is untouched",
|
|
"Non-goal: wake-alarm and screen-locker repos are unchanged by this commit"
|
|
],
|
|
"changes": [
|
|
"Deleted maybe_start_morning_alarm() and both call sites from inside the UNLOCK_EOF heredoc, leaving a NOTE explaining that wake-alarm-trigger.timer now owns alarm firing.",
|
|
"Removed the config keys that went dead with it: ALARM_DAYS_DOW, MORNING_ROUTINE_UNIT, and the alarm_started_date dedup marker. MIN_WAKE_AFTER_LOCKDOWN_HOURS is kept — the wake-floor trigger still uses it."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "bash -n setup_night_lockdown.sh && shellcheck setup_night_lockdown.sh",
|
|
"result": "pass",
|
|
"evidence": "syntax OK; shellcheck reports only the pre-existing SC1091 info for the sourced lib/common.sh"
|
|
},
|
|
{
|
|
"command": "sudo bash setup_night_lockdown.sh setup",
|
|
"result": "pass",
|
|
"evidence": "All 7 'present:' checks OK, timer enabled, 'Night lockdown installed.' cmd_setup is install-only (writes config/scripts/units, daemon-reload, enable --now on the already-enabled timer and rgb-off oneshot) — it does not apply lockdown state."
|
|
},
|
|
{
|
|
"command": "grep -nE 'systemctl.*start.*morning|maybe_start_morning' /usr/local/bin/night-lockdown-unlock.sh",
|
|
"result": "pass",
|
|
"evidence": "No matches. The single remaining 'morning-routine' hit is the new explanatory comment on line 49."
|
|
},
|
|
{
|
|
"command": "sudo DRY_RUN=1 bash /usr/local/bin/night-lockdown-unlock.sh",
|
|
"result": "pass",
|
|
"evidence": "Ends at 'already UNLOCKED — nothing else to do' with no alarm start attempted."
|
|
},
|
|
{
|
|
"command": "grep -rl morning-routine /usr/local/bin /etc/systemd /usr/lib/systemd ~/.config/systemd/user",
|
|
"result": "pass",
|
|
"evidence": "Starters are now only wake-alarm-trigger.service (primary, per-minute, phone's time) and /usr/lib/systemd/system-sleep/wake-alarm.sh (resume backstop)."
|
|
}
|
|
],
|
|
"risks": [
|
|
"If wake-alarm-trigger.timer is ever disabled or wake_alarm stops resolving the phone's alarm, there is no longer a fixed-hour fallback on an always-on PC — the alarm simply will not fire. Mitigated by wake_alarm's own FALLBACK_ALARM_HOUR and its stale-cache path.",
|
|
"Not observed end to end: no real lockdown-exit morning has happened since the change. Verified by dry-run and by enumerating starters, not by a live 05:00-07:00 unlock."
|
|
],
|
|
"rollback": [
|
|
"git revert this commit, then re-run 'sudo bash setup_night_lockdown.sh setup' to regenerate /usr/local/bin/night-lockdown-unlock.sh with the alarm start restored.",
|
|
"After rollback, confirm with: grep -n maybe_start_morning_alarm /usr/local/bin/night-lockdown-unlock.sh (expect the function back), and expect the 07:00 double-fire to return."
|
|
]
|
|
}
|