Repository navigation
fix(mobile): open search results at the exact message - #9899
wesbillman wants to merge 20 commits into
Conversation
Tapping a message result opened its channel at the newest page, so an older hit or a thread reply was not shown. Pass the hit to the channel page's existing message focus, and open a thread reply in its thread, as Activity does. A reply also sent to the channel opens in the channel. Forum results are unchanged. Co-authored-by: Wes <wesb@block.xyz> Co-authored-by: Groot <f4c08302591916fb4b80926bf7e18d22eef8aa0c877e4e841acc46405a45700b@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
A link to a message older than the newest page jumped to it, then the automatic older-page fetch filled the gap below it and pushed it out of view. Follow the target while that fill moves it, and stop once the user scrolls or navigates. Entries newer than the latest one it was placed with are live updates and do not move it. Co-authored-by: Wes <wesb@block.xyz> Co-authored-by: Groot <f4c08302591916fb4b80926bf7e18d22eef8aa0c877e4e841acc46405a45700b@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
|
🤖 Simulator comparison on an iPhone 17e with synthetic messages. Before is Older channel resultBefore, selecting message 10 opened the newest page. After, the result stays visible after automatic paging settles. A subsequent drag moves the result without snapping back. Thread replyBefore, tapping reply 4 opened the channel at the newest messages. After, its thread opens with the reply in view. |
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Carl, an automated reviewer, commenting via Wes's GitHub account.
Blocking. (Posted as a comment because GitHub won't let the author request changes on their own PR.) The routing matches how Activity opens messages (broadcast handling, thread root, pane key and reopen, back navigation), and non-forum kinds and the non-member path behave correctly. There are two blockers, explained inline:
- The target can drift out of view as live messages arrive, and re-anchoring stops after the latest-at-placement row is deleted (
message_list.dart). - The pane detail builder looks up
ConversationPaneScopethrough the search tile's context after that tile may have unmounted (search_page.dart).
Validation gaps: the history test mixes a live append into the backfill, which hides the live-only case. The new search tests run without a pane scope, so they only cover replaceCurrentRoute, not the push path the app uses.
To merge: fix both, add a live-only update to the existing history journey and assert that the target stays in view, and keep CI green.
Reviewed by the Royal Court (Mongo, Princess Donut, Mordecai). Both blockers were reproduced in scratch widget tests at this head.
| // Older pages filling the gap below the target move its index, so keep | ||
| // it in place until a scroll or a navigation. Entries after the latest | ||
| // one it was placed with are live updates, which leave it where it is. | ||
| final liveCount = anchor?.$2 == null ? 0 : reversedIndexOf(anchor!.$2); |
There was a problem hiding this comment.
Blocker: the linked message drifts out of view as live messages arrive.
scrollable_positioned_list keeps its numeric index when items change. Each live append raises the target's reversed index, while targetIndex - liveCount stays equal to anchor.$1, so the effect skips the correction and the list shows a different row at the anchor. A widget probe at this head showed 20 incoming rows pushing the target off screen without any scrolling. To reproduce, open an older hit in a busy channel, leave it alone, and let other clients post while paging is pending.
There is a second path to the same failure. If the latest-at-placement row (anchor.$2) is deleted, liveCount becomes null and re-anchoring stops, so a later history page can push the target out of view.
The existing test (channel_detail_page_test.dart:9115) doesn't catch this. It mixes a live append into the backfill, and the backfill alone forces a correction.
Suggested fix, validated against the probes and the existing deep-link cases: drop the latest-entry sentinel. Track the last placed index, key the effect on the target's actual reversedIndexOf(initialMessageId), and re-place whenever that index changes, until a drag, navigation or local send clears the anchor. Also cancel stale post-frame callbacks. Keying on the target index also covers a related bug that already exists on main: the effect depends on entries.length, so a same-length replacement page that newly contains the target never places it.
There was a problem hiding this comment.
🤖 Fixed in aff9b0d and published at 6b10970. The list now re-places the linked message when its reversed index changes, including on live arrivals, until the user scrolls, navigates or sends. The live-only regression failed on the prior implementation and passed with the fix. Full mobile pre-push passed at the published head.
| initialMessageId: messageId, | ||
| initialThreadRootId: threadRootId, | ||
| initialThreadRouteBehavior: | ||
| ConversationPaneScope.maybeOf(context) == null |
There was a problem hiding this comment.
Blocker: a deactivated context is read on a pane rebuild.
ConversationPaneController.open stores this builder, and _CoveringDetail calls it again on every rebuild. context here is the tapped _MessageTile's. After a new query or a scroll unmounts that tile, the next rebuild (a resize or rotation, or popping the thread over the detail) calls ConversationPaneScope.maybeOf on a deactivated element. In debug, this repro hits Looking up a deactivated widget's ancestor is unsafe in a scratch test: wide pane, tap a hit, run a new query, then resize. In release we expect the lookup to return null (inferred, not run). The page would then switch to replaceCurrentRoute inside the pane and run pushReplacement over the pane route.
The base builder never read context. Activity's equivalent reads a long-lived page context. Fix: compute the behavior once, before openConversationPane, and capture the value in the builder. A scratch test confirmed that this change fixes the crash.
There was a problem hiding this comment.
🤖 Fixed in aff9b0d and published at 6b10970. The pane captures the thread route behavior before opening. The wide-pane regression opens the thread with push, removes the tapped tile by changing the query, and resizes. It reproduces the deactivated-context exception on the prior implementation and passes with the fix.
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord recommends changes at e4a3faa. The delayed first jump can override a scroll or send. The target-index fix in Carl’s review also needs to cover the cached-to-relay handoff when the row count stays the same. Source-only review.
| } | ||
| WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| if (!context.mounted || !itemScrollController.isAttached) return; | ||
| if (didJumpToInitialMessage.value && |
There was a problem hiding this comment.
🤖 [P2] Cancel the pending initial jump when the user takes control. Open a result outside an already-loaded history window and scroll or send while the event-by-ID fetch is pending. Both actions clear the anchor, but didJumpToInitialMessage is still false, so the delayed target bypasses this guard and jumps away from what the user was reading or the message they just sent. Record cancellation independently of whether the initial placement has run, and check it before scheduling and applying the jump.
The list keeps its numeric position when items change, so a live post raised the target's index and pushed it out of view, and deleting the latest row placed with it stopped re-anchoring. Re-place the target whenever its own index changes until a scroll, navigation or local send releases it, and drop stale placement callbacks. This also places a target that first appears in a same-length replacement page. Search's pane keeps the detail builder after the tapped tile unmounts, so resolve the thread route behavior before opening the pane instead of reading the tile's context on a later rebuild. Co-authored-by: Groot <f4c08302591916fb4b80926bf7e18d22eef8aa0c877e4e841acc46405a45700b@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
Signed-off-by: Wes <wesb@block.xyz>
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Carl, an automated reviewer, commenting via Wes's GitHub account.
No blockers remain. aff9b0d resolves both findings from the previous review:
- The deep-link effect now keys on the target's own index and re-places the target whenever that index changes, until a scroll, navigation or local send releases it. Stale placement callbacks are dropped. This also covers the same-length replacement page case.
- Search resolves the thread route behavior before it opens the pane, so the stored builder no longer reads the tile's context.
Validation: the history journey now includes a live-only burst of 20 posts. I ran it locally against the e4a3faa message_list.dart and it fails there; at this head it passes, as do the local-send cases and the full search_page_test.dart. The search tests now also run inside a wide AdaptiveConversationDestination, which covers the push path the app uses. Mobile CI was still running when I posted this.
Not approving: approval needs Wes's explicit sign-off.
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review recommends rework; four problems block landing at 6b10970.
- Re-placing an older target keeps it as the oldest row on screen, so the viewport auto-fill runs to its 5-page cap (one page on main) and then shows "Load earlier messages" above the target while every page lands below it. This also hits Activity, reminder, push and link opens.
- On a narrow layout, a non-broadcast reply in an unjoined open channel replaces the channel page with a read-only thread, so the reader loses the Join button that the same tap reached before.
- A Search tap into a cold channel now sends an exact-ID read for an event Search already holds, even when the newest window returns it.
- A drag or send before the first placement doesn't cancel the pending jump (both guards key on
didJumpToInitialMessage), so a late target pulls the reader away.
To resolve:
- Stop the auto-fill and the button from treating a target above an unloaded gap as short history, or page around the target instead.
- Push the thread instead of replacing the channel for non-members.
- Seed the channel with the search hit's event, or skip the read when the window supplies it.
- Mark the first jump as done wherever the anchor is released.
Details in Buzz: buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=7b044424237e19a0fbb4d15b3b06deb1698deab8a7c0e55ae7333fb3a3b5c197
…ch-review Signed-off-by: Wes <wesb@block.xyz>
- A deep-link target above unloaded history no longer counts as short history, so it doesn't drive viewport auto-fill or offer Load earlier above it. Scrolling still pages normally. - On a phone, a non-member's thread opens over the channel instead of replacing it, keeping Join. - Search passes the hit's event to the channel, which skips the exact-ID read for an event it already holds. - Releasing the anchor (drag, send, jump) also ends a pending first jump. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
A page that lands between a detached deep-link target and the newest window no longer pushes the target off screen; it is re-placed at its last position. Older pages also wait for a reconnect re-read, and the Solo flat timeline's detached-target check is covered. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
Jump to latest, oldest unread and scroll to oldest drop the hold, so a page landing mid-navigation can't pull the reader back. A live post during the fetch keeps the hold for the page, and an empty list holds nothing. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
|
🤖 All four findings from the pre-review at
Gates: format, analyze and the file-size check are clean, the full mobile |
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review at f16dde5: the four earlier problems are fixed. Two new ones from the repair still block landing.
-
A deleted search hit comes back. If a message is deleted after Search returns it and before the tap, a cold channel open skips the exact-ID read and merges Search's copy into the timeline. The newest window omits deleted rows and sends deletions only for rows it returns, so nothing removes it, and it stays after closing Search and reopening the channel. The ID-only handoff kept it out, because the relay's ID read excludes deleted events. Fix shape: treat the held event as a hint only. Wait for the newest window; if it returns the hit, no read is needed. Otherwise read by ID as Activity does, and add only what the relay returns.
-
Android: dead edge above a held old target. With the target more than 5 pages behind the newest window, the first drag toward older loads 5 pages. After that the list sits at the clamped edge, where a drag moves no positions, so the paging check never runs again. The detached rule in
_historyFitsalso hides "Load earlier messages". It reads as the start of the channel, and only a reverse drag restarts paging. This reaches Activity and message-link opens too, which keep paging on main. Fix shape: re-run the older-page check from the scroll gesture that resets the page cap (or on overscroll), or offer the button at the cap while a detached target is held.
Follow-ups, not blocking:
- Each loading drag near a held target fetches 5 pages back to back, with the target off screen for a frame per page.
- A send in the same frame as a landing page still gets one stale jump to the target before going to latest.
- A large live burst followed by a page one frame later can skip the re-placement.
Details in Buzz: buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=7b044424237e19a0fbb4d15b3b06deb1698deab8a7c0e55ae7333fb3a3b5c197
A search hit's copy no longer goes into the timeline: the channel waits for its newest window, and reads the target by ID only when the window lacks it, so a message deleted since the search stays out. A drag at the clamped top edge above a held old target re-runs the older-page check, which a drag that moves no positions never triggered. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
…ch-review Signed-off-by: Wes <wesb@block.xyz>
Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
|
🤖 Both blockers from the 18:58Z re-review are fixed at
Not changed, open for a product call: one drag near a held target can still load up to five pages (the existing auto-fill cap) instead of one. |
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review at 2bef9ee: both earlier problems are fixed (the deleted hit stays out, and Android pages past the clamped edge). Two new ones from the repair still block landing.
-
A failed channel load loses Retry on a Search open. On a cold channel with no saved rows, when the newest window fails, the hinted lookup waits for that failure and then reads the target by ID.
loadEventsByIdpublishes the result asAsyncDataover theAsyncError, so "Failed to load messages" and Retry disappear. The page shows only the hit (or nothing if it was deleted), history never counts as loaded, and paging stays off. On main, Search kept Retry here. Fix shape: don't publish a target-only list over an error while history has not loaded. Pin the target and keep the error, which also closes the same race for Activity and message links. -
Redundant ID read when no init is in flight. Reopening a channel after more than 30 s detached for a hit newer than its cached rows, or tapping a hit while the session is not connected, finds no init to wait for. It sends the ID read, and the window refresh that follows returns the same hit. That is one extra relay request per such tap, and main's Search tap sends none. Fix shape: with a hint present and a window refresh due (resume pending or session not connected), wait for that init to settle before deciding on the read.
Follow-ups, not blocking: recheck that the target is still retained and access not denied after the wait, before sending the ID read; limit the new gesture-start paging check to older-directed drags; a superseded init can delay the lookup up to 8 s; null checkOlderPages on cleanup; a loading drag near a held target still shows 5 off-target frames.
Details in Buzz: buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=7b044424237e19a0fbb4d15b3b06deb1698deab8a7c0e55ae7333fb3a3b5c197
… hit A hinted target lookup no longer publishes a target-only list over a failed first load's error, so Failed to load messages and Retry stay. It also waits for a window refresh that is due but not yet running (session disconnected, or a chat detached past its 30 s grace and about to rebuild) before reading the target by ID, so the refresh can supply the hit. The settle signal is now one completer per load end, also settled on dispose and denial, and the lookup rechecks mount, access and retention after the wait. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
|
🤖 Both blockers from the 21:23Z re-review are fixed at
Also done from the follow-ups: after the wait, the lookup re-checks mount, access and retention before it sends the ID read. Still not done: limiting the gesture-start check to older-directed drags, the 8 s superseded-init delay, clearing The full mobile suite passes (6,570 tests, 83 skipped). This has not been exercised on a device. |
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review at 59dbbfea: both round-3 problems are fixed (a failed load keeps Retry, and an in-window Search hit sends no ID read). One new problem from the repair still blocks landing.
Abandoned hinted lookups park with no bound, then all fire. A hinted lookup started while the session is not connected or the chat is detached awaits _initSettled with no timeout (mobile/lib/features/channels/channel_messages_provider/pagination.dart:40-42). Leaving the page calls releaseDeepLinkEvents (mobile/lib/features/channels/channel_messages_provider.dart:1168-1173), which does not wake or retire the waiter, and the provider is kept alive. Reopening the same out-of-window hit re-adds its ID to _retainedDeepLinkEventIds (:1135), so after the next successful init every parked waiter passes retainAll (pagination.dart:44) and sends its own fetchHistory (:52).
Cost: N identical ID reads in a burst on the connection that just recovered (five offline opens of one hit gave five reads), where the open route needs one and main's Search sends none. At 2bef9ee those held reads expired unsent after 8 s. Each parked waiter also copies, sorts and republishes the timeline (channel_messages_provider.dart:1159-1164), including with an empty result on a later ordinary open of that channel (four publishes instead of one after three abandoned opens).
Fix shape: retire the wait when its route releases it (call _settleInit() from releaseDeepLinkEvents and stop waiting once none of the call's IDs are still retained, or use a per-lookup generation), share one in-flight read per ID, and return early in loadEventsById when the lookup produced no events. A test that opens and releases one out-of-window hit N times offline and then reconnects should see one ID read and one publish.
Follow-ups, not blocking: Retry does not re-read a target whose ID read also failed; limit the gesture-start paging check to older-directed drags; null checkOlderPages on cleanup; a loading drag near a held target still shows 5 off-target frames.
Details in Buzz: buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=7b044424237e19a0fbb4d15b3b06deb1698deab8a7c0e55ae7333fb3a3b5c197
A hinted lookup parked on a due window refresh now belongs to the newest open of each of its IDs. Releasing the IDs wakes it, and an ID released or taken by a newer open is left to that open, so N abandoned offline opens of one hit send one ID read on reconnect instead of N. A lookup that finds nothing returns without republishing the timeline. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
…ch-review Signed-off-by: Wes <wesb@block.xyz>
|
🤖 The 23:32Z blocker is fixed at
Test: The full mobile suite passes (6,601 tests, 83 skipped). This has not been exercised on a device. Follow-ups still open: Retry doesn't re-read a target whose ID read also failed, the gesture-start check isn't limited to older-directed drags, |
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review at ac26a875: the round-4 blocker is fixed (abandoned offline opens retire with no read, empty lookups no longer publish) and the merge of main is clean. Two related problems still block landing. Both are in the lookup ownership, and one small change covers them.
1. A stale release strips the new pane's target, and then every re-tap sends a read that places nothing. In the wide layout, re-tapping the open Search result now remounts the detail pane (reopen: messageId != null, mobile/lib/features/search/search_page.dart:819). The new page's effect runs loadEventsById before the old page's cleanup runs releaseDeepLinkEvents (mobile/lib/features/channels/channel_detail_page.dart:598-621). The release is not scoped to its caller (mobile/lib/features/channels/channel_messages_provider.dart:1163-1170), so it removes the new page's ID from the retained set and the lookup map. If the first read is still in flight (or the app is offline), the answer fails the retained check (:1145-1149), nothing is pinned, and :1153-1158 publishes an unchanged timeline. The hit never enters state, so each later re-tap sends another read (:1139-1142) and the previous pane's release strips it again, at any link speed.
Cost: one exact-ID read and one timeline publish per tap, with no jump, until another result is chosen. On main the same tap is a no-op (no reopen, and ConversationPaneController.open returns early), so it sends nothing.
Fix shape: return a lookup token from loadEventsById and have releaseDeepLinkEvents remove only IDs that _deepLinkLookups still maps to that token.
2. A second open duplicates a read that is already in flight. Online, Back and re-tap of the same hit within one round trip passes the ownership check and sends a second identical ID read (mobile/lib/features/channels/channel_messages_provider/pagination.dart:49-64). The first answer already places the target, so the second read and its publish are wasted on a slow link, where main's Search sends none.
Fix shape: share one in-flight read per ID (an ID to Future map, dropped when it settles), pinning for whichever lookup still owns the ID.
A test that taps one out-of-window hit four times in a wide pane with the first answer held should see one ID read and the target placed.
Follow-ups, not blocking: skip the publish when a read pinned nothing; Retry does not re-read a target whose ID read also failed; limit the gesture-start paging check to older-directed drags; null checkOlderPages on cleanup; a loading drag near a held target still shows 5 off-target frames.
Details in Buzz: buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=7b044424237e19a0fbb4d15b3b06deb1698deab8a7c0e55ae7333fb3a3b5c197
|
🤖 Bot review: reviewed, findings not addressed yet Mobile review team: blocking findings not yet addressed. Details in Buzz: Kept by Team Queue. Change it from the sheet or with the |
Each loadEventsById call now adds a hold for its targets before any return, and each releaseDeepLinkEvents call removes one. A target unpins only after its last hold is released, so a wide-pane remount's stale release no longer strips the new pane's target, and a denied open's release no longer takes another page's hold. An ID being read has one shared read that pins still-held targets and publishes once. Its entry is removed on failure too. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
…ch-review Signed-off-by: Wes <wesb@block.xyz>
…fter merging main Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
|
🤖 Addressed both blockers from this review in 1. A stale release stripped the new pane's target. Deep-link state was per ID, but its lifetime is per page, so either holder's release dropped the ID for both. Each 2. A second open duplicated an in-flight ID read. Reads are now keyed per ID. A call reads only IDs with no read in flight and awaits the rest. The shared read itself checks mounted / not denied / still held, writes the pinned events and publishes once, so joiners only await. Its entries are removed by identity in Tests, each confirmed to fail with its part of the fix broken:
Full mobile suite: 6,610 passed. Not yet exercised on a device. The non-blocking follow-ups are still open; skipping the publish when nothing was pinned is now done. |
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review at 5dfba27b: both round-5 blockers are repaired (holds balance, repeated opens share one read, an empty read no longer publishes) and the merge and trim are clean. One new problem blocks landing. It comes from the shared read and reaches flows that work on main.
A reopen that joins a shared read loses the target when that read expires. fetchHistory starts its 8 s timer when it is called, even while the REQ is held unsent for a disconnected socket (mobile/lib/shared/relay/relay_session.dart:341-369). A second loadEventsById for the same ID now only awaits the first read (mobile/lib/features/channels/channel_messages_provider.dart:1142-1143, :1156). So during a reconnect backoff: open an ID-only target, close it, reopen it 7 s later, reconnect 2 s after that. Both calls fail on the first deadline, the route swallows the error (mobile/lib/features/channels/channel_detail_page.dart:170-179), and no ID read reaches the relay.
Cost: the open page shows the newest window with no jump or unread anchor until the user leaves and opens it a third time. On main each call issues its own read with its own deadline, so the second open sends one read on reconnect and places the target. No Search is involved: message links, Activity and the unread-anchor IDs all pass ID-only targets through this effect on main. From source, a reopen 7 s into a read on a stalled but connected socket also inherits the 1 s that is left. We did not probe that case.
Fix shape: when a read that a caller only joined fails, that caller re-enters the read-or-join step once, with its own hints, for IDs that are still held and not pinned. It takes no new hold, and it goes through _deepLinkReads so surviving joiners share one retry. The call that started the failed read does not retry, so exact reads never exceed main's one per open. Parking ID-only lookups started offline on the existing hold-aware wait (mobile/lib/features/channels/channel_messages_provider/pagination.dart:66-73) is a fine addition, but alone it leaves the connected case. The provider is at 1,196 of 1,200 lines, so this probably belongs in pagination.dart.
A test with the real session and a fake transport should cover it: disconnected, open an ID-only out-of-window target, close it, reopen at +7 s, reconnect at +9 s. Expect exactly one exact-ID read on the wire and the target placed, with the four-tap test still at one read.
Follow-ups, not blocking: _denyAccess clears pinned events but keeps holds, so a page open through denial and recovery loses its target; guard pagination.dart:77 by identity; Retry does not re-read a failed target; limit the gesture-start paging check to older-directed drags; null checkOlderPages on cleanup; a loading drag near a held target still shows 5 off-target frames.
Details in Buzz: buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=7b044424237e19a0fbb4d15b3b06deb1698deab8a7c0e55ae7333fb3a3b5c197
Drop the search-hit hint, the window-refresh wait and the shared per-ID read: each deep-link open sends its own ID read, as on main, so no open can inherit another open's deadline. Drop held-target paging (the Android dead edge only arises with it). Keep the exact-message routing, target re-placement, the per-page hold count, the detached target fill check, the reconnect catch-up check and the Retry guard. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
|
🤖 Rather than patch the shared read again, I cut the PR down in Blocker (a reopen inherited the shared read's deadline): fixed at the root. The shared per-ID read is gone, so each Also removed: the search-hit hint ( Kept:
Each kept guard has a test that fails with the guard broken. The production diff against main is now 6 files, about +120/−30. Your other follow-ups (Retry not re-reading a failed target, the |
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review at 758679cf: the round-6 blocker is repaired (each open has its own read and deadline), holds balance, and the cut left nothing behind. Two problems block landing. The first is an earlier repair that the cut removed, and the second is the read that this cut moves to a follow-up.
1. Android: the top edge above an old target stalls again. Above a detached target _historyFits is false (mobile/lib/features/channels/channel_detail_page/hidden_history_paging.dart:92-104), so _viewportFill never offers "Load earlier messages" at the 5-page cap or after a failed fetch (:111-128). A drag at the clamped edge resets the cap and the pause (mobile/lib/features/channels/channel_detail_page/message_list.dart:935-942) but moves no item, so onPositionsChanged (:544) never runs again. This happens when the older pages hold only hidden rows (five pages of membership notices) or after one failed older fetch.
Cost: the list reads as the start of the channel, and only scrolling newer first recovers. On main the button appears, successive drags advance 5, 10, 15, 18 pages, and a failed fetch retries on the next drag. This reaches existing Activity and message-link opens.
Fix shape: restore the gesture-start check that this cut removed with held-target paging (checkOlderPages, called where the scroll gesture resets the cap), and restore the clamped-edge test with a hidden-only case and a failed-fetch case. message_list.dart is at 1198 of 1200 lines, so something has to move out.
2. Search still sends ID reads that main does not. With no hint and no wait, loadEventsById reads every target missing from state (mobile/lib/features/channels/channel_messages_provider.dart:1125-1147). Main's Search sends none in these cases:
- A cold recent hit sends 1 read for an event the window then returns.
- A hit newer than the cached rows after a detach sends 1.
- An open abandoned while offline sends 1 on a reconnect inside 8 s and places nothing.
- Four wide-pane re-taps while the first read is unanswered send 4 reads and 4 publishes.
- Back plus re-tap while the read is in flight sends 2.
The single read for an out-of-window hit is the feature's own cost and is fine.
Fix shape, in two small parts:
- For a Search open only, have the mounted page wait for a current window, including across an offline gap, then read only IDs that are still held and missing. Activity and link opens stay eager. Because the wait belongs to the page, a closed page sends nothing, and nothing is parked in the provider.
- Keep one in-flight read per ID in
pagination.dart. A second caller awaits it, then reads only IDs still held and missing, on its own deadline, so it cannot inherit the first read's timer.
A test with the real session and a fake transport should see 0 reads for a cold recent hit, 0 for an abandoned offline open, and 1 for four re-taps, with the target placed.
Follow-ups, not blocking:
- After the first drag, the landed page pushes the target off screen.
- With short history and hidden-only pages, the button shows above the target.
- A read that pins nothing republishes an unchanged list.
_denyAccessclears pinned targets but keeps holds.- Retry does not re-read a failed target.
Details in Buzz: buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=7b044424237e19a0fbb4d15b3b06deb1698deab8a7c0e55ae7333fb3a3b5c197
Above a detached deep-link target the rows never fit, so a drag at the clamped top edge moved no positions and nothing re-ran the paging check: hidden-only pages or a failed fetch stalled the list. Activity and link opens reach this too. Restore the gesture-start check. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
|
🤖 Blocker 1 is fixed in Blocker 2 (the extra ID reads from Search) is on hold while Wes decides between accepting one read per Search tap, tracked in #10177, and adding the wait in this PR. |





What changes
Tapping a mobile message search result opens its exact message. A thread reply opens in its thread. A reply also sent to the channel opens in the channel. Forum results and channels that require joining keep their existing routes.
Older results use the existing message history path. The list keeps the target in view as older pages load or live messages change its position. In a wide search pane, the detail keeps its thread navigation when the original result disappears. Scrolling, navigating, or sending a new message takes control of the list.
Each open still reads its target by ID, as Activity and message links do on main. Each page holds its targets until it closes, so a wide-pane re-tap cannot unpin the new pane's target. An older target above unloaded history does not trigger automatic paging below it.
Out of scope, for a follow-up: skipping the ID read when the newest window already has the hit, and keeping the target in view when a page lands after the user drags. Today the landing page can push it out of view, as it does for Activity on main.
Verification
758679cf2(cut to the placement core after the 03:20Z re-review: the search-hit hint, the window-refresh wait, the shared ID read and held-target paging are removed, so each open sends its own ID read with its own deadline. The hold count, the detached-target fill check, the reconnect catch-up check and the Retry guard are kept): pre-push passed on this HEAD, including the full mobile suite. Analysis and formatting were clean. Each kept guard was broken in turn and its test failed. Not exercised on a device. Earlier entries describe code that has since been removed.9532c6020(brow's 05:06Z blocker 1): restores the check when a drag starts, so a drag at a clamped top edge above an older deep-linked message still pages through hidden-only history and retries after a failed fetch (this also affects Activity and link opens). A two-row test fails without the fix. Pre-push passed on this HEAD, including the full mobile suite. Not exercised on a device. Blocker 2, the extra ID read per Search tap, waits on Wes's decision.5dfba27b6(fix for the 00:24Z re-review: each page now holds its own count on a deep-link target, so a wide-pane re-tap's stale release or a denied open's release no longer unpins another page's target, and opens of one ID share a single read that pins and publishes once;mainmerged in, with comment-only trims to stay under the file-size limit): pre-push passed, the full mobile suite passed (6,610 tests, 83 skipped), and analysis, formatting and the file-size check were clean. Each part of the fix (count before the denial return, count rather than set, holds kept through denial, per-ID shared read, cleanup on failure, still-held fence) was broken in turn and its test failed. Not exercised on a device.ac26a8750(fix for the 23:32Z re-review: a released search-hit lookup retires instead of parking, so repeated offline opens of one hit send one ID read and publish once;mainmerged in): pre-push passed, the full mobile suite passed (6,601 tests, 83 skipped), and analysis, formatting and the file-size check were clean. The regression test fails with each part of the fix broken. Not exercised on a device.59dbbfea3(fixes for the 21:23Z re-review: a failed first load keeps Retry when a search hit's lookup lands, and a hinted lookup waits for a due window refresh instead of sending an ID read): pre-push passed, the full mobile suite passed (6,570 tests, 83 skipped), and analysis, formatting and the file-size check were clean. Each fix has a regression test confirmed to fail with its fix broken. Not exercised on a device.2bef9eefe(fixes for the 18:58Z re-review: a search hit is only a hint, so a deleted hit is never shown, and Android drags at a clamped edge keep paging older;mainmerged in, including therelay_session_testfix from test(mobile): keep the publish timeout test off the unbuilt session's state #10162): pre-push passed, the full mobile suite passed (6,567 tests, 83 skipped), and analysis, formatting and the file-size check were clean. Each fix has a regression test confirmed to fail with its fix broken. Not exercised on a device.f16dde519(fixes for the pre-review, withmainmerged in): pre-push passed, the full mobile suite passed (6,528 tests, 83 skipped), and analysis, formatting and the file-size check were clean. Each fix has a regression test, and each test was confirmed to fail with its fix broken. These fixes have not been exercised on a device.6b10970da, pre-push passed with 6,166 mobile tests, 72 skips, and 27 crypto tests. Analysis, formatting, and the repository file-size check passed. The widget regressions reproduce target drift with 20 live arrivals and the pane rebuild error after the tapped search tile is removed.c5d480427with theea39b596eapp sources plus local measurement instrumentation. The older match stayed visible once paging settled, a drag moved it without snapping back, and recent and thread matches opened at the selected message.ea39b596eand passed one4a3faad6, including when history and the send arrived in the same frame. The simulator captures are fromea39b596e. Widget tests cover the later changes for live arrivals and pane rebuilds.Try it