Skip to content

Conversation

@mkysel
Copy link
Collaborator

@mkysel mkysel commented Sep 10, 2025

Previously expiry times were computed using time.Now().AddDate(...), which
advances calendar days in local time. This caused expiry drift of ±1h when
crossing DST boundaries (e.g. Nov 2, 2025 in America/New_York), leading to
test failures and inconsistent retention windows.

We now calculate expiry as:

time.Now().UTC().Add(time.Hour * 24 * retentionDays)

This normalizes to UTC and ensures each "day" of retention is treated as an
exact 24-hour period, independent of daylight saving time changes or local
timezone shifts.

Tests updated accordingly to use the same UTC 24h-day semantics.

@mkysel mkysel requested a review from a team as a code owner September 10, 2025 14:56
@graphite-app
Copy link

graphite-app bot commented Sep 10, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@macroscopeapp
Copy link

macroscopeapp bot commented Sep 10, 2025

Normalize expiry timestamp calculation to UTC with fixed 24-hour increments in migrator.Transformer.buildAndSignOriginatorEnvelope and registrant.Registrant.SignStagedEnvelope

This change updates expiry calculations to use UTC with exact 24-hour day increments and improves test assertion output for readability.

  • Update ExpiryUnixtime to time.Now().UTC().Add(time.Hour*24*time.Duration(retentionDays)).Unix() in migrator.Transformer.buildAndSignOriginatorEnvelope in transformer.go
  • Update ExpiryUnixtime to time.Now().UTC().Add(time.Hour*24*time.Duration(retentionDays)).Unix() in registrant.Registrant.SignStagedEnvelope in registrant.go
  • Improve require.InDelta message to show human-readable expected/actual timestamps in payer.TestPublishToNodes in publish_test.go

📍Where to Start

Start with the expiry computation in migrator.Transformer.buildAndSignOriginatorEnvelope in transformer.go, then review the corresponding change in registrant.Registrant.SignStagedEnvelope in registrant.go.


Macroscope summarized 594d074.

@mkysel mkysel merged commit 66e7699 into main Sep 10, 2025
10 checks passed
@mkysel mkysel deleted the mkysel/fix-tz-issue branch September 10, 2025 15:18
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.

3 participants