Repository navigation
fix(conversations): settle merges and reconcile cached originals without push - #21417
aryanorastar merged 15 commits into
Conversation
…asedHardware#19247) When merging conversations, rows remained stuck in mergingConversationIds if the FCM push notification was missed or arrived in a background isolate. Probe involved conversations periodically until the merge settles on the server, or hand back to a list refresh if bounded time elapses. Failure-Class: none
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @Dragonire9 — solid, well-tested fix for the stuck "Merging…" rows (#19247). The bounded probe design in watchMerge() (4s interval, 3min limit, push-wins, hand-back-to-refresh fallback) is the right shape, and the five tests in conversation_provider_merge_watch_test.dart cover the important paths (late settle, network hiccup not mistaken for completion, push cancelling the probe, locked result, timeout). The re-check of mergingConversationIds after the awaited fetches correctly handles a push landing mid-probe, and the watcher timers are cleaned up in both clearUserData() and dispose(). The changelog fragment (app/changelog/unreleased/20261013-merge-watch-settle.json) is a nice touch.
Three items before this can merge:
- Formatting check fails:
app/test/providers/conversation_provider_merge_watch_test.dartis not dart-format clean (and is missing a trailing newline at EOF). Runningdart formatover it should resolve this. - Hygiene check fails on the product-file line-count ratchet:
app/lib/providers/conversation_provider.dartgrows 2098 -> 2201 lines against main. Either extract the merge-watch logic (watchMergeand its helpers) into its own file/mixin, or addLine-Count-Exception: app/lib/providers/conversation_provider.dart | 2098 -> 2201 | <reason>to the PR body — the current "Line-Count-Exception: none" line is rejected as malformed for this case. - Housekeeping: this branch is behind main, so the diff carries hunks (the
HomeEmptyExplanationwiring fromempty_recording_notice.dart,clearEmptyRecordingExplanation, etc.) that already landed in #21398. Rebasing onto current main will drop those duplicated hunks and leave the true delta — the merge watcher — much easier to review.
One non-blocking observation: on the deadline and locked-result paths, handBackToList() clears mergingConversationIds and forces a refresh, but if the server still reports those rows as merging, they may render as merging again from the refreshed list data. Acceptable as a bounded, rare fallback — just worth knowing it is not a guaranteed settled state.
Leaving for human maintainer review once the CI items above are addressed.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Failure-Class: none
Git-on-my-level
left a comment
There was a problem hiding this comment.
Progress since my last review: the line-count exception is now well-formed in the PR body and the Hygiene check passes, and conversation_provider_merge_watch_test.dart picked up its missing trailing newline - two of the three items done, thanks.
One blocker remains, and the fix commit missed it slightly: the Formatting check still fails at 38e5a07. CI runs dart format --line-length 120 --set-exit-if-changed, but 38e5a07 reformatted conversation_provider_merge_watch_test.dart at the default 80-column style - e.g. the ticks() helper and several expect(...) calls are wrapped onto multiple lines where 120 columns keeps them on one. Running this from app/ should make it green:
dart format --line-length 120 test/providers/conversation_provider_merge_watch_test.dart
It is only that one test file - the changelog fragment app/changelog/unreleased/20261013-merge-watch-settle.json and the provider changes in conversation_provider.dart are not affected.
Still open but non-blocking: the branch remains behind main, so the diff still carries hunks that already landed via #21398 (the HomeEmptyExplanation wiring, clearEmptyRecordingExplanation, claimDiscardedOnlyExplanation, and the empty_recording_notice.dart import in conversation_provider.dart). The content is identical to main, so this is review noise rather than a correctness risk; rebasing would leave watchMerge() and its timer bookkeeping as the whole diff, which is the part a maintainer will want to eyeball.
Once the formatting fix lands, I do not see anything else blocking on my side.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
…ine length and trailing newline (BasedHardware#19247)
|
@Git-on-my-level Thank you for spotting that! conversation_provider_merge_watch_test.dart has been updated in commit 23423b8:
Formatting check should now pass cleanly! |
Resolved: the line-count exception is now well-formed in the PR body and the Hygiene check passes at head 23423b8. The formatting item raised later (review 5526940282) was also addressed by that same head.
Git-on-my-level
left a comment
There was a problem hiding this comment.
All three items from my earlier reviews are resolved at 23423b8 — thanks @Dragonire9 for working through them.
- Formatting is green:
conversation_provider_merge_watch_test.dartis now formatted at the repo's 120-column style with the trailing newline restored. - The line-count exception in the PR body is well-formed and Hygiene passes.
- The stale #21398 hunks (the
HomeEmptyExplanationwiring,clearEmptyRecordingExplanation, and theempty_recording_notice.dartimport inconversation_provider.dart) are identical to what's already on main; the branch merges cleanly into current main, so they're review noise rather than a conflict. A rebase would makewatchMerge()the whole diff, but it's not required.
On the substance, conversation_provider.dart holds up well: watchMerge() probes each involved id via _conversationLifecycleFetcher behind a re-entrancy guard, re-checks mergingConversationIds after the awaits so a push landing mid-probe wins, reuses the existing _isActiveProcessingStatus so a merged summary still processing isn't mistaken for completion, settles through onMergeCompleted(..., merged:) without a duplicate fetch, and hands back to forceRefreshConversations() on the 3-minute deadline or an unreadable (402/404) result. Watcher timers are cancelled in both clearUserData() and dispose(). The five tests in conversation_provider_merge_watch_test.dart cover the meaningful paths (late settle, network hiccup, push-first, locked result, timeout), and the changelog fragment 20261013-merge-watch-settle.json matches the shipped behavior.
Nothing blocking on my side — leaving the merge decision to a human maintainer.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What changed and why
Closes #19247 and #20603. Manual merge must finish in the running app without depending on push, and a completed result must not retain cached original rows. All manual admissions now use the existing durable merge coordinator regardless of the broader lifecycle canary. The admitted target ID remains stable through partial cleanup/retry; authoritative transfer receipts prevent already-incorporated originals from being merged again, while ordinary semantic duplicate hints retain merge eligibility. Capture/transcription rollout behavior is unchanged.
The client uses typed source absence and target readiness, journals IDs by account/backend, and commits list/search/pagination/cache changes together. Cache transactions, page-cache writes and merge-journal retirement are serialized; concurrent completions retain both targets after offline reopen, failed transactions remain retryable, and queued work rechecks account/backend ownership. Merges still processing after the fast polling window remain observed at a lower bounded rate. A read failure or locked response never proves deletion, and observation never resubmits a merge.
This extends Dragonire9's existing PR, preserving the contributor commits. Main's #21544 already covers the source-deletion propagation proposed by #21525; current-owner tests preserve that guard. No contributor PR is closed and no bounty is accepted or promised.
Verification
Technical readiness and release
Final diff review, local integration evidence and required exact-head CI pass at f66450e. The PR remains draft for maintainer review; it has not been merged or deployed. Customer confirmation is not a technical readiness or GitHub-closure gate.
Deploy the additive backend response before mobile release. No LIFECYCLE_V2_MODE serve-cohort change is needed for manual merge correctness. Existing finalization recovery infrastructure remains required (production runtime manifests already declare the conversation-finalization Cloud Tasks queue). This PR does not change production configuration, deploy, merge, or mutate customer records.
Support separately owns historical-account investigation and post-release customer confirmation; those remain in the support tracker and do not keep a verified technical fix open on GitHub.
Product invariants affected
none
UI-Evidence: none -- No layout/control code changed. The local HTTP journey renders the production row and verifies only the completed target remains without a merging overlay in foreground, reopen, delayed completion and concurrent-completion offline reopen.
Failure-Class: new
Failure-class transition narrative
FC-merge-completion-depends-on-push records the demonstrated contract: a best-effort push is not a completion authority. Its reusable guard is typed target/source observation and a shared provider/cache commit; behavioral provider and HTTP journey tests cover recurrence. Durable manual admission removes the legacy recovery bypass rather than adding another recovery owner.
Line-Count-Exception: app/lib/providers/conversation_provider.dart | 2197 -> 2420 | Keep canonical admission/projection ownership in the established owner; bounded observation and journal serialization live in small separate services.