Repository navigation
fix(app): resolve the conversation detail page by local day key (#10976) - #10981
Merged
kodjima33 merged 2 commits intoAug 1, 2026
Merged
Conversation
`ConversationDetailProvider.conversationOrNull` validated the selected conversation by comparing its raw UTC year/month/day against `selectedDate`. `selectedDate` is a group key produced by `conversationLocalDayKey`, i.e. the *local* calendar day — so the two disagree for every timestamp whose local day differs from its UTC day: an evening conversation for a UTC+ viewer, a post-UTC-midnight one for a UTC- viewer. The getter then reported a miss for a conversation that is present in the selected group, blanking the detail page the user just tapped (and throwing `StateError` from the non-null accessor on the gesture paths). This is the same contract #10398 fixed for grouping, broken again in the consumer: compare through `conversationLocalDayKey` on both sides. The existing regression test pinned one absolute timestamp, so it only tripped at some UTC offsets — red on a UTC+5:30 machine, green in UTC CI, which is how this reached main. It now sweeps all 24 hours, which exposes the bug at every non-zero offset (it is unobservable, and the code correct, at UTC exactly). Tested: `app/test.sh` (987 tests) green in local (UTC-4) and in TZ=UTC; the single file green in UTC, Asia/Kolkata, America/New_York, Europe/Berlin, Pacific/Auckland, Pacific/Kiritimati, Pacific/Midway, Australia/Adelaide; and with the lib change reverted the new test fails in every non-UTC zone tried. Failure-Class: new
The two-conversation fixtures pinned 09:00 and 11:00 UTC and then asserted a single day group. At extreme offsets (UTC+14, UTC-11) those two instants land on different local days, so `keys.single` threw `Bad state: Too many elements` before any assertion ran — a pre-existing failure on main, unrelated to the getter fix, found while sweeping timezones for it. Anchor them to a fixed *local* day instead, so they share a group at any offset while still being UTC instants like real server data. Tested: this file green in UTC, Asia/Kolkata, America/New_York, Europe/Berlin, Pacific/Auckland, Pacific/Kiritimati, Pacific/Midway, Australia/Adelaide (it failed in the last two before this commit).
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 3/5
- In
app/lib/pages/conversation_detail/conversation_detail_provider.dart, the fallback assignment inConversationDetailPageappears to use non-normalized conversation dates, so detail pages for conversations missing from the current grouped list can reject valid cached data around UTC midnight, causing users to lose access to that thread until refresh/reload—align the fallback with the same date normalization used byconvers...to remove the boundary-time mismatch.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/lib/pages/conversation_detail/conversation_detail_provider.dart">
<violation number="1" location="app/lib/pages/conversation_detail/conversation_detail_provider.dart:95">
P1: Detail pages opened for a conversation absent from the current grouped list can now reject their cached conversation again near UTC midnight. Normalize the fallback assignment in `ConversationDetailPage` with `conversationLocalDayKey(effectiveDate)` so this validator receives the same group key.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| if (effectiveDate.year == selectedDate.year && | ||
| effectiveDate.month == selectedDate.month && | ||
| effectiveDate.day == selectedDate.day) { | ||
| if (conversationLocalDayKey(effectiveDate) == conversationLocalDayKey(selectedDate)) { |
There was a problem hiding this comment.
P1: Detail pages opened for a conversation absent from the current grouped list can now reject their cached conversation again near UTC midnight. Normalize the fallback assignment in ConversationDetailPage with conversationLocalDayKey(effectiveDate) so this validator receives the same group key.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/lib/pages/conversation_detail/conversation_detail_provider.dart, line 95:
<comment>Detail pages opened for a conversation absent from the current grouped list can now reject their cached conversation again near UTC midnight. Normalize the fallback assignment in `ConversationDetailPage` with `conversationLocalDayKey(effectiveDate)` so this validator receives the same group key.</comment>
<file context>
@@ -84,15 +84,15 @@ class ConversationDetailProvider extends ChangeNotifier with MessageNotifierMixi
- if (effectiveDate.year == selectedDate.year &&
- effectiveDate.month == selectedDate.month &&
- effectiveDate.day == selectedDate.day) {
+ if (conversationLocalDayKey(effectiveDate) == conversationLocalDayKey(selectedDate)) {
return _cachedConversation = result;
}
</file context>
kodjima33
deleted the
watchdog/issue-10976-conversation-detail-local-day
branch
August 1, 2026 16:05
This was referenced Aug 1, 2026
kodjima33
added a commit
that referenced
this pull request
Aug 1, 2026
… (#10994) `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.
Fixes #10976.
Bug
Opening a conversation whose local calendar day differs from its UTC day blanks the detail page.
ConversationDetailProvider.conversationOrNullreturns null for a conversation that is present in the day group the user just tapped, and the non-nullconversationaccessor throwsStateErroron the gesture paths (delete / rename / visibility).It bites an evening conversation for any UTC+ viewer and a post-UTC-midnight one for any UTC- viewer — i.e. a slice of every day for most of the world.
Root cause
The list groups by
conversationLocalDayKey(startedAt ?? createdAt)— the local calendar day (that function exists because bucketing by raw UTC filed early-morning-local conversations under the previous day, #10198 / #10398).conversationOrNullthen validated the resolved conversation by comparing the effective date's raw UTCyear/month/dayagainstselectedDate, which is one of those local-day group keys. Two different derivations of the same bucket, so they disagree exactly when local day != UTC day.Same contract #10398 fixed for grouping, broken again in the consumer.
Fix
Compare through
conversationLocalDayKeyon both sides. One expression, no behavior change where the two already agreed.Why CI stayed green
The existing regression test pinned one absolute timestamp (
2026-07-18 23:30Z). That only trips the bug at some UTC offsets — red on a UTC+5:30 machine (how #10976 was found), green in UTC CI. The test now sweeps all 24 hours of a day, which exposes it at every non-zero offset. At UTC exactly the bug is unobservable and the old code correct, so no fixture can catch it there.Second commit: the two-conversation fixtures in the same file pinned 09:00/11:00 UTC and asserted one day group — at UTC+14 / UTC-11 those land on different local days and
keys.singlethrew before any assertion. Pre-existing red onmain, unrelated to the getter, found while sweeping. Anchored to a fixed local day instead.Tested
app/test.sh— 987 passed, in localAmerica/New_York(UTC-4) and inTZ=UTC.flutter test test/providers/conversation_detail_provider_selection_test.dartgreen inUTC,Asia/Kolkata,America/New_York,Europe/Berlin,Pacific/Auckland,Pacific/Kiritimati,Pacific/Midway,Australia/Adelaide.lib/hunk turns it red inAmerica/New_York,Asia/Kolkata,Europe/Berlin,Pacific/Auckland(and green inUTC, as expected).make preflightgreen.Not exercised in a running app build — the assertion drives the production getter through the same seam the detail page uses.
Product invariants affected
none
Failure class (fixes)
Failure-Class: new
Registers
FC-day-bucket-key-recomputed: a derived day-bucket key has one authority, and a consumer that re-derives it from raw UTC calendar fields reads a present record as absent for every viewer whose local day differs. Second instance of the cause behind #10398, so it gets a registry entry with a guard artifact (the sweeping contract test) rather than another one-off declaration.🤖 automated by hourly watchdog — tested and merged