Repository navigation
fix(app): key the synced-conversation pointer by the local day (#10980) - #10994
Merged
Merged
Conversation
`ConversationSyncUtils._createPointer` built the pointer's `key` from `createdAt`'s raw year/month/day. Server timestamps parse as UTC, so those are UTC fields, while the conversation list groups by `conversationLocalDayKey` over `startedAt ?? createdAt` — the local day. The pointer's key is handed straight to `ConversationDetailProvider.updateConversation` when a row on the Processed Conversations page is tapped, so whenever the two disagree (any viewer off UTC near local midnight, or a conversation whose `startedAt` and `createdAt` land on different days) the lookup found no group, the selection silently no-opped, and the detail page rendered against whatever conversation was still cached until the page's post-frame callback re-resolved the day. Fourth instance of FC-day-bucket-key-recomputed, and the last call site in the conversation-grouping family that still re-derived the key: it now calls the one authority, like #10981, #10987 and #10988. Tested: added the case to the class's existing guard file `app/test/providers/conversation_day_key_call_sites_test.dart`, which sweeps all 24 hours. `flutter test test/providers/conversation_day_key_call_sites_test.dart` passes in TZ=UTC, Asia/Kolkata, Europe/Berlin, America/Los_Angeles, Pacific/Kiritimati and Pacific/Midway, and fails (+3 -1) in every one of those zones with the lib change reverted. Full `flutter test` suite: 996 passed, 0 failed. Failure-Class: FC-day-bucket-key-recomputed
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.
Bug
On the Processed Conversations page (
synced_conversations_page.dart), tapping a synced row could open the detail page against the wrong conversation — the one previously cached — instead of the row that was tapped.Root cause
ConversationSyncUtils._createPointerbuilt each pointer'skeyfromcreatedAt's rawyear/month/day:Server timestamps parse as UTC, so those are UTC fields. The conversation list groups by
conversationLocalDayKey(startedAt ?? createdAt)— the viewer's local day. The pointer's key is handed straight toConversationDetailProvider.updateConversationon tap, which looks the day-group up by that key:The two keys disagree in two independent ways:
createdAtvsstartedAt ?? createdAt— a conversation whose start and creation land on different days misses at every offset, UTC included.On a miss the selection no-ops, so
selectedDate/_cachedConversationIdkeep pointing at the previously opened conversation andconversationOrNullresolves to it.ConversationDetailPage's post-frame callback re-resolves the day correctly, so the wrong conversation is what the page renders until that callback runs.Fix
Call the one authority,
conversationLocalDayKey(startedAt ?? createdAt)— the same function the grouper uses — and expose the pointer builder (@visibleForTesting) so the guard file can drive it.This is the fourth instance of
FC-day-bucket-key-recomputedand the last call site in the conversation-grouping family that still re-derived the key; #10981, #10987 and #10988 fixed the others. No new guard surface is added because the class already has one —app/test/providers/conversation_day_key_call_sites_test.dart— and this call site joins it.What I tested
flutter test test/providers/conversation_day_key_call_sites_test.dart— passes inTZ=UTC,Asia/Kolkata,Europe/Berlin,America/Los_Angeles,Pacific/Kiritimati,Pacific/Midway.lib/change reverted, that same file fails+3 -1in every one of those zones (including UTC, via thestartedAt/createdAtdivergence).flutter test: 996 passed, 0 failed.Not exercised on a device: reproducing the original symptom needs a real device sync producing synced-conversation pointers. Verification here is the unit-level guard through the production call site.
Failure-Class: FC-day-bucket-key-recomputed
Refs #10980
🤖 automated by hourly watchdog — tested and merged