feat(wasm-sdk): composite document queries on the JS surface - #4601
feat(wasm-sdk): composite document queries on the JS surface#4601QuantumExplorer wants to merge 0 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks 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 |
|
🕓 Ready for review — 57 ahead in queue (commit 9636331) |
3f20bf2 to
93967fd
Compare
4997361 to
1d474a4
Compare
5dc2287 to
efcca1b
Compare
fb1cf8c to
7df75fb
Compare
14ef5e9 to
9636331
Compare
7df75fb to
2e24461
Compare
9636331 to
cf11e97
Compare
|
Closed by GitHub when a mistaken force-push briefly collapsed the stack's branches onto one commit. Replacement with the same branch and content: #4605. |
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>
Issue being fixed or feature implemented
Last platform PR of the composite document query series (Yappr feed: one merged proof per feed page instead of 15 to 19 round trips). Stack:
sub_queries, drive-abci dispatch)What was done?
getCompositeDocuments(query)andgetCompositeDocumentsWithProofInfo(query), mirroring the chained surface. The query object is the page (dataContractId,documentType,where,orderBy, a requiredlimit) plussubQueries, each with an optionaldataContractId(defaults to the page's),documentType,kind: 'documents' | 'counts', fixedwhere/orderBy, an optional per-valuelimit, and an optionalbind: { source?: 'page' | index, sourceProperty, field }. Sub-query contracts are fetched through the same contract cache as the page's. The result is{ pageDocuments, subResults }, each sub-result a discriminated union:{ kind: 'documents', documents }or{ kind: 'counts', counts: Map<base58 id, bigint> }. TypeScript declarations ride the usual custom section.parse_order_clausebecomes crate-visible next toparse_where_clause.sdk.documents.composite(query)andsdk.documents.compositeWithProof(query), plus a README section with the feed-page example and the four sub-query shapes.dashposts page, one like count per post from the countable[hashtag, postId]index, and the viewer's own likes through thebyLikerterminal (value-bounded, no limit).Usage:
How Has This Been Tested?
cargo test -p wasm-sdk(native): 103 tests green;cargo clippy -p wasm-sdk --testsclean apart from the pre-existing rs-driveDocumentPropertyTypeunused import under verify-only features.import-x/no-unresolvedondashis the usual uninstalled-workspace noise, not a finding).Breaking Changes
None. New methods only.
Checklist
🤖 Generated with Claude Code