Extract timer scheduling into one shared function #8

Closed
opened 2026-08-17 19:31:19 +00:00 by rosa · 0 comments
Owner

What to build

Prefactor, no user-visible change. Starting a Pomodoro, a short break, and a long break each schedule a tomate timer check through systemd-run, and each does it with its own near-identical copy of the same block. The copies have already drifted: the break paths write the scheduler's stderr straight to stderr, while the Pomodoro path buries it in a log line, and only the Pomodoro path formats the delay as whole seconds rather than a float.

Collapse the three copies into one function that the three start paths call. Behaviour stays exactly as it is today — the divergence gets fixed in the tickets that follow, in one place instead of three.

Acceptance criteria

  • One function schedules the follow-up timer check for all three timer kinds
  • tomate pom start, tomate short start, and tomate long start each still schedule a timer that fires at the end of the timer's duration
  • The delay passed to the scheduler is formatted the same way for all three kinds
  • No copy of the scheduling call remains outside the shared function
  • cargo test and cargo clippy stay clean

Blocked by

None — can start immediately.

## What to build Prefactor, no user-visible change. Starting a Pomodoro, a short break, and a long break each schedule a `tomate timer check` through `systemd-run`, and each does it with its own near-identical copy of the same block. The copies have already drifted: the break paths write the scheduler's stderr straight to stderr, while the Pomodoro path buries it in a log line, and only the Pomodoro path formats the delay as whole seconds rather than a float. Collapse the three copies into one function that the three start paths call. Behaviour stays exactly as it is today — the divergence gets fixed in the tickets that follow, in one place instead of three. ## Acceptance criteria - [ ] One function schedules the follow-up `timer check` for all three timer kinds - [ ] `tomate pom start`, `tomate short start`, and `tomate long start` each still schedule a timer that fires at the end of the timer's duration - [ ] The delay passed to the scheduler is formatted the same way for all three kinds - [ ] No copy of the scheduling call remains outside the shared function - [ ] `cargo test` and `cargo clippy` stay clean ## Blocked by None — can start immediately.
rosa closed this issue 2026-08-17 22:00:18 +00:00
Sign in to join this conversation.
No description provided.