Skip to content

Keep the metrics ping's last-sent day stable across DST changes - #3733

Open
rvandermeulen wants to merge 1 commit into
mozilla:mainfrom
rvandermeulen:dateutils-dst-day
Open

rvandermeulen wants to merge 1 commit into
mozilla:mainfrom
rvandermeulen:dateutils-dst-day

Conversation

@rvandermeulen

@rvandermeulen rvandermeulen commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

getISOTimeString(truncateTo = DAY) wrote today's date with the offset in effect at the time of the call, and parsing that string gives midnight at that offset. When the offset changed later in the day (DST starting after midnight) or local midnight was skipped (DST starting at 00:00, as in Egypt, Chile, Cuba, Lebanon and the Azores), the string parsed back to the previous day. MetricsPingScheduler stores the metrics ping's last-sent date this way and checks it with DateUtils.isToday, so on those days a restart after the due time sent a second metrics ping.

Day strings now format the start of the local day with the offset that makes it read 00:00, so they always parse back to that day. The round-trip test now pins the time zone and uses fixed DST transition dates in several zones instead of the current date, which made it fail on DST-change days.

I found this when DateUtilsTest failed in local runs of #3732's tests today (2026-11-01, the day US DST ended) in America/New_York, on both JDK 17 and JDK 25; it passed with TZ=UTC. The DAY case formatted 2026-11-01-05:00, which parses back to 01:00 EDT, and formatting that again gave 2026-11-01-04:00. On a fall-back day the parsed date stays on the right day, so only the test's string comparison failed. The wrong-day case that sends the extra metrics ping happens on spring-forward days, which the new test covers. CI on #3732 didn't hit the failure.

@rvandermeulen
rvandermeulen requested a review from a team as a code owner November 1, 2026 19:09
@rvandermeulen
rvandermeulen requested review from travis79 and removed request for a team November 1, 2026 19:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant