Consolidate scheduled-job timers into one hourly unit - #405
Merged
Conversation
fetch_calendar_events, update_client_tags, and sync_focus_queue_tasks were each wired to their own systemd timer/service pair with inconsistent cadences (two hourly, one daily) despite all three being idempotent sync jobs safe to run on the same schedule. New run_scheduled_jobs command runs them in sequence under a single hourly timer; a failure in one job is logged but doesn't block the others. Also fixes update_client_tags.py showing 0% test coverage despite an existing test file — its _run() helper was defined but never called, so only the underlying sync_no_next_session_tag helper was tested, not Command.handle() itself (system tag creation, incomplete-intake rule, inactive-client tag stripping). Added end-to-end command tests. CLIENT_TAGGING.md's cron example was also stale (recommended a manual daily crontab entry that never matched the actual hourly systemd timer) — now points at the consolidated timer instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0171DPyqvcb88YiNzRmqMqBA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fetch-calendar-eventshourly,update-client-tagshourly,sync-focus-queuedaily) with a singlemy-practice-scheduled-jobshourly timer running a newrun_scheduled_jobsmanagement command that calls all three in sequence.update_client_tags.pyshowing 0% coverage in the quarterly review despite an existing test file — its_run()helper existed but was never called, soCommand.handle()(system tag creation, incomplete-intake rule, inactive-client stripping) was untested. Added 6 end-to-end command tests.CLIENT_TAGGING.mdhad a stale manual-crontab example that never matched the actual (hourly) shipped timer — replaced with a pointer to the consolidated timer doc.docs/operations/SCRIPTS.mdupdated with an upgrade note for existing self-hosters (disable/remove the three old units before installing the new one).Test plan
./dev.py test my_practice.tests.test_run_scheduled_jobs my_practice.tests.test_update_client_tags my_practice.tests.test_sync_focus_queue_tasks my_practice.tests.test_fetch_calendar_events— 74 passed./dev.py lint— ruff format/lint + Tailwind build cleanmy-practice-scheduled-jobs.timer/.service, confirmjournalctl --user -u my-practice-scheduled-jobs.serviceshows all three job sections running🤖 Generated with Claude Code
https://claude.ai/code/session_0171DPyqvcb88YiNzRmqMqBA