T3.3: Add state-mutating operations to app.Service
Add src/app/operations.go with the seven intents that make the Service the sole writer of job and runtime state: CreateJob, UpdateJob, DeleteJob, SetEnabled, RunNow, SetGlobalPause, UpdateSettings. Each returns error, persists through the store, and announces changes via RunRecorded/JobChanged/SchedulerStateChanged events. Extend the Service with a parsed-schedule cache, a global paused flag, an injectable runJob seam (defaults to runner.RunJob) for testing the run-now path, and a lifecycle ctx. Run and next-run timing now live in the Service (duplicating the scheduler temporarily); T3.4 converts the scheduler to drive the Service and removes the duplication. Autostart is left to the caller until T5.2's injectable Manager; async save errors in the run goroutine remain deferred to T5.1. Adds 12 tests covering create/update/delete, enable/pause, global pause, run-now with a fake runner, and settings persistence/validation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -262,7 +262,7 @@ Track progress here. Mark tasks complete as they land and pass review.
|
||||
### Phase 3 — Application service layer
|
||||
- [x] T3.1 — Create `src/app/service.go`; owns state behind mutex
|
||||
- [x] T3.2 — Add `src/app/events.go`; Event types + Observer
|
||||
- [ ] T3.3 — Add state-mutating operations to service
|
||||
- [x] T3.3 — Add state-mutating operations to service
|
||||
- [ ] T3.4 — Convert `scheduler` to use service; inject Clock
|
||||
- [ ] T3.5 — Move display helpers to `src/app/format.go`
|
||||
- [ ] T3.6 — Add `src/app` unit tests (no Fyne)
|
||||
|
||||
Reference in New Issue
Block a user