Repository navigation
fix(thread): reply thread header counts the server's total, not the loaded page - #5159
Closed
stamp-build[bot] wants to merge 2 commits into
Closed
stamp-build[bot] wants to merge 2 commits into
stamp-build[bot] wants to merge 2 commits into
Conversation
…oaded page
A long thread opened from its row in the channel said "30 replies": one page.
The header shows max(loaded replies, the origin's reply summary), and the
origin's summary was 0 there:
- The row handed to rememberReplyParentCandidate comes from the timeline
slice, which carries no reply facts (withoutThreadReplyMetadata), so the
remembered parent said replyCount = 0. The thread resolves its origin from
that remembered copy and never reads the parent again.
- The thread's own open (POST /channels/:id/threads) answers
{ threadChannelId, replyCount, ... }; loadReplyThread parsed replyCount and
dropped it.
Now:
- The reply snapshot keeps the open answer's total
(ThreadSnapshot.replyThreadReplyCount) and the data source puts it on the
resolved parent and on the remembered copy, so it replaces an older count.
- The row's reply count rides the parent candidate (the web's cached thread
summary), for opens that already know the thread channel and so ask the
server nothing that carries a total.
- A thread:updated also grows the remembered parent's count, so a later open
does not start from an old total.
Web reference (botiverse/slock 7c3e67b8): ThreadPanelHeader counts
max(loaded + hidden, threadSummaries[parent].replyCount); the summary comes
from the channel page / messages/context threadSummariesByParentMessageId,
GET /channels/:id/threads/:messageId when the thread channel is unknown, and
thread:updated.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
Author
|
Merged by Stamp in batch |
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.
Problem
Report (Android, 1.27.0): the reply count at the top of a reply thread is the number of replies on screen, not the thread's total. A very long thread opened from the channel says "30 replies" (one page).
Cause
The header shows
max(loaded replies + hidden history, the origin's reply summary)(threadHeaderReplyCount). The origin's summary was 0, so the loaded page won:ThreadPage.kthands the tapped row toSharedThreadDataSource.rememberReplyParentCandidate. The row comes from the timeline slice, which carries no reply facts (withoutThreadReplyMetadata), so the remembered parent hasreplyCount = 0. The thread resolves its origin from that remembered copy (resolveReplyParentMessageFromStore) and never reads the parent again, so nothing corrects it.POST /channels/:id/threads, answers{ threadChannelId, replyCount, lastReplyAt, participantIds }(servergetThreadInfoForChannel).loadReplyThreadparsedreplyCountand dropped it.Not a 1.27 regression: the row has been handed over without reply facts since 2026-06-27 (
8912d610c7/4b83c28e06), and the header has used this formula since 1.24.0 (#4557). Opens that read the parent frommessages/context(no remembered copy) were right, because that response carriesthreadSummariesByParentMessageId.Fix
ThreadSnapshot.replyThreadReplyCount: the reply load keeps the open answer's total. The data source puts it on the resolved parent and on the remembered copy (withReplyThreadReplyCountOnParent), so the thread's own read replaces an older count.rememberReplyParentCandidate(replyCount = ...): the row's reply count rides the candidate. This is for opens that already know the thread channel, which ask the server nothing that carries a total (same as the web, which uses its cached thread summary there).rememberReplyParentReplyCount: athread:updatedalso grows the remembered parent's count, so a later open does not start from an old total.No new request. Web reference (botiverse/slock
7c3e67b8):ThreadPanelHeadercountsmax(loaded + hidden, threadSummaries[parent].replyCount); the summary comes from the channel page /messages/contextthreadSummariesByParentMessageId, fromGET /channels/:id/threads/:messageIdwhen the thread channel is unknown, and fromthread:updated.ThreadPage.kt: two one-line argument additions inside theonThreadEventlambda (the row's count is only known there).Not covered
replyCount; mobile does not.Tests
SharedThreadReplyThreadReplyTotalTest: a thread opened from its row counts what the row knew; the open answer's total replaces an older remembered count and is remembered; a live count only grows the remembered parent; the total never lowers a count; which conversation athread:updatednames.ConversationRepositoryReplyThreadReplyCountTest: the reply load keepsreplyCountfrom the canonicalPOST /channels/:id/threadsbody.Not run locally (no JDK); hosted CI on this PR. Needs a device check: open a thread with more than 30 replies from its channel row, from Activity and from a notification.
🤖 Generated with Claude Code