Skip to content

Conversation

@shreyaskj-0710
Copy link
Contributor

@shreyaskj-0710 shreyaskj-0710 commented Aug 19, 2025

Fixes #54482

Description
📌 Day-of-Month (DOM) and Day-of-Week (DOW) Conflict in Cron

In cron syntax, both Day-of-Month (DOM) and Day-of-Week (DOW) fields are evaluated independently.
If both are specified, the schedule runs when either condition matches (logical OR), not when both are true together.

Example

Cron expression : * * */1 * 5

*/1 → effectively means every day of the month

5 → every Friday

Together → Every minute (or) Every minute, only on Friday (but since */1 means every day, the Friday part becomes
redundant).

⚠️ This often causes confusion because users may expect it to mean “every Friday only” when in reality it matches “every day”.

Approach

  • Detect when both DOM (Day of the month) and DOW (Day of the week) are restricted (i.e., not "*").
  • Then split the expression into two variants:
  • One ignoring DOW (DOM only)
  • One ignoring DOM (DOW only)

Each variant is described independently, and the final description combines them using “(or)”, which matches actual cron semantics.

In UI Timetable description will be as follows
Screenshot from 2025-08-19 11-55-59

@shreyaskj-0710
Copy link
Contributor Author

Hi @uranusjr ,

can you please review the code changes.

@shreyaskj-0710
Copy link
Contributor Author

Hi @pierrejeambrun , @kaxil

can you please review the changes

@eladkal eladkal added this to the Airflow 3.0.7 milestone Aug 28, 2025
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Aug 28, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

At first I'm not in favor of this change. I don't really understand why this is needed. I would keep the standard cron description, if users cannot read cron expressions, they should go check the documentation. (I'm not strongly against it if this helps users)

Can you add relevant tests please.

@shreyaskj-0710
Copy link
Contributor Author

At first I'm not in favor of this change. I don't really understand why this is needed. I would keep the standard cron description, if users cannot read cron expressions, they should go check the documentation. (I'm not strongly against it if this helps users)

Can you add relevant tests please.

Hi @pierrejeambrun ,
Have added the tests

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Sep 4, 2025

@bbovenzi @uranusjr I would love your opinion on that

@kaxil kaxil modified the milestones: Airflow 3.0.7, Airflow 3.1.0 Sep 13, 2025
@bbovenzi
Copy link
Contributor

I mean if this is a more accurate description then sure. I also see the cron-descriptor has the same bug. Looks like we need to rebase and fix some tests though.

@RNHTTR
Copy link
Contributor

RNHTTR commented Sep 16, 2025

I mean if this is a more accurate description then sure. I also see the cron-descriptor has the same bug. Looks like we need to rebase and fix some tests though.

The existing description is objectively incorrect. It's not just more accurate; the existing implementation is broken and the proposed fix makes it not broken.

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Sep 17, 2025

OK I get it now. Current default description is wrong when both are specified. (I tested on other tools and they all do the same mistake).

Yes the tooltip needs to be fixed

Is that the only known 'bug' in the cron description?

  • If that's the only one issue with cron description, we can just handle the edge case as suggested in this PR.
  • If there are other instances of such common problem with cron description, maybe we shouldn't use the description at all, and let the user read the cron expression instead.

@RNHTTR
Copy link
Contributor

RNHTTR commented Sep 17, 2025

Is that the only known 'bug' in the cron description?

This is the only bug that I'm aware of. Other descriptions appear accurate.

@pierrejeambrun
Copy link
Member

This is the only bug that I'm aware of. Other descriptions appear accurate.

Glad to hear. I think we can move forward then.

@shreyaskj-0710 Do you mind rebasing the PR and fixing the CI please.

@kaxil kaxil modified the milestones: Airflow 3.1.0, Airflow 3.1.1 Sep 18, 2025
@shreyaskj-0710
Copy link
Contributor Author

This is the only bug that I'm aware of. Other descriptions appear accurate.

Glad to hear. I think we can move forward then.

@shreyaskj-0710 Do you mind rebasing the PR and fixing the CI please.

Hi @pierrejeambrun ,

Have updated the PR and fixed the CI

@pierrejeambrun pierrejeambrun added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Sep 30, 2025
@pierrejeambrun pierrejeambrun merged commit c6531bb into apache:main Sep 30, 2025
61 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 30, 2025
…eek conflicts (#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------
(cherry picked from commit c6531bb)

Co-authored-by: shreyaskj-0710 <[email protected]>
Co-authored-by: Ryan Hatter <[email protected]>
@github-actions
Copy link

Backport successfully created: v3-1-test

Status Branch Result
v3-1-test PR Link

abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 1, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
pierrejeambrun pushed a commit that referenced this pull request Oct 1, 2025
…eek conflicts (#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------
(cherry picked from commit c6531bb)

Co-authored-by: shreyaskj-0710 <[email protected]>
Co-authored-by: Ryan Hatter <[email protected]>
pierrejeambrun pushed a commit that referenced this pull request Oct 1, 2025
…eek conflicts (#54644) (#56255)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------
(cherry picked from commit c6531bb)

Co-authored-by: shreyaskj-0710 <[email protected]>
Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 2, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 3, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 4, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
dabla pushed a commit to dabla/airflow that referenced this pull request Oct 12, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
apache#54644)

* Fix cron expression display for Day-of-Month and Day-of-Week conflicts

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

* Add test case for CronMixin description attribute

---------

Co-authored-by: Ryan Hatter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Airflow UI incorrectly interprets some cron expressions like 0 0 */1 * 5

6 participants