Skip to content

feat: simpler schedule picker#53

Merged
finedesignz merged 1 commit into
mainfrom
feat/simpler-cron-ui
May 26, 2026
Merged

feat: simpler schedule picker#53
finedesignz merged 1 commit into
mainfrom
feat/simpler-cron-ui

Conversation

@finedesignz
Copy link
Copy Markdown
Owner

Summary

Replaces the raw 5-field cron exposure in the schedule editor with a structured "Every N [hours|days|weeks] starting on [date] at [time]" composer with a plus-button for multiple rules per task. Task fires on ANY rule.

  • DB: nullable scheduled_tasks.schedule_rules JSONB (idempotent ALTER). Legacy cron_expr column stays populated from rule[0] for back-compat with croner.
  • API: POST/PATCH /api/scheduled-tasks accepts EITHER cron_expr (legacy) OR schedule_rules (new). Server derives + stores both. next_3_runs preview merges across all rules.
  • Scheduler registry: arms one Cron registration per rule, all routing to dispatcher.fire(taskId). 5s cross-rule dedupe guard prevents overlapping-rule double-fires. Per-rule start_at gate skips pre-start fires; weekly interval > 1 enforced in-process.
  • Web: new ScheduleRulesBuilder + ScheduleRuleRow components — native date/time inputs, mobile-stacked layout, indigo accent, subtle rounded-lg, no heavy borders. Editor hydrates from schedule_rules when present, else seeds a default rule.

19 new unit tests for schedule-rules.ts. Existing 265 hub tests remain green. Web build clean.

Test plan

  • Create new schedule via UI: 1 rule, save, verify cron persisted + task fires.
  • Edit existing legacy schedule: confirm UI hydrates a single rule from the persisted cron.
  • Add 2nd rule (e.g. every 1 day @ 9am + every 1 day @ 5pm): confirm both fires arrive.
  • Remove a rule: confirm task continues with remaining rules.
  • Validate next_3_runs preview matches what hub registers.

🤖 Generated with Claude Code

Replaces raw cron exposure in the schedule editor with a structured
"Every N [hours|days|weeks] starting on [date] at [time]" composer
that supports multiple rules per task (plus-button to add).

- DB: nullable scheduled_tasks.schedule_rules JSONB (idempotent ALTER).
  Legacy cron_expr/cron_expression columns stay populated from rule[0]
  for back-compat with the croner engine.
- API: POST/PATCH /api/scheduled-tasks accepts EITHER cron_expr (legacy)
  OR schedule_rules. Server derives + stores both. next_3_runs preview
  merges fires across all rules.
- Scheduler registry: arms one Cron registration per rule; all fires
  route to dispatcher.fire(taskId). 5s cross-rule dedupe guard prevents
  overlapping rules from double-firing. Per-rule start_at gate skips
  pre-start fires; weekly interval>1 enforced in-process.
- Web: new ScheduleRulesBuilder + ScheduleRuleRow components, native
  date/time inputs, mobile-stacked layout, indigo accent. Editor
  hydrates from schedule_rules when present, else seeds a default rule.

Tests: 19 new unit tests for schedule-rules.ts. Existing 265 hub tests
remain green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@finedesignz finedesignz force-pushed the feat/simpler-cron-ui branch from d2a34b1 to fcf6aea Compare May 26, 2026 05:21
@finedesignz finedesignz merged commit c0ee344 into main May 26, 2026
1 check passed
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