feat(feed): batch For You page enrichment with composite queries - #369
Draft
QuantumExplorer wants to merge 2 commits into
Draft
feat(feed): batch For You page enrichment with composite queries#369QuantumExplorer wants to merge 2 commits into
QuantumExplorer wants to merge 2 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
One composite `getDocuments` request now answers a For You page and everything a card needs to render it, under a single merged proof: the posts, their like/repost/reply/quote counts, the posts they quote, the authors' profiles and DPNS names, and (logged in) the viewer's own likes, reposts and bookmarks on the page. The SDK derives every sub-query from the proven page, so the responding node cannot steer any of it. About ten round trips per page become one. - lib/feed/composite-feed-page.ts builds the query from the contract topology, decodes the result into the page plus a `PreloadedEnrichment`, seeds the DPNS and profile caches, attaches quoted posts, and reports `null` when the surface is unavailable (an evo-sdk without `documents.composite`, a pre-v6 contract, or a recent failure with a one-minute backoff), so the legacy loaders keep working unchanged. - lib/feed/load-for-you-feed.ts tries the composite page first and translates the feed's id cursors into the range clause the composite surface paginates with. - useProgressiveEnrichment accepts the preloaded slices, merges them at once and only queries what they did not cover; PostCard and the per-card fallbacks are untouched. - dpnsService.seedUsernames and unifiedProfileService.seedProfileDocuments let proven lookups warm the batch resolvers (with a short negative cache for proven absences). Needs an evo-sdk release carrying the composite surface (dashpay/platform#4601 and its stack) and nodes serving it (dashpay/platform#4599); until then the capability check keeps this change inert. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
QuantumExplorer
force-pushed
the
feat/composite-feed-page
branch
from
September 8, 2026 09:05
3dfd13e to
f8ff5c2
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.
Summary
Batch For You posts and their card enrichment through the composite document-query API merged in dashpay/platform#4605. The first page uses one composite document request for posts, four engagement counts, quoted posts, author profiles/DPNS names and, when signed in, the viewer's likes, reposts and bookmarks. Anonymous queries use eight subqueries; signed-in queries use the maximum ten.
Subsequent pages use the existing timeline
startAftercursor to select the next 20 document IDs, then one composite by-ID request for those exact posts and their enrichment. This preserves posts with identical timestamps and keeps pagination advancing past tombstones. Results are restored to timeline order after the by-ID lookup. If composite queries are unavailable, the loader reuses the timeline result and falls back to ordinary enrichment.This reduces the page/enrichment requests; it does not imply a fixed total for loading the UI. Repost attribution, block/follow checks, trending, quoted-author names, signed-in quoted-author profiles, and quoted replies/blogs can still require separate requests. Live-network savings have not yet been measured.
Correctness and compatibility
Activation prerequisites
This remains preparatory with the current dependency pins. Both
@dashevo/evo-sdkand@dashevo/wasm-sdkare still4.2.0-dev.8; the published SDK lacksdocuments.composite, and no newer compatible release was available when this update was validated.Activation requires compatible SDK releases, nodes serving V1 document
sub_queries, and the configured enforced-reference contract topology. The ordinary path remains active until those prerequisites are met. No SDK release or node deployment is included here.Validation
npm run lint— clean.npm run test— 142 tests passed, including timestamp ties over three pages, raw tombstone cursors, four named authors, crowded alias batches, empty-branch capacity, cache invalidation/expiry, old SDKs and unsupported/incomplete responses.npm run lint:dead— clean.npm run buildandnpm run build:testing— passed.npm run test:e2e— six read-only browser checks passed; 41 write tests skipped without signing credentials.Composite behavior is covered with an in-memory SDK boundary; it has not been exercised against composite-enabled live nodes.