fix(chat): mark a page last when it reaches the beginning, cache topic names - #29590
Open
chrisnojima wants to merge 1 commit into
Open
fix(chat): mark a page last when it reaches the beginning, cache topic names#29590chrisnojima wants to merge 1 commit into
chrisnojima wants to merge 1 commit into
Conversation
chrisnojima
force-pushed
the
nojima/chat-last-page-and-topic-cache
branch
from
September 4, 2026 13:46
b1c2726 to
1d2dcee
Compare
chrisnojima
force-pushed
the
nojima/chat-last-page-and-topic-cache
branch
from
September 4, 2026 13:53
1d2dcee to
1c66413
Compare
chrisnojima
force-pushed
the
nojima/chat-last-page-and-topic-cache
branch
from
September 4, 2026 14:06
1c66413 to
8f4a1f1
Compare
…c names Split out of the client-side thread window work, which is the pr under this one. patchPaginationLast: a page that reaches message ID 1 - or the nukepoint an expunge records - is the last page whatever the pager says, so the client stops asking for more and stops walking a conversation it has already seen the whole of. The topic-name cache collapses the per-#token fan-out: every message body holding a channel token used to read the inbox and then fetch the METADATA message of every channel in the team, thousands of single-message fetches for one page of a busy channel. The TTL is short because nothing invalidates the entry, and a result missing channels is cached shorter still - a team almost always carries channels the user cannot resolve, so refusing to cache those would mean never caching anything.
chrisnojima
force-pushed
the
nojima/chat-last-page-and-topic-cache
branch
from
September 4, 2026 20:28
8f4a1f1 to
a4041c2
Compare
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.
Service-side half of the thread-window work, split out of the pr this is based on so it can be reviewed on its own.
patchPaginationLast
A page that reaches message ID 1 - or the nukepoint an expunge recorded - is the last page whatever the pager says. Without this the client keeps asking for more of a conversation it has already seen the whole of, and the thread walks backwards through an expunged history one page at a time.
Topic-name cache
Resolving
#channeltokens is charged per message: every body holding one read the inbox and then fetched the METADATA message of every channel in the team, so unboxing one page of a busy channel in a team with a few dozen channels cost thousands of single-message fetches. A short-TTL memory cache collapses the steady state.Nothing invalidates the entry, so the TTL is the only bound on staleness and is deliberately short - the constant carries the argument, including what expiry does not heal, since a resolution is written into the message and persisted. A result missing channels is cached shorter still: the inbox read asks for every member status, so a team almost always carries channels the user has left or never joined and those fail on every pass, which makes "incomplete" the steady state rather than the exception.
Tests
convsource_patchpagination_test.gocovers the last-page rule at both ends and that a settled page is left alone;teamchannelsource_topicnamecache_test.gocovers the round trip, key separation, both-way copying, expiry on each of the two windows, and the clear paths. Run withgo test ./chat/ -run 'TestPatchPagination|TestTopicName'- the rest of the package needs a local kbweb.