Uh oh!
There was an error while loading. Please reload this page.
Fix cron description treating "?" as a day-of-month/day-of-week conflict - #72292
Open
ethanstoner wants to merge 1 commit into
Open
Fix cron description treating "?" as a day-of-month/day-of-week conflict#72292ethanstoner wants to merge 1 commit into
ethanstoner wants to merge 1 commit into
Conversation
croniter accepts "?" in the day-of-month and day-of-week fields and expands it to "*", so "0 0 ? * MON" schedules exactly like "0 0 * * MON". The DOM/DOW conflict check compared the two fields against "*" only, so a "?" counted as a restriction and the generated description was split into a bogus "or" clause: 0 0 ? * MON -> "At 00:00 (or) At 00:00, only on Monday" 0 0 1 * ? -> "At 00:00, on day 1 of the month (or) At 00:00" The extra clause claims a daily midnight run that never happens. This description is stored as DagModel.timetable_description and shown in the UI, the REST API and "airflow dags details". Treat "?" as unrestricted alongside "*". Genuine DOM/DOW conflicts such as "0 0 15 * 1" keep the existing "or" explanation. Signed-off-by: Ethan Stoner <ethanstoner08@gmail.com>
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
croniteraccepts?in the day-of-month and day-of-week fields and expands it to*(croniter.py: "currently just trade?as*"), so0 0 ? * MONschedules exactly like0 0 * * MON. Airflow's docs explicitly point users at croniter's extended syntax incron.rst.CronMixin._describe_with_dom_dow_fixcompares the DOM/DOW fields against"*"only, so a?counts as a restriction and the description gets split into a bogus "or" clause that claims a run which never happens.Reproduction (on
main, before this change)The description is persisted as
DagModel.timetable_descriptionand surfaced in the UI, the REST API (DAGDetailsResponse.timetable_description) andairflow dags details, so the user is shown a schedule that contradicts what the scheduler actually does.After
Genuine DOM/DOW conflicts keep the existing "or" explanation added in #54644.
Testing
Three parametrized cases added to
airflow-core/tests/unit/timetables/test_cron_mixin.py, each asserting the?form describes identically to its*equivalent. They fail on unpatchedmain:and pass with the fix. Full suite and static checks:
uv run --project airflow-core pytest airflow-core/tests/unit/timetables/— 256 passedprek run --files airflow-core/src/airflow/timetables/_cron.py airflow-core/tests/unit/timetables/test_cron_mixin.py— all hooks passprek run mypy-airflow-core --files airflow-core/src/airflow/timetables/_cron.py— passedNo newsfragment: this is a bugfix to a generated description string, not a significant user-facing change. Happy to add one if a maintainer prefers.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines
The defect was found by auditing
airflow/timetables/, reproduced against unmodifiedmain, and every command and output quoted above was actually run locally. I have reviewed and understand the change; it is two lines of logic plus a test.