Skip to content

Make schedule store recurrence-aware (cron + RRULE)#5516

Merged
siddseethepalli merged 1 commit into
mainfrom
codex/rrule-support-pr04-store-recurrence
Feb 19, 2026
Merged

Make schedule store recurrence-aware (cron + RRULE)#5516
siddseethepalli merged 1 commit into
mainfrom
codex/rrule-support-pr04-store-recurrence

Conversation

@siddseethepalli
Copy link
Copy Markdown
Contributor

@siddseethepalli siddseethepalli commented Feb 19, 2026

Summary

  • Upgrades the schedule store to support both cron and RRULE syntax via the recurrence engine introduced in PR 02
  • Adds syntax and expression fields to the ScheduleJob interface while preserving cronExpression for backward compatibility
  • createSchedule and updateSchedule now accept optional syntax/expression params; when omitted, defaults to cron behavior
  • claimDueSchedules reads schedule_syntax from DB rows and delegates to computeNextRunAtEngine for syntax-aware next-run computation
  • Persists schedule_syntax in the DB (cron_jobs.schedule_syntax column added in PR 03)
  • All existing cron-only callers continue to work without changes

Test plan

  • New test suite schedule-store.test.ts with 14 tests covering:
    • Cron schedule creation via legacy API (backward compat)
    • RRULE schedule creation with syntax + expression
    • DB persistence of schedule_syntax column
    • Validation rejection of invalid expressions
    • updateSchedule with syntax/expression switching
    • claimDueSchedules advancing both cron and RRULE schedules
    • Optimistic lock preventing double-claiming
  • Existing task-scheduler.test.ts passes (6/6)
  • tsc --noEmit passes

🤖 Generated with Claude Code


Open with Devin

Upgrade schedule store to support both cron and RRULE syntax via the
recurrence engine. Adds syntax/expression fields to ScheduleJob,
persists schedule_syntax in DB, and uses recurrence engine for
validation and next-run computation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@siddseethepalli siddseethepalli merged commit 712653d into main Feb 19, 2026
@siddseethepalli siddseethepalli deleted the codex/rrule-support-pr04-store-recurrence branch February 19, 2026 21:49
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee6f9d0fd8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +212 to +216
newNextRunAt = computeNextRunAtEngine({
syntax,
expression: row.cronExpression,
timezone: row.timezone,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle exhausted RRULEs after claiming the due run

For finite RRULE schedules (for example COUNT=1 or an UNTIL boundary), computeNextRunAtEngine can throw once the currently due occurrence is the last one; in claimDueSchedules, that exception path skips the job entirely, so the due run is never claimed/executed and the row remains perpetually due on every tick. This regression is introduced by adding RRULE support here, because cron expressions were effectively unbounded before. The claim path needs to execute the current due run even when no subsequent occurrence exists (e.g., by claiming and disabling/removing the schedule).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@siddseethepalli
Copy link
Copy Markdown
Contributor Author

Addressed in #5634

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