Skip to content

fix(mobile): load earlier edits to thread replies when a thread opens - #8870

Merged
brow merged 1 commit into
mainfrom
loganj/mobile-thread-reply-edits
Nov 2, 2026
Merged

brow merged 1 commit into
mainfrom
loganj/mobile-thread-reply-edits

Conversation

@loganj

@loganj loganj commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

In the mobile thread view, if a reply was edited before you opened the thread, the reply showed its original text and no "(edited)" marker. An edit that arrived while the thread was open worked.

The thread /query asked only for message kinds. The channel window carries edits, reactions and deletions (aux events) only for top-level messages, so an earlier edit to a reply was in neither result. The thread query now sends include_aux: true, as desktop does (buzz-app src/features/relay/threads.ts). The relay already supports this on the depth_limit thread route: it returns the aux events for the root and every reply, plus deletions of those (crates/buzz-relay/src/api/bridge.rs, bridge_thread_aux). A relay that ignores the flag gives the same result as before.

The relay sends a page's rows (at most 200 reply-marked events, of any kind) before that page's aux events. It also repeats the root's aux on every page. So fetchCompleteThread treats the leading run of events reply-marked into this thread, other than reactions and NIP-09 deletions, as the page's rows. Only rows count toward a page, move the cursor and feed the reply cache. A reply-marked huddle event still fills a page, and a reply-marked reaction never becomes a reply. A reply-marked edit of the root in the repeated aux can follow a short final page's rows and look like a full page, so the scan also stops when the next cursor does not advance. The thread-summary scan (fetchCompleteThreadReplies) still asks for replies only and pages exactly as on main.

Related issue

Found during the emulator testing of #8863.

Testing

  • just mobile-check, just file-size-check and just mobile-test pass.
  • thread_replies_provider_test.dart adds two tests. The first checks that the query sends include_aux and that an edit made before the thread opens folds into its reply. The second covers pagination: a reply-marked huddle row filling a page, a reply-marked edit that is a row on one page and aux on the others, a reply-marked reaction that stays aux, 200 reply-marked reactions after 199 replies (one query), 200 reply-marked root edits after a short final page (the progress guard ends the scan), an edit reply-marked into another thread that stays aux, and that the summary scan doesn't send include_aux. It fails if any of these is removed: the reaction/deletion exclusion, the root check, the 200 cap, the progress guard, or the separate row and aux id sets.
  • channel_detail_page_test.dart adds a journey: it opens ThreadDetailPage with the real thread query and a fake relay session that sends the reply's earlier edit only when include_aux is set. It checks the edited text, that the original text is gone, and the marker. It fails when the flag is removed or when the provider drops aux.
  • Android emulator (AVD, debug build) against a local relay. Morty posts "Who can review the release notes?", Demo User replies "I can, after lunhc" and then edits the reply to "I can, after lunch", all before the thread is opened. These shots come from the first revision of this branch. The pagination changes after it give the same result for a one-page thread like this one.
Before (unfixed: the #8863 build) After (this branch) Live edit while the thread is open
Before: original reply text, no marker After: edited reply text with (edited) Live edit while the thread is open

Before, the thread shows the original reply text with no marker. After, it shows the edited text and "(edited)". A live edit still lands.

🤖 Generated with Claude Code

A reply edited before its thread was opened showed its original text
and no "(edited)" marker. The thread query asked only for message
kinds, and the channel window carries edits, reactions and deletions
only for top-level messages, so an earlier edit to a reply was in
neither result. Edits that land while the thread is open already
worked through the live channel socket.

Ask the thread query for include_aux, as desktop does. The relay
already returns the edits, reactions and deletions of the root and
every reply on that route, after each page's rows. A page's rows are
the leading run of events reply-marked into this thread, at most 200: the relay sends
them before the aux, and reactions and NIP-09 deletions are never
rows. Only rows feed the reply cache and the cursor, so a reply-marked
huddle event still fills a page and a reply-marked reaction never
enters the reply cache. The root's aux repeats on every page; a
reply-marked edit there can look like a row after a short final page,
so the scan also ends when the next cursor does not advance. Rows and
aux are deduplicated separately. The thread-summary scan still asks
for replies only and pages exactly as before.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Logan Johnson <[email protected]>
loganj added a commit that referenced this pull request Oct 31, 2026
@brow
brow marked this pull request as ready for review November 2, 2026 18:47
@brow
brow requested a review from a team as a code owner November 2, 2026 18:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T18:52:16.086590Z 3f7302a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@brow
brow merged commit 2fd5c12 into main Nov 2, 2026
58 of 59 checks passed
@brow
brow deleted the loganj/mobile-thread-reply-edits branch November 2, 2026 18:59
loganj added a commit that referenced this pull request Nov 3, 2026
Main now shields backslash escapes before rendering (#8925), so a
trailing `\]` reaches the marker rule as text, never as display math.
Drop that own-line rule; an escaped bracket now takes the inline
marker. The thread edit-reload test from #8870 now expects the
marker joined to the reply text.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Logan Johnson <[email protected]>
loganj added a commit that referenced this pull request Nov 4, 2026
Main now shields backslash escapes before rendering (#8925), so a
trailing `\]` reaches the marker rule as text, never as display math.
Drop that own-line rule; an escaped bracket now takes the inline
marker. The thread edit-reload test from #8870 now expects the
marker joined to the reply text.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Logan Johnson <[email protected]>
loganj added a commit that referenced this pull request Nov 4, 2026
Main now shields backslash escapes before rendering (#8925), so a
trailing `\]` reaches the marker rule as text, never as display math.
Drop that own-line rule; an escaped bracket now takes the inline
marker. The thread edit-reload test from #8870 now expects the
marker joined to the reply text.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Logan Johnson <[email protected]>
loganj added a commit that referenced this pull request Nov 9, 2026
Main now shields backslash escapes before rendering (#8925), so a
trailing `\]` reaches the marker rule as text, never as display math.
Drop that own-line rule; an escaped bracket now takes the inline
marker. The thread edit-reload test from #8870 now expects the
marker joined to the reply text.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Logan Johnson <[email protected]>
loganj added a commit that referenced this pull request Nov 10, 2026
Main now shields backslash escapes before rendering (#8925), so a
trailing `\]` reaches the marker rule as text, never as display math.
Drop that own-line rule; an escaped bracket now takes the inline
marker. The thread edit-reload test from #8870 now expects the
marker joined to the reply text.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Logan Johnson <[email protected]>

This branch was successfully deployed

No deployments
codex-review — 3f7302a0 Deployed Nov 2, 2026 by brow via Run Codex Security Review #11868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants