Add systemd timer and desktop notifications #3
Loading…
Reference in a new issue
No description provided.
Delete branch "worktree-add-systemd-timer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
pkgwatch had no scheduler: it only ran when invoked by hand, so new upstream releases (e.g. Claude Code 2.1.278) sat unnoticed. This adds a user-level systemd timer and desktop notifications so a new release surfaces on its own.
What
systemd/pkgwatch.timer,pkgwatch.service): user-level units that run a check 10s after login, then hourly. Non-persistent, per the spec. The service setsWorkingDirectory=~/dev/pkgwatchbecausepackages.d/,state/andwork/resolve relative to cwd. There is noRandomizedDelaySec: it applies to every trigger, including the login one, and a single machine has no herd to spread out.src/notifier.rs):notify-sendwhen a tier 4-6 release is newly queued for review, or a tier 1-3 release is published. Best-effort: a missingnotify-sendor session bus only prints a warning and never fails a run.review --approvedeliberately doesn't notify, since the operator is already at the terminal.pkgwatch-failure.service): triggered viaOnFailure=, sends a critical notification on any non-zero exit (verification, build or network failure).src/test_support.rs):write_executable_scriptwas flaky (~5% of runs) withText file busy, because a fork on another test thread could hold a copy of the script's write fd during exec. It now probe-execs the script and retries until it is runnable. 150 consecutive runs passed with no failures. This also fixes the existingpublishertests, not just the new notifier one.docs/SPEC.md): scheduling and notifications are documented with install commands. Per-packagecheck_intervalstays listed as unimplemented, since the timer is a fixed tick.Design notes
makepkgrefuses it, the repo is under~/.local/share, and install remains a manualsudo pacman -Syu), and desktop notifications need the user's session bus.pkgwatch review <name> --approve. The notification is what makes that visible.Testing
cargo fmt --check,cargo clippy --all-targets -- -D warningsand the complexity lint are clean. 91 tests pass, 4 of them new (notifier message wording, stub-binary invocation, missing binary).systemd-analyze verify --useris clean on all three units. Not yet verified: a live notification or a real timer run, since the timer isn't installed.After merging
From the main checkout:
Rebuild with
cargo build --releaseafter code changes; the service runstarget/release/pkgwatch.🤖 Generated with Claude Code
worktree-add-systemd-timerto Add systemd timer and desktop notifications