Skip to content

Take the rules of the Pomodoro out of its service - #184

Merged
vesnicancz merged 1 commit into
masterfrom
refactor/pomodoro-cycle
Nov 5, 2026
Merged

vesnicancz merged 1 commit into
masterfrom
refactor/pomodoro-cycle

Conversation

@vesnicancz

Copy link
Copy Markdown
Owner

PomodoroService kept the rules of the Pomodoro in the same class and the same methods as the LED, the notifications, automatic tracking and the timer. Checking which phase follows which meant going through mocks of all of those.

What changes

  • PomodoroCycle is a new class with the rules: Start, Stop, Reset, Tick and Advance, the last of which returns a PomodoroTransition. It has no dependencies, no clock and no lock.
  • PomodoroService keeps the lock and the timer, and acts on what the cycle returns. Its public interface doesn't change.
  • _isRunning goes. It was always set together with the phase, so running now simply means the phase isn't Idle.
  • The tracking and notification code stays in the service as private methods. Moving those out would only have shifted lines around, because nothing else uses them.

Behavior doesn't change. In particular Stop still keeps the count of completed Pomodoros until the next start and Reset clears it, and a running Pomodoro keeps the settings it started with.

Testing

  • All 1473 tests pass on Windows. The 13 new tests in PomodoroCycleTests cover the rules without any mocks, including a whole cycle through the long break. The existing PomodoroServiceTests pass unchanged.
  • I ran the Debug GUI through UI Automation: the timer counted down from 25 minutes (24:56), Skip moved from Work to ShortBreak, and Stop ended it, with all of it matching the log. Automatic tracking is off in these settings, so it didn't run.
  • Not tried: a phase running out on its own in the running app, and a real Luxafor following the phases. I didn't check the device during the run.

@vesnicancz
vesnicancz force-pushed the refactor/pomodoro-cycle branch from 931628c to b1cdaa1 Compare November 5, 2026 13:11
@vesnicancz
vesnicancz merged commit 5de4a19 into master Nov 5, 2026
5 checks passed
@vesnicancz
vesnicancz deleted the refactor/pomodoro-cycle branch November 5, 2026 13:14
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