Skip to content

Consolidate scheduled-job timers into one hourly unit - #405

Merged
dholbach merged 1 commit into
mainfrom
chore/consolidate-scheduled-jobs-timer
Sep 1, 2026
Merged

Consolidate scheduled-job timers into one hourly unit#405
dholbach merged 1 commit into
mainfrom
chore/consolidate-scheduled-jobs-timer

Conversation

@dholbach

@dholbach dholbach commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces the three separately-timed systemd units (fetch-calendar-events hourly, update-client-tags hourly, sync-focus-queue daily) with a single my-practice-scheduled-jobs hourly timer running a new run_scheduled_jobs management command that calls all three in sequence.
  • Each underlying job is independently idempotent, so folding Focus Queue sync's former daily cadence into the hourly run is safe. A failure in one job is logged and doesn't block the others.
  • Fixes update_client_tags.py showing 0% coverage in the quarterly review despite an existing test file — its _run() helper existed but was never called, so Command.handle() (system tag creation, incomplete-intake rule, inactive-client stripping) was untested. Added 6 end-to-end command tests.
  • CLIENT_TAGGING.md had 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.md updated 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 clean
  • Self-hoster: install my-practice-scheduled-jobs.timer/.service, confirm journalctl --user -u my-practice-scheduled-jobs.service shows all three job sections running

🤖 Generated with Claude Code

https://claude.ai/code/session_0171DPyqvcb88YiNzRmqMqBA

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
@dholbach
dholbach merged commit e521e3c into main Sep 1, 2026
2 checks passed
@dholbach
dholbach deleted the chore/consolidate-scheduled-jobs-timer branch September 1, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant