Repository navigation
feat!: get/list populate relations by default — depth 1, batched, cycle-safe, with typed related() (3b) - #35
Merged
Merged
Conversation
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 59 minutes. View limit details
TanStack is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.
|
🦋 Changeset detectedLatest commit: 7bfcfe5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cursor
Bot
force-pushed
the
cursor/read-verbs-get-list-a931
branch
from
November 6, 2026 14:50
71f3aad to
550fc8f
Compare
cursor
Bot
force-pushed
the
cursor/populate-sidecar-a931
branch
from
November 6, 2026 14:50
3aecfb8 to
35ed2e9
Compare
cursor
Bot
changed the base branch from
cursor/read-verbs-get-list-a931
to
main
November 6, 2026 14:57
jherr
force-pushed
the
cursor/populate-sidecar-a931
branch
from
November 6, 2026 15:09
35ed2e9 to
7bfcfe5
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.
Implements cms-refactor-plan.md § Phase 3 (3b): item 6 ("populated reads and agent defaults"), item 5's MCP default override, question 15 (option B, the
relationssidecar) and question 16 (option ii).Merge chain: step 18 of 24. Base:
main. Merge it right after #40. The branch ismain3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commit35ed2e9(treee3948f7).What
getandlistreturn related documents underrelations, keyed by relation field path (author,seo.image,blocks.2.author).dockeeps the ids exactly as stored.relations.resolveRelationsAs(ctx, items, select)groups every relation id on a page by target collection. It reads each target collection once withstorage.getDocuments, in chunks of 500 ids.queryDocumentsAs({ populate })andpopulateRelationsAsuse it too.null, or are dropped from amanyarray. A reader can't tell hidden from missing. Every related document is read and redacted the way the context reads.populatetakestrue,false, or an array of paths, using the newPopulateSelectiontype.populateoff by default.related(result, path):@tanstack/cms-core, and from@tanstack/cms-clientas a local copy.RegisteredDoc<Target> | null, orArray<…> | nullformany.ReadResultandListResultgain a collection type parameter.get_documentpopulates.list_documentsandsearch_documentsreturn ids unless the agent passespopulate.listPublishedDocumentsdoesn't populate. The deprecatedread_documentstill returns the bare document..changeset/populate-sidecar.md, minor for core, api and client.Breaking changes
get_documentreturnrelationsby default. Passpopulate: falseto get the 3a shape.null, or is dropped from amanyarray. It used to come back with adeletedAtstamp, becausestorage.getDocumentsdoesn't filter trashed rows. This applies to every verb withpopulate.null(or[]) instead of being left out, per the plan's "existence doesn't leak" rule. The 2c assertions inaccess-context.test.tsandfield-access.test.tsare updated.How verified
tests/read-verbs.test.ts(19 tests) covers:getDocumentscall per target collection, checked with a spy);get/listpopulate for an anonymous reader.related().publicContext().listofflistongetoffgetonperson(13)talk(9)personSource(6)variant(30)Small lists that point at a person grow 5–7×, because each related person is a large document. So the ids-only default for
list_documentsandsearch_documentsstill looks right. At these sizes, populated lists take under 2 ms.3aecfb8intoorigin/mainat3b4a112. The only conflict wasscripts/codemods/index.ts, where I kept both codemods.pnpm install --frozen-lockfilepnpm test:ci(174 tasks)@tanstack/cms-api:test:oxlintfailure on a type cast. Core 595 passed (30 skipped), api 207, client 35.pnpm test:dtspnpm test:dialectspnpm test:scriptsAssumptions (conservative defaults where the plan gives none)
[]means none.related()types:manyrelations type asArray<…> | null, and nested paths asDoc | Array<Doc> | null.relatedis a local one-line copy, so the client still imports only types from core.Divergence from plan
read_documentpopulated" is implemented onget_document, the canonical tool per Q18. The deprecatedread_documentstays bare.related()types are slightly wider than the plan's examples:| nullonmany, and arrays on nested paths.Merge chain (local verification, CI down)
This PR's commits are squashed into one commit on the linear merge chain. That commit holds this PR's own changes, resolved against every PR before it, with the integration rehearsal's fixes for this PR applied. Two conflicts: the
getandlistrows inroutes-and-endpoints.md, and upgrading step 28.The chain tip's tree is exactly the integration rehearsal plus #46 (
c4e6d7c), and the tip passes the full local suite. I simulated merging every PR in order, with a merge commit or a fast-forward at each step, and every step is clean. A plain squash of the next PR would conflict, because the squash commit isn't an ancestor of the next branch. To squash instead, first rebase the branch's one commit onto the newmain; that rebase is always clean.