uranusjr commented on code in PR #70089:
URL: https://github.com/apache/airflow/pull/70089#discussion_r3744781764


##########
airflow-core/src/airflow/timetables/_cron.py:
##########
@@ -166,14 +166,21 @@ def _get_next(self, current: DateTime) -> DateTime:
         return convert_to_utc(current.in_timezone(self._timezone) + delta)
 
     def _get_prev(self, current: DateTime) -> DateTime:
-        """Get the first schedule before specified time, with DST fixed."""
+        """Get the first schedule strictly before specified time, with DST 
fixed."""
         naive = make_naive(current, self._timezone)
         cron = croniter(self._expression, start_time=naive)
         scheduled = cron.get_prev(datetime.datetime)
         if TYPE_CHECKING:
             assert isinstance(scheduled, datetime.datetime)
         if not _covers_every_hour(cron):
-            return convert_to_utc(make_aware(scheduled, self._timezone))
+            prev = convert_to_utc(make_aware(scheduled, self._timezone))
+            # croniter steps back on naive wall clock, but make_aware can map 
a tick inside
+            # a DST transition forward onto current or later. Keep stepping 
until strictly
+            # earlier; get_prev is strictly decreasing, so this terminates.
+            while prev >= current:

Review Comment:
   Please add a parametrized case (mirroring 
`test_cron_infer_manual_data_interval_dst`) that drives `next_dagrun_info` 
through `_skip_to_latest` across a DST boundary, so this behavior doesn't 
silently regress if `_get_prev` changes again.



-- 
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