Repository navigation
Phase 6: remove deprecated verbs, docs sweep, alpha changeset - #46
Conversation
🦋 Changeset detectedLatest commit: b558543 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 |
|
Important Review skippedToo many files! This PR contains 207 files, which is 57 over the limit of 150. To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.
|
Chain step 24 of the linear merge chain onto main 3b4a112: this PR's own changes, resolved against the PRs before it in the merge order. Co-authored-by: jherr <jherr@pobox.com>
e668a30 to
fcc59c5
Compare
Chain step 24 of the linear merge chain onto main 3b4a112: this PR's own changes, resolved against the PRs before it in the merge order. Co-authored-by: jherr <jherr@pobox.com>
fcc59c5 to
b558543
Compare
Merge chain: step 24 of 24, the last one. Base:
main(it used to be the integration rehearsal branch). Merge it right after #45. The branch ismain3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commitfcc59c5(treec4e6d7c). Once this merges,main's tree should bec4e6d7cadd840b89ed7a45dda25c295b31f754af.What
Phase 6 of the core API refactor removes what the earlier phases deprecated, and moves the remaining code onto the canonical verbs.
Removed (hard break):
cmsAsmethods.listPublishedDocuments,saveDoc,createDocandactOnChangeoperations and Start functions.create_documentandupdate_documentagent tools.collection(name).published/save/create.CmsEventAlias.Kept for one alpha, marked "removed in the next alpha":
queryDocuments(As)andcmsAs().queryDocuments;readDocument(As)andcmsAs().readDocument;getPublicDocumentoperation and Start function;read_documenttool.No internal code calls these any more; only each wrapper and its own tests reference them. The storage adapters'
tx.queryDocumentsis a different, adapter-level method.New:
searchAs(ctx, options), the canonical name for full-text and multi-collection search, withcmsAs(cms, ctx).search. It replacesqueryDocumentsAs, and@tanstack/search-cmsuses it.Reads that feed a write now use
get({ staged: false }):sendNewsletterIssue, directory-listingsclaimListingand multi-tenant-fleetreadTenantPage.examples/blog-voting, theapp/baseoperations, and theapp/prmimport and scripts.@tanstack/cms-apiops and media ops, the document-state acceptance suite and the core bench.Moved to the canonical verbs:
list,saveandactserver functions. The review page callsactwith the document's id, and the agent chat's Approve readsstate.changeSet./p/$idand/post/$idroutes andcmsDocumentQueryOptionsread their own collection withget, first by id and then by locator.app/baseandapp/prmagents usesave_documentandget_document.Codemods:
write-verbscovers the operations, Start functions, HTTP URLs, agent tools and client helpers.event-namescovers webhookevents,onCmsEventfilters andCmsEventAlias.read-verbsnow writesstaged: falsefor committed reads, rewrites full-text reads tosearchAs, and warns onfindDocumentBySlug(As).Object.prototypekeys such as'constructor'.Docs:
docs/deployment/upgrading.mdkeeps steps 20–30, adds pointers forward, and adds step 31. Step 31 lists every removed name with its replacement and codemod, thefindDocumentBySlugAsrecipe, and the behaviour changes.CMS-INTEGRATION.mdnotes, READMEs and the voting skill are updated.Dialect inventory:
readDocumentBySlugandfindDocumentBySlug(both now also match theAsforms),listPublishedDocumentsandshortEventNames.removedWriteOpsandremovedAgentTools.stagedno longer counts the canonicalstaged: false.One alpha changeset,
.changeset/phase-6-removal.md, covering the fixed package group. It tells one story and names the silent behaviour changes. No other changeset was touched.Breaking changes
readSingleton,populateRelations,listDocuments,queryDocumentSummaries,groupDocuments,findReferences,listTranslations,listRevisions,readDocumentWithPending(no context)…As(ctx, …)access-contextreadDocumentBySlug,readDocumentBySlugAs,cmsAs().readDocumentBySluggetAs(ctx, { collection, id }), then{ collection, locator }access-context, thenread-verbsfindDocumentBySlug,findDocumentBySlugAs,cmsAs().findDocumentBySluggetAsper collection (recipe in step 31)read-verbswarnslistPublishedDocuments(op, Start fn)listwithpopulate: falsewrite-verbssaveDoc(op, Start fn)savewrite-verbscreateDoc(op, Start fn)savewithcreate: truewrite-verbsactOnChange(op, Start fn)act({ collection, id: docId, action, … })write-verbswarnsclient.collection(n).published/save/createclient.list/client.save(create: true)write-verbscreate_document/update_documenttoolssave_document(create: true) /save_documentwrite-verbspublish,unpublish,delete,change,updatedocument.published,document.unpublished,document.deleted,document.created+document.updated,document.updatedevent-names(updatewarns)CmsEventAliasCmsContentEventevent-namesRunSaveOptions.base(@internal)savewithcreate: trueA short event name now throws in two places: in a webhook's
eventslist atdefineCms, and in anonCmsEventfilter when it subscribes. Both errors name the replacement and the codemod.Divergence from plan
findDocumentBySlugAsis removed with no replacement verb. Instead there's a documented recipe in step 31 (getAsper collection, by id first, then by locator) and a codemod warning. A new cross-collection verb would add a third read shape./p/$idand/post/$idroutes no longer fall back to other collections. They read onlypageorpost.app/basehas its own/p/$pageroute, so it isn't affected.read_documentis kept as a fourth one-alpha wrapper, beside the three the plan named. It's the agent-tool form ofreadDocument, and removing it now would break MCP clients one release early.getPublicDocumentis rebuilt onget, now thatfindDocumentBySlugAsis gone. It reads each collection by id, then by locator. When an id matches a document the caller can't see, it keeps looking (that collection's locator, then the next collection) instead of stopping.removedWriteOps,removedAgentTools) instead of only lowering existing ones, so the removed write names can't come back.Assumptions
cmsAsmethods of the removed verbs. The plain forms of the kept verbs that take no context (queryDocuments,readDocument) also stay for the alpha, because they're the same wrappers.readDocumentAs(…, { includeDeleted: true })has nogetform. Theread-verbscodemod leaves such a read in place with a warning. Package internals use the internalreadCommittedAsinstead.saverecords the operation's actor, which isapiover HTTP;saveDocrecordedhuman. A staged create also no longer records the "Created document" instruction. Both are listed as behaviour changes rather than restored, becausesaveis the canonical path.savewithcreate: truerefuses an existing id withCONFLICT, wherecreate_documentreplaced the document. This followssave's contract.listwithlocalefilters by document locale, wherelistPublishedDocumentsresolved localized fields. The codemod leaves aTODOwherever it seeslocale.ScopedCmsClient.readDocument/listDocuments(used indefineOprun), theafterChange/afterDeletehook names, anddiscardDraft.minorfor the fixed group andpatchfor@tanstack/search-cms, matching the other alpha changesets in pre mode.Local verification (all run locally on HEAD
e668a30, because CI is down)pnpm install --frozen-lockfilepnpm test:ci(nx part)test:lib,test:starter,test:types,test:build,build, knip, sherif, docs and kiira targets pass. Only@tanstack/cms-api:test:oxlintfails (known, below).pnpm test:dts.d.tsacross 21 dist dirs)pnpm test:dialectspnpm test:scriptspnpm test:definitionspnpm test:docs/test:kiirapnpm formatwrite,verifyagainstdist)Package test counts (base → head):
onStaged, but not a draft (it now readssave'sstate.changeSet)getPublicDocumentand duplicate-list assertionswrite-verbs,event-names, and the renamedread-verbssearchcase)The builds regenerate
routeTree.gen.tsinexamples/blog,examples/astro-starlight-afterandpayload-after. Those files were restored rather than committed, and so wasapp/prm/bakeoff/latest.json.The only known failure is
@tanstack/cms-api:test:oxlint. It's caused by the existingas unknown as typeof builtInToolscast oncmsToolsinpackages/api/src/ops.ts, which is also present at base. Separately, one run of@tanstack/cms-api:buildfailed with TS2742 because it raced a concurrent local vitest run. It passes on its own and in the clean rerun, and nx lists it as flaky for that reason.Dialect inventory (non-test + test counts)
The "Rehearsal baseline" column is the committed baseline at
133db06, using the old marker patterns. "Before" and "After" use this PR's patterns:readDocumentBySlugandfindDocumentBySlugalso match theAsforms, the retired markers skip the upgrading and terminology pages, andstagedskipsstaged: false.133db06)publishedOnlypublicReadqueryDocumentsreadDocumentreadDocumentBySlugfindDocumentBySluggetPublicDocumentlistPublishedDocumentscollectionsRecordstagedpendingIdhookBeforeValidate/BeforeChange/BeforeDelete/AfterReadsearchContextsshortEventNamesremovedWriteOps(new)removedAgentTools(new)uiReactToolsImport,cmsVirtualRoutes,currentSession,runWithSession,seoCascadeFieldsWhat the remaining counts are:
queryDocuments(non-test) is mostly the storage adapters'queryDocumentsmethod.readDocument(non-test) is mostlyScopedCmsClient.readDocument, plus the kept wrappers.getPublicDocument(non-test) is the kept op and Start function, and the docs that mark them deprecated.shortEventNames) or are gone (removedAgentTools).Open items for Jack
queryDocuments(As),readDocument(As),getPublicDocument,read_document) in the next alpha. Theread-verbscodemod already covers the first two.readDocumentAscan go,getneeds a way to read a trashed document. Today onlyreadDocumentAs(…, { includeDeleted: true })does that.ScopedCmsClient.readDocument/listDocumentsindefineOprunstill use the old names. Decide whether to rename them toget/list.afterChange/afterDeletehook names and the createNNN-style renames weren't part of this phase.discardDraft(op and client helper) isn't anactaction yet.get.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. No conflicts. Its tree is exactly the Phase 6 head
e668a30's.This commit is the chain tip. Its tree is exactly the integration rehearsal plus #46 (
c4e6d7c), and it passes the full local suite:test:ci(with only the known oxlint failure), SSR smoke 9/9,test:dts,test:dialects,test:definitions26/26,test:scripts116, characterization 37/37/37, Postgres 123, libsql 84, E2E blog 33 and base 12.I simulated merging all 24 PRs in order, with a merge commit or a fast-forward at each step, and every step is clean. To squash-merge instead, first rebase each branch's one commit onto the new
main; that rebase is always clean.