Repository navigation
Conversation
Adding the check-in margin to the next expected check-in in the monitor's timezone uses wall-clock arithmetic, which resets the datetime's fold. During the repeated hour after DST ends, next_checkin_latest then lands an hour early, so check_missed marks every slot missed although the check-in arrives on time. 🤖 Generated with Claude Code
spawnia
marked this pull request as ready for review
October 25, 2026 09:51
Python returns False for an inter-zone == when one operand is an ambiguous local time with fold=1 (PEP 495). 🤖 Generated with Claude Code
This branch has not been deployed
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 free
to 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.
Crontab monitors in a DST timezone report every check-in as missed during the repeated hour after DST ends.
get_next_expected_checkin_latestnow adds the check-in margin in UTC instead of local time.Local datetime arithmetic resets the fold, so the margin deadline lands an hour early
get_next_expected_checkinreturns the next slot in the monitor's timezone.In the repeated hour that datetime carries
fold=1.Adding a
timedeltato it is wall-clock arithmetic and returnsfold=0, the first pass of that hour.With
* * * * *,Europe/Berlinand a 5 minute margin, a check-in at 2024-10-27 01:00:03 UTC gives:next_checkinnext_checkin_latestbeforenext_checkin_latestaftercheck_missedseesnext_checkin_latestalready in the past and creates a missed check-in for the slot at once.The real check-in arrives seconds later as
ok, but withfailure_issue_threshold: 1every slot from 01:00 to 01:54 UTC opened a monitor failure issue.Slots whose deadline falls after the repeated hour, from 02:55 local time on, are unaffected.
Observed on a self-hosted instance on 2026-10-25
Every minutely and five-minutely monitor in
Europe/Berlinshowed amissedcheck-in exactly at each expected time from 01:00 to 01:54 UTC, next to anokcheck-in for the same slot about 3 seconds later.No phantom misses appeared before or after that window.
Spring forward is unaffected: a skipped local time resolves to the correct UTC instant.
Related: #66868 fixed DST handling in the schedule itself
Replacing croniter with cronsim made
get_next_scheduleandget_prev_schedulecorrect across DST.This bug sits after the schedule, in the margin addition.
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
🤖 Generated with Claude Code