Skip to content

Lock in 2.x's resilience to the #296 cron date bug - #302

Merged
GaryJones merged 1 commit into
2.xfrom
fix/timezone-docblock-and-test
May 19, 2026
Merged

GaryJones merged 1 commit into
2.xfrom
fix/timezone-docblock-and-test

Conversation

@GaryJones

Copy link
Copy Markdown
Contributor

Summary

#296 reported that incremental sitemap updates silently stopped on negative-offset timezones in 1.5.4. The cause was a local-time round trip through get_gmt_from_date() that re-applied the site offset and pushed the cutoff into the future. PR #297 fixed that on develop.

While reviewing whether the same fix needed porting to 2.x, I found that the equivalent function — PostRepository::get_modified_posts_since() — already uses gmdate() directly and skips the local-time round trip. The refactor accidentally fixed the bug. Nothing currently guards against a future refactor reintroducing it, though: the existing test_get_modified_posts_since runs in the default UTC timezone, and the broader TimezoneTest is markTestSkipped'd pending its own DDD refactor (with a @todo to that effect).

This PR adds a regression guard in America/New_York so the absence of the bug is a tested property rather than a happy accident.

It also clarifies the msm_pre_get_last_modified_posts filter docblock to specify that the $date argument is UTC. The 1.x docblock had the same vague wording and contributed to the confusion that produced the original bug — worth fixing while we're here.

No production behaviour changes.

Test plan

  • Integration tests pass in CI, including the new test_get_modified_posts_since_finds_posts_in_negative_offset_timezone
  • Confirm the new test would have failed against the pre-Fix date handling in get_last_modified_posts function #297 1.5.4 implementation (negative-offset cutoff was pushed into the future, so the assertion would fail)

2.x's PostRepository::get_modified_posts_since() already sidesteps the
1.5.4 cron date-handling bug because the refactor switched to gmdate()
and dropped the get_gmt_from_date() round trip. Nothing currently locks
that in, though: the existing test runs in UTC and the 2.x TimezoneTest
is markTestSkipped pending a wider DDD refactor. Add a negative-offset
test (America/New_York) so a future refactor cannot silently reintroduce
the local-time round trip.

Also clarify in the msm_pre_get_last_modified_posts filter docblock that
the $date argument is UTC. The 1.x docblock had the same vague wording
and it contributed to the confusion that produced the original bug.
@GaryJones
GaryJones requested a review from a team as a code owner May 19, 2026 18:22
@GaryJones GaryJones added this to the 2.0.0 milestone May 19, 2026
@GaryJones GaryJones self-assigned this May 19, 2026
@GaryJones GaryJones added the type: bug Something isn't working label May 19, 2026
@GaryJones
GaryJones merged commit 38a7599 into 2.x May 19, 2026
7 checks passed
@GaryJones
GaryJones deleted the fix/timezone-docblock-and-test branch May 19, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant