Skip to content

fix(frontend): union day-of-month and day-of-week in cron next-runs preview#4798

Open
ardaerzin wants to merge 1 commit into
gateway-triggers-allfrom
fe-fix/trigger-schedule-cron-dom-dow-union
Open

fix(frontend): union day-of-month and day-of-week in cron next-runs preview#4798
ardaerzin wants to merge 1 commit into
gateway-triggers-allfrom
fe-fix/trigger-schedule-cron-dom-dow-union

Conversation

@ardaerzin

@ardaerzin ardaerzin commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Stacked on #4749 (gateway-triggers-all). solves a bug in the schedule drawer's cron preview.

Problem

The schedule "next runs" preview ANDs the day-of-month and day-of-week cron fields. POSIX cron — and the backend croniter that actually fires the schedule — treat them as a union when both are restricted.

So 0 0 1 * 1 ("1st of the month or any Monday") previewed its next run as 2027-02-01 (the next 1st-of-month that also happens to be a Monday, ~7 months out) instead of the coming Monday. The preview disagreed with what the schedule would actually do

Before / After

For 0 0 1 * 1, evaluated 2026-06-22 (a Monday):

Next runs
Before 2027-02-01, 2027-03-01, …
After 2026-06-29 (Mon), 2026-07-01 (1st), 2026-07-06 (Mon), …

Change

nextCronRuns now matches either day field when both are restricted, and keeps plain AND when only one is (a * field is always-true). Pure client-side preview helper — the backend remains the source of truth; this only makes the hint agree with it.

Added unit coverage for the union case and the single-restricted-field AND case (gatewayTriggerCron.test.ts, 13 passing).

Verified

  • vitest run gatewayTriggerCron.test.ts — 13/13 pass
  • prettier + eslint clean on changed files

…review

The schedule drawer's 'next runs' preview ANDed the day-of-month and
day-of-week cron fields, so an expression like `0 0 1 * 1` only matched
when the 1st of the month was also a Monday — previewing the next run as
2027-02-01 instead of the coming Monday. POSIX cron and the backend
croniter treat the two fields as a union when both are restricted, so the
preview disagreed with what the schedule actually fires.

Match either field when both are restricted (plain AND otherwise, since a
`*` field is always-true). Add unit coverage for the union case and for
the single-restricted-field AND case.
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 22, 2026
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 22, 2026 9:26pm

Request Review

@dosubot dosubot Bot added bug Something isn't working Frontend labels Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 00fea309-218b-4e3e-ace9-40d0a1035598

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fe-fix/trigger-schedule-cron-dom-dow-union

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-515a.up.railway.app/w
Project agenta-oss-pr-4798
Image tag pr-4798-496779d
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-06-22T21:38:49.312Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Frontend size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant