shahar1 opened a new pull request, #69143:
URL: https://github.com/apache/airflow/pull/69143

   Monthly and yearly schedules (`relativedelta(months=...)` / 
`relativedelta(years=...)`) produced mis-aligned, drifting data intervals when 
`catchup=False`.
   
   `DeltaDataIntervalTimetable._skip_to_latest` (only reached on the 
`catchup=False` path) rounded "now" to a fixed **30-day / 365-day** grid 
anchored at the Unix epoch. Calendar months and years are not constant in 
length, so the first data interval after a Dag is unpaused never aligned to the 
Dag's `start_date`, and the chosen day-of-month walked backwards over time 
(e.g. `06-06 → 07-06 → 08-05 → 09-04`). The logical date a monthly Dag received 
therefore depended on *when* it happened to be unpaused rather than being a 
stable function of its schedule.
   
   The fix anchors calendar-based deltas on `start_date` and advances one 
period at a time, so the boundaries match what `catchup=True` produces 
(including `relativedelta`'s path-dependent day-clamping, e.g. Jan 31 → Feb 28 
→ Mar 28). `timedelta` and fixed-unit `relativedelta` schedules are untouched — 
they keep the existing O(1) epoch rounding, which is correct for fixed deltas.
   
   Added unit tests for monthly/yearly alignment, the no-`start_date` case, and 
day-clamping; all fail on the previous code and pass with the fix. The existing 
hourly `timedelta`/`relativedelta` and `catchup=True` tests guard the unchanged 
path.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to