You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ethanstoner (via GitHub)" <gi...@apache.org> on 2026/08/30 10:13:06 UTC
[PR] Fix cron description treating "?" as a day-of-month/day-of-week conflict [airflow]
ethanstoner opened a new pull request, #72292:
URL: https://github.com/apache/airflow/pull/72292
`croniter` accepts `?` in the day-of-month and day-of-week fields and expands it to `*` ([`croniter.py`](https://github.com/kiorky/croniter/blob/master/src/croniter/croniter.py): *"currently just trade `?` as `*`"*), so `0 0 ? * MON` schedules exactly like `0 0 * * MON`. Airflow's docs explicitly point users at croniter's extended syntax in [`cron.rst`](https://github.com/apache/airflow/blob/main/airflow-core/docs/authoring-and-scheduling/cron.rst).
`CronMixin._describe_with_dom_dow_fix` compares 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)
```
$ uv run --project airflow-core python -c '...'
croniter 6.2.4 | cron-descriptor 2.1.0
expression : 0 0 ? * MON
actual runs : ['2026-01-05', '2026-01-12', '2026-01-19'] # Mondays only
description : 'At 00:00 (or) At 00:00, only on Monday' # <- claims a daily midnight run
expression : 0 0 1 * ?
actual runs : ['2026-02-01', '2026-03-01', '2026-04-01'] # 1st of month only
description : 'At 00:00, on day 1 of the month (or) At 00:00'
```
The description is persisted as `DagModel.timetable_description` and surfaced in the UI, the REST API (`DAGDetailsResponse.timetable_description`) and `airflow dags details`, so the user is shown a schedule that contradicts what the scheduler actually does.
### After
```
'0 0 ? * MON' -> 'At 00:00, only on Monday'
'0 0 1 * ?' -> 'At 00:00, on day 1 of the month'
'0 0 15 * 1' -> 'At 00:00, on day 15 of the month (or) At 00:00, only on Monday'
```
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 unpatched `main`:
```
3 failed, 3 passed
FAILED test_cron_mixin.py::test_question_mark_is_not_a_dom_dow_conflict[question-mark-day-of-month]
FAILED test_cron_mixin.py::test_question_mark_is_not_a_dom_dow_conflict[question-mark-day-of-week]
FAILED test_cron_mixin.py::test_question_mark_is_not_a_dom_dow_conflict[question-mark-both]
```
and pass with the fix. Full suite and static checks:
- `uv run --project airflow-core pytest airflow-core/tests/unit/timetables/` β **256 passed**
- `prek run --files airflow-core/src/airflow/timetables/_cron.py airflow-core/tests/unit/timetables/test_cron_mixin.py` β all hooks pass
- `prek run mypy-airflow-core --files airflow-core/src/airflow/timetables/_cron.py` β passed
No 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?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
The defect was found by auditing `airflow/timetables/`, reproduced against unmodified `main`, 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix cron description treating "?" as a day-of-month/day-of-week conflict [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #72292:
URL: https://github.com/apache/airflow/pull/72292#issuecomment-5468074632
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](https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:
- Pay attention to the quality of your code (ruff, mypy and type annotations). Our [prek-hooks]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks) will help you with that.
- In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/custom-operator.rst) Consider adding an example Dag that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
- Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
- Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
- Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
- Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
Apache Airflow is a community-driven project and together we are making it better π.
In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://s.apache.org/airflow-slack
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix cron description treating "?" as a day-of-month/day-of-week conflict [airflow]
Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #72292:
URL: https://github.com/apache/airflow/pull/72292#discussion_r3954431839
##########
airflow-core/tests/unit/timetables/test_cron_mixin.py:
##########
@@ -39,3 +41,20 @@ def test_dom_and_dow_conflict():
assert "(or)" in desc
assert "Every minute, on day 1 of the month" in desc
assert "Every minute, only on Monday" in desc
+
+
+@pytest.mark.parametrize(
+ ("expression", "equivalent"),
+ [
+ pytest.param("0 0 ? * MON", "0 0 * * MON", id="question-mark-day-of-month"),
+ pytest.param("0 0 1 * ?", "0 0 1 * *", id="question-mark-day-of-week"),
+ pytest.param("0 0 ? * ?", "0 0 * * *", id="question-mark-both"),
+ ],
+)
+def test_question_mark_is_not_a_dom_dow_conflict(expression, equivalent):
+ # croniter expands "?" to "*", so it must describe the same as the "*" form
+ # instead of being reported as a day-of-month/day-of-week conflict.
Review Comment:
This comment is not needed. Itβs already present in the implementation; duplicating can potentially cause drift.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix cron description treating "?" as a day-of-month/day-of-week conflict [airflow]
Posted by "ethanstoner (via GitHub)" <gi...@apache.org>.
ethanstoner commented on code in PR #72292:
URL: https://github.com/apache/airflow/pull/72292#discussion_r3958836511
##########
airflow-core/tests/unit/timetables/test_cron_mixin.py:
##########
@@ -39,3 +41,20 @@ def test_dom_and_dow_conflict():
assert "(or)" in desc
assert "Every minute, on day 1 of the month" in desc
assert "Every minute, only on Monday" in desc
+
+
+@pytest.mark.parametrize(
+ ("expression", "equivalent"),
+ [
+ pytest.param("0 0 ? * MON", "0 0 * * MON", id="question-mark-day-of-month"),
+ pytest.param("0 0 1 * ?", "0 0 1 * *", id="question-mark-day-of-week"),
+ pytest.param("0 0 ? * ?", "0 0 * * *", id="question-mark-both"),
+ ],
+)
+def test_question_mark_is_not_a_dom_dow_conflict(expression, equivalent):
+ # croniter expands "?" to "*", so it must describe the same as the "*" form
+ # instead of being reported as a day-of-month/day-of-week conflict.
Review Comment:
Removed.
Re-ran the file after taking it out: 6 passed with the fix, and the three `?` cases fail against the merge base parent `caa8f286a0`, so the regression test still bites. `test_dom_and_dow_conflict` passes either way, so `* * 1 * 1` still reports the real conflict.
Agreed that `*/1` belongs in a separate PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix cron description treating "?" as a day-of-month/day-of-week conflict [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #72292:
URL: https://github.com/apache/airflow/pull/72292#issuecomment-6391408104
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix cron description treating "?" as a day-of-month/day-of-week conflict [airflow]
Posted by "github-actions[bot] (via GitHub) via commits" <co...@airflow.apache.org>.
github-actions[bot] closed pull request #72292: Fix cron description treating "?" as a day-of-month/day-of-week conflict
URL: https://github.com/apache/airflow/pull/72292
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org