bileyroy opened a new pull request, #69879:
URL: https://github.com/apache/airflow/pull/69879
closes: #69872
When `start_date` is `NULL` (e.g. dag_runs that were marked failed before
execution began), the cleanup query's `WHERE start_date < cutoff` evaluates to
`NULL` and silently skips these rows forever.
## Changes
- Add `fallback_recency_column_name` field to `_TableConfig` (set to
`created_at` for `dag_run`)
- Add `--fallback-cleanup-on-null` CLI flag (opt-in, off by default)
- When enabled, the main WHERE condition uses `COALESCE(start_date,
created_at) < cutoff`
- Add 3 unit tests covering the flag behavior
## Test plan
- [x] `pytest airflow-core/tests/unit/utils/test_db_cleanup.py -xvs` — 70
passed
- [x] `ruff check` / `ruff format` — clean
- [x] `mypy` — clean
- [x] Manual testing in local via `airflow standalone`: 3 dag_runs
(success, failed+NULL, queued+NULL), verified dry-run count changes from 1→3
with flag
<img width="1607" height="796" alt="image"
src="https://github.com/user-attachments/assets/e93641bc-d93e-45d0-829d-2c7748f2fdcf"
/>
<img width="1607" height="643" alt="image"
src="https://github.com/user-attachments/assets/ba213f21-5d93-4d83-9032-2b4c7d215218"
/>
<img width="1607" height="641" alt="image"
src="https://github.com/user-attachments/assets/004ac8cf-254f-47d0-8915-ddf5d11efda9"
/>
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]