Repository navigation
feat: include_quotes_and_deep_replies flag on notifications - #42
Conversation
/v2/farcaster/notifications takes include_quotes_and_deep_replies=true. Notifications then also carry casts quoting the user's casts (type `quote`), replies deeper in the threads under them (type `reply`, up to five levels below the direct replies), and recasts typed `recasts` instead of `likes`. They share the ordering and cursor of the others. Without the flag the response is unchanged. Also fixes why the quotes index looked like it missed quotes: - get_quotes stopped iterating after the first key (the callback returns true to stop), so /cast/quotes returned at most one quote. Same bug in the user data index's location prefix lookup. - The block backfills (API indexers and hyper) skipped the last block of every batch, since the shard chunk stop block is exclusive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Does this fix require existing nodes to rerun the backfill to recover previously skipped notifications, or are those blocks eventually indexed through another mechanism? But probably not worth rebuilding indexes for. Users generally don't care about notifications from weeks or months ago. |
# Conflicts: # src/network/server_tests.rs
|
Merged main (0.16.0) in, so the conflict is gone. It was only in On the backfill: notifications themselves don't depend on it. Replies, deep replies, mentions, likes, recasts and follows are read straight from the cast, reaction and link stores, so they're complete on every node, old blocks included. Only the The off-by-one only affected the index backfill: it skipped the last block of every batch, so about 1 in 101 historical blocks. Blocks indexed live after a node finished its backfill are complete. A node that already backfilled keeps that ~1% gap in its indexes (quotes, and the other indexers that replay the same way) unless its indexer checkpoints are reset so they replay. Agreed, not worth a rebuild for old notifications. New nodes get it right from the start. |
GET /v2/farcaster/notifications?fid=N&include_quotes_and_deep_replies=truealso returns:type: "quote"(the quoting cast ascast, its author asuser), found through the cast quotes index;type: "reply";type: "recasts"instead oflikes.They are merged into the same time ordering and cursor as the other notifications. Without the flag the response is unchanged. Clients otherwise have to look up quotes with one request per cast.
While in there, two fixes for why the quotes index looked like it missed many quotes:
CastQuotesIndexer::get_quotesreturnedtrue(stop) from the iterator callback after the first key, so/v2/farcaster/cast/quotesreturned at most one quote per cast. The same inverted check was inUserDataIndexer::get_fids_by_value_prefix.run_block_backfilland the hyper backfill) passedendas the stop block toget_shard_chunks, which is exclusive, so the last block of every 100-block batch was never replayed. Already-backfilled nodes keep that gap until their checkpoints are reset.