Repository navigation
fix: stop the follower grouping test failing just after midnight - #924
Merged
mnapoli merged 1 commit intoOct 22, 2026
Merged
Conversation
simonhamp
marked this pull request as ready for review
October 21, 2026 13:26
Member
|
Are the failing tests related? Else sounds like an easy merge |
Contributor
Author
|
no, test fails here are because of the maintenance page |
NotificationGroupsQuery never groups follows across days, and "keeps stars and conversations apart while grouping followers" made its two follows 2 and 1 minutes before now. Run between 00:01 and 00:02 UTC, they land on different days and come back as two follow groups. The test now starts at noon. Pinning the clock wasn't enough on its own: travelTo() with a callback goes back to the real clock afterwards, so the first starAt() dropped the pin. The helpers and the two mention lines use Date::withTestNow() instead, which puts back whatever clock was set before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simonhamp
force-pushed
the
fix/flaky-follow-groups
branch
from
October 22, 2026 10:38
2736d2e to
5ed9f75
Compare
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.
keeps stars and conversations apart while grouping followersinNotificationGroupsQueryTestfails when CI runs it between 00:01 and 00:02 UTC. It happened on #738 at 00:01 on 21 October, after production had passed the same code before midnight.NotificationGroupsQuerynever groups follows across days. The test makes its two follows 2 and 1 minutes before now, so in that minute they land on either side of midnight and come back as twofollowedgroups instead of one.The test now starts at noon. A pin at the top wasn't enough by itself:
travelTo()with a callback sets the clock back to real time when the callback returns, not to the time set before it. So the firststarAt()dropped the pin and the rest of the test ran on the real clock again. ThestarAt,replyAtandfollowAthelpers and the two mention lines now useDate::withTestNow(), which puts back whatever clock was set. (Rector prefers theDatefacade toCarbon::here.)Things to look at
Pest.phpafter calling a helper. Before, they ran on the real clock from the first helper call onward. They pass either way.counts unread groups that began before the oldest unread notification...andcounts the same unread groups as grouping the whole history). Their follows can also fall on different days at some times of night, but their assertions hold either way, so I left them alone.Testing
To check it without waiting for midnight, I faked the process clock for a run with a temporary
Date::use()class whosenow()adds an offset when no test clock is set. At a simulated 00:01:00, 00:01:30 and 00:01:59 UTC the old file fails with the same twofollowedgroups as CI, and pinning the test without changing the helpers fails the same way. The fixed file passes at those times, at 02:40, 04:45 and 23:59:30, and on the real clock. Pint and Rector are clean.