Skip to content

schedules: show the next five runs on preview and apply - #188

Open
teddashh wants to merge 1 commit into
mainfrom
feat/schedule-preview-upcoming-runs
Open

teddashh wants to merge 1 commit into
mainfrom
feat/schedule-preview-upcoming-runs

Conversation

@teddashh

Copy link
Copy Markdown
Collaborator

What

ScheduleResult gains upcoming_runs: the next five run times, in UTC, computed in the schedule's tz, starting at schedule.next_run_at. A disabled schedule returns [].

  • Store: preview now computes next_run_at the same way apply does, so a preview shows exactly the schedule apply will store. One function (scheduleUpcoming) produces the list for both phases.
  • Web: the schedule preview renders the Hub's list ("Upcoming runs · 時區 / UTC"), or "Disabled · 不會執行". Its own three-run calculation is removed, so there is a single cron evaluation path.
  • Client: the strict decoder requires the list to be UTC, strictly increasing, at most five entries, empty when disabled, and to start at next_run_at.
  • Replay: an apply receipt stored before this field existed replays with [], never null.
  • Docs: API-SURFACE schedules section and FEATURE-INVENTORY row 255.

Tests

  • store: */5 8 * * * and 0 8 * * 1-5 in Asia/Taipei across a weekend, apply, legacy-receipt replay, and disabled.
  • web: five entries when enabled, the disabled text when disabled.
  • client: one accept case plus six rejected shapes (null, disabled with runs, wrong first run, not increasing, not UTC, too many).
  • Mutations: 8 tried. Seven were caught. The eighth (dropping .UTC()) was equivalent because NextIn already returns UTC, so the redundant call was removed.
  • Gate: GATE_RESULT=green (56 Go packages, OPS ok).

Independent of #186 and #187.

🤖 Generated with Claude Code

ScheduleResult gains upcoming_runs: five UTC run times computed in the
schedule's tz, starting at next_run_at; a disabled schedule lists none.
Preview now computes next_run_at the same way apply does, so the preview
shows exactly what apply will store. The web preview renders the Hub's
list instead of computing its own three runs, and the strict client
checks the list is UTC, increasing, bounded, and starts at next_run_at.
A replayed receipt recorded without the field returns an empty list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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