Repository navigation
Conversation
Ingest records follows in the message's transaction: the author reads through their own message, and mentioned channel members, the root's author and DM members follow the thread just before it. The sidebar then counts forward from each read position instead of resolving participation and walking 4096 events back per channel, and counts stop at 100. A thread mark_through moves an existing follow and never creates one. participation.rs is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Honey <8e307ae0076a4dab6b94b036ea3edc7e08f823a625269c1e6919e881a048b4d2@buzz.block.builderlab.xyz>
Contributor
Author
|
🤖 Superseded by #8264. That PR carries this change together with follow intents, the threads view and the arrival-ordered access paths, as one review. |
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.
What
The sidebar now counts thread replies only in threads you follow, and ingest records who follows. Before, every sidebar request worked this out by looking up your "conversations" (who wrote each reply's parent) and scanning up to 4096 events backward per channel. Now:
mark_throughmoves an existing follow and otherwise does nothing.participation.rs(the per-request conversation lookup) is deleted.No migration, no new index, no wire change: the #8220 response shape is unchanged.
Behavior changes
broadcast=1reply counts only for people who follow its thread. A top-levelbroadcast=1is no longer a mention.event_mentions(validptags). Malformed tag documents no longer exclude a message.mentionson channel and thread rows is capped at 100.latest_idis someone else's and unread, so a badge always has an anchor that clears it. A channel whose newest 4096 events are all reactions, edits or replies shows no badge.Benchmark
Same harness as #8188/#8220 (a
bench_unreadPostgres test, not committed): one community, 20 channels, 8 other members. The scenarios are a caught-up reader with 5000 followed threads, a 20k-message timeline backlog with 12 mentions, 500 unread threads, a 20k-reply burst thread, and a 20k-reply thread spread over five days. Release build, local Postgres 14. Main (326e230) and this branch ran back to back. Sidebar numbers are p50 over 30 requests.Main undercounts the backlog's mentions: its backward walk stops 4096 events from the top, before the older mentions. This PR walks forward from the read position, so it finds all 12.
Being caught up costs more here, because this PR does a few index probes per followed thread and main does one walk per channel. 13ms for 5000 followed threads is still small.
Ingest pays for it. Each stored eligible message now writes the author's read position and any new follows in the same transaction:
That's roughly +0.2ms per message and 3–16% less concurrent throughput. Most of it is the per-row write-fence trigger and foreign-key checks on the frontier and account tables. The serial runs before the first
ANALYZE(0.91 vs 0.32ms top-level, 1.44 vs 0.50ms reply) run against never-analyzed read-state tables and overstate the cost. Autovacuum analyzes those tables in production.Tests
follows_postgres_tests.rs(12 tests): who follows on a reply, a mention (members only, starting just before it), a later mention, the root author, a top-level mention, DM members, a nested reply, and a message stored without thread metadata. Also: an unfollowed or broadcast thread never counts and marking it follows nothing, posting reads the timeline, the thread cap, and ingest never starting an account.arrival_postgres_tests.rs: a late arrival behind 300 reactions clears on mark, and a message behind a full 4096-event budget of reactions shows no badge, because it has no anchor to mark.projection_postgres_tests.rs: mentions are validptags in a stream and every message in a DM; a top-level broadcast is not a mention.buzz_v1tests updated for following.personal_read+buzz_v1Postgres tests: 51/51 pass. Fullbuzz-db+buzz-relayPostgres run: 858 pass. The 25 failures (24partitiontests and one huddle JSON test) are local PG14 environment issues and fail the same way on main.cargo clippy -D warningsandcargo fmtare clean.🤖 Generated with Claude Code