fix: refresh relative timestamps after midnight#481
Conversation
Refresh chat and message timestamp projections when the calendar day changes or the app returns to the foreground. Keep formatting outside ordinary row renders and cover the day-boundary transition with a regression test. Fixes #470
Walkthrough
ChangesTimestamp refresh
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit efc1e5a on Jul 12, 2026 4:07am UTC. |
agent-p1p
left a comment
There was a problem hiding this comment.
Pip adversarial review
Verdict: APPROVE — no blocking findings. Submitted as a comment because agent-p1p cannot formally approve its own PR.
Blocking
None.
Suggestions
whitenoise-mac/Models/MessengerModels.swift:124-126, 177-180, 1578-1580, 1680-1700, 1817-1819— the displayed chat/message labels now always come from the new(at:locale:)methods behind equatable view boundaries. The old storedtimestampLabel,timeLabel, andmetadataLabelprojections are no longer read by production views, but are still computed and compared; their comments also still claim they are the render-time optimization. Consider removing this redundant state/equality work, or document the remaining non-view reason for retaining it. The current behavior is correct, but this leaves two competing label representations.whitenoise-macTests/whitenoise_macTests.swift:3037— strengthen the chat-row regression from!= expectedTimeto the exact expected weekday label. The next-day reference remains in the same week, so asserting the specific weekday branch would guard the sidebar behavior as precisely as the message assertion guards the abbreviated date-time branch.
Nitpicks
whitenoise-mac/Views/SidebarViews.swift:518-525—ChatTimestampText's synthesized equality compares the entireChatItem, although onlyupdatedAt,referenceDate, andlocaleaffect the formatted label. A narrower input/key would express the invariant and avoid reformatting when unrelated chat fields change.whitenoise-mac/Views/MessageMediaViews.swift:78-79— the defaultDate()/locale inputs are unnecessary at the production call site and can silently create a fresh equality key for future callers. Requiring explicit inputs would make the daily refresh contract clearer.
Verification
- Reviewed the six-file diff at
a4289d2ebda5f12b7eb52d704632a0bf29a58b5bagainst stacked basepip/whitenoise-mac-457-v2. git diff --checkpasses.- GitHub Mac CI is green: strict Swift format, project sanity, 421 tests across two suites, and release arm64 smoke build.
- Static Analysis is green.
- The
NSCalendarDayChangedpath covers an active app; thedidBecomeActivesame-day guard covers a day crossed while inactive. The reference date participates in both message-row and sidebar equatable inputs, so the labels actually invalidate at the boundary. - Sensitive paths touched: none.
Remove stale mapping-time labels, narrow the sidebar's equatable timestamp inputs, require explicit message-row clock inputs, and assert the exact weekday transition in the regression test.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Addressed the adversarial review suggestions in efc1e5a:
Mac CI and static analysis pass. The fresh CodeRabbit review generated no actionable comments. |
Fixes #470
Summary
NSCalendarDayChanged.Verification
git diff --check— passed.masterin media-cache tests outside this diff. This PR is stacked on the green stabilization PR fix: stabilize media cache CI tests #464 so its own CI can run against the corrected test harness.xcodebuildandswiftare absent).Stack
pip/whitenoise-mac-457-v2)master; the Bug: precomputed relative timestamp labels (ChatItem.timestampLabel / MessageItem.timeLabel) never refresh across a day boundary, so "today" times stay stale after midnight #470 diff is limited to the six files shown here.Sensitive paths
None.
Summary by CodeRabbit
Bug Fixes
Tests