Skip to content

feat: public access context, threaded through api, client, search-cms, MCP, hooks and events - #26

Merged
jherr merged 1 commit into
mainfrom
cursor/access-context-threading-a931
Nov 6, 2026
Merged

jherr merged 1 commit into
mainfrom
cursor/access-context-threading-a931

Conversation

@jherr

@jherr jherr commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Implements cms-refactor-plan.md § Phase 2b (item 4, "Access context for reads"; 13c).

Merge chain: step 10 of 24. Base: main. Merge it right after #33. The branch is main 3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commit a2c8059 (tree 74b8b62).

What

  • The access context is public API. @tanstack/cms-core/server exports:
    • the AccessContext and actor types;
    • the builders publicContext(), accessContext({ session, mode, agent }), systemContext(reason, { actor }) (reason required), previewContext, previewTokenContext and withMode;
    • the checks canReadCollection, canReadDocument, assertReadable and redactFor;
    • cmsAs(cms, ctx) and every …As(ctx, …) read verb.
  • Hooks and events get the context.
    • postRead/afterRead receive { doc, id, access }.
    • Event handlers get { event, cms, access }, where access is a system context naming the handler.
    • The outbox client reads as that context.
    • runOp(name, input, actor, access) and cmsTools(actor, { access }) take an explicit context. A preview context can't run ops.
  • @tanstack/cms-api.
    • requestAccessContext(request) builds the per-request context. The x-cms-read-mode header can narrow it. The default is edit, the widest the caller may read.
    • ops.ts reads through the context instead of doing its own read checks.
    • WebMCP and /api/mcp run as an agent context per request, and cached servers never hold a caller's context.
    • @tanstack/cms-api/start builds the context from getRequest(). It also exports getCmsAccessContext({ mode? }) for app server functions; mode defaults to live.
  • Client. createCmsClient({ mode }) sends the read mode and keys its cache by it.
  • Search. createCmsSearch({ access }) searches as that context, defaulting to publicContext().
  • Old forms keep working until 2c removes them: session/publishedOnly/publicRead, runWithSession and createCmsSearch({ session }).
  • Docs. building-pages.md no longer says "the store skips the session" and is rewritten around cmsAs(cms, ctx). cms-core-server.md gains an "Access contexts" section, and the API, client and hook reference pages are updated.
  • Changeset: minor for core, api, client and search-cms.

Breaking changes

  • CmsOpContext now requires access. Code that builds one by hand must add access: accessContext({ session, mode: 'edit' }). In this repo, only app/base's tests did.
  • getPublicDocument now skips a draft the caller can't read and returns the next match. Before, that draft hid the match and the call returned null.

Assumptions (tasks 8–12 defaults)

  • Actor shape (task 8 not reviewed). I used the most conservative mapping, derived from today's CmsSession: user | agent | system | scheduler | import | public | preview.
    • An agent is a session with x-cms-agent or an explicit agent name, and keeps that session's permissions.
    • system, scheduler and import require a reason and bypass every rule.
  • Recorded actor names are unchanged (mcp, mcp:<agent>, webmcp, content-agent).
  • Read modes. Request contexts default to edit, so CMS readers still see drafts as before. getCmsAccessContext() defaults to live.

Divergence from plan

  • cmsAs(cms, ctx) stays a function, not cms.as(ctx). It also accepts the defineCms() result, because that's what apps hold.
  • Write checks still use the session, and write hooks get no context yet. Writes are phase 5.
  • runWithSession still wraps op runs and MCP, so app ops calling currentSession() keep working. 2c removes it.
  • A legacy read without a session still maps to a system context. The fail-closed switch is 2c.
  • No starters or examples are migrated yet.

How verified

  • New tests:
    • core access-context.test.ts and an events test;
    • api access-context.test.ts, which also checks that a system context is refused over HTTP;
    • search-cms and client mode tests.
  • pnpm test:pr passes on 137 affected tasks except the cms-api oxlint error that main already has. Core ran 556 tests and the API ran 202. The Postgres tests were skipped because the VM had no Docker.
  • pnpm test:dts is clean.

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. One conflict, in the docs/schema/building-pages.md frontmatter. The replay starts from e568873.

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 new main; that rebase is always clean.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features
    • Added live, preview, and edit read modes across CMS requests, clients, and search, with results filtered according to the caller’s access.
    • Added context-aware CMS reads, revision history, and read-hook access details.
    • Client cache keys now distinguish configured read modes.
  • Bug Fixes
    • Public document lookups skip unreadable drafts so they no longer hide a matching readable document.
  • Documentation
    • Updated API, integration, and schema guides with access-context and read-mode guidance. Legacy session-based read options remain supported but are deprecated.

@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 044303f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@tanstack/cms-core Minor
@tanstack/cms-api Minor
@tanstack/cms-client Minor
@tanstack/search-cms Minor
@tanstack/cms-cli Minor
@tanstack/cms-connect-atproto Patch
@tanstack/cms-migrate-wp Patch
@tanstack/cms-skills Patch
@tanstack/cms-media-s3 Minor
@tanstack/cms-store-libsql Minor
@tanstack/cms-store-postgres Patch
@tanstack/cms-ui-dom Patch
@tanstack/cms-ui-react Minor

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

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Too many files!

This PR contains 324 files, which is 174 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.

Usage-priced reviews support at most 300 files.

Run configuration

  • Source mode: Auto
  • Repository: TanStack/cms
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 3b4a112
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 4dc68190-0648-424d-9d25-e14fa107e7f8
Commits

Reviewing files that changed from the base of the PR and between ad79df1 and a2c8059.

Files selected for processing: 324

  • .changeset/access-context-threading.md
  • .changeset/block-renderers-module.md
  • .changeset/cms-definition-entry.md
  • .changeset/create-routes.md
  • .changeset/definition-split.md
  • .changeset/doc-form-primitive.md
  • .changeset/field-renderers-module.md
  • .changeset/remove-role-cascades.md
  • .changeset/ssr-single-react.md
  • .claude/skills/astro-starlight-to-tanstack-cms/SKILL.md
  • .claude/skills/astro-starlight-to-tanstack-cms/scripts/migrate-starlight.mjs
  • .claude/skills/emdash-to-tanstack-cms/SKILL.md
  • .claude/skills/emdash-to-tanstack-cms/scripts/migrate-emdash.mjs
  • .claude/skills/payload-to-tanstack-cms/SKILL.md
  • .claude/skills/payload-to-tanstack-cms/scripts/migrate-data.mjs
  • .claude/skills/voting/SKILL.md
  • .claude/skills/wordpress-to-tanstack-cms/SKILL.md
  • .claude/skills/wordpress-to-tanstack-cms/scripts/migrate-wordpress.mjs
  • .gitignore
  • README.md
  • app/base/e2e/base.spec.ts
  • app/base/src/cms.config.ts
  • app/base/src/cms.definition.ts
  • app/base/src/collection-runtime.ts
  • app/base/src/model.ts
  • app/base/src/schema-registry.ts
  • app/base/tests/base.test.ts
  • app/base/tests/chat.test.ts
  • app/base/tests/schema-registry.test.ts
  • app/base/tests/worker.test.ts
  • app/base/tests/wp-evacuation.test.ts
  • app/base/vite.config.ts
  • app/prm/bakeoff/latest.json
  • app/prm/src/cms.config.ts
  • app/prm/src/cms.definition.ts
  • app/prm/src/collections.ts
  • app/prm/vite.config.ts
  • docs/agents/on-page-editor.md
  • docs/api/cli.md
  • docs/api/cms-core-server.md
  • docs/api/cms-core.md
  • docs/api/cms-ui-react.md
  • docs/api/routes-and-endpoints.md
  • docs/architecture/data-layer.md
  • docs/architecture/events-and-hooks.md
  • docs/architecture/overview.md
  • docs/architecture/routes-in-a-package.md
  • docs/architecture/terminology.md
  • docs/comparison/cms-landscape.md
  • docs/deployment/upgrading.md
  • docs/getting-started/agent-skills.md
  • docs/getting-started/overview.md
  • docs/getting-started/quick-start.md
  • docs/mcp/webmcp.md
  • docs/migration/from-astro-starlight.md
  • docs/migration/from-emdash.md
  • docs/migration/from-payload.md
  • docs/migration/from-sanity.md
  • docs/migration/from-wordpress.md
  • docs/migration/overview.md
  • docs/schema/blocks-and-rendering.md
  • docs/schema/building-pages.md
  • docs/schema/collections-and-fields.md
  • docs/schema/theming-and-variants.md
  • docs/tutorials/blog-cms.md
  • docs/tutorials/on-page-ai-editing.md
  • examples/astro-starlight-after/MIGRATION.md
  • examples/astro-starlight-after/README.md
  • examples/astro-starlight-after/package.json
  • examples/astro-starlight-after/scripts/migrate-starlight.mjs
  • examples/astro-starlight-after/src/cms.config.ts
  • examples/astro-starlight-after/src/cms.definition.ts
  • examples/astro-starlight-after/vite.config.ts
  • examples/blog-voting/README.md
  • examples/blog-voting/package.json
  • examples/blog-voting/src/cms.config.ts
  • examples/blog-voting/src/cms.definition.ts
  • examples/blog-voting/src/routes/top.tsx
  • examples/blog-voting/vite.config.ts
  • examples/blog/e2e/cms.spec.ts
  • examples/blog/package.json
  • examples/blog/src/cms.config.ts
  • examples/blog/src/cms.definition.ts
  • examples/blog/src/cms.renderers.tsx
  • examples/blog/vite.config.ts
  • examples/db-federated/package.json
  • examples/db-federated/src/cms.config.ts
  • examples/db-federated/src/cms.definition.ts
  • examples/db-federated/vite.config.ts
  • examples/db-markdown/src/cms.config.ts
  • examples/db-markdown/src/cms.definition.ts
  • examples/db-sqlite/README.md
  • examples/db-sqlite/package.json
  • examples/db-sqlite/src/cms.config.ts
  • examples/db-sqlite/src/cms.definition.ts
  • examples/db-sqlite/vite.config.ts
  • examples/emdash-after/MIGRATION.md
  • examples/emdash-after/README.md
  • examples/emdash-after/package.json
  • examples/emdash-after/scripts/migrate-emdash.mjs
  • examples/emdash-after/src/cms.config.ts
  • examples/emdash-after/src/cms.definition.ts
  • examples/emdash-after/vite.config.ts
  • examples/payload-after/MIGRATION.md
  • examples/payload-after/README.md
  • examples/payload-after/package.json
  • examples/payload-after/scripts/migrate-from-payload.mjs
  • examples/payload-after/src/cms.config.ts
  • examples/payload-after/src/cms.definition.ts
  • examples/payload-after/src/routeTree.gen.ts
  • examples/payload-after/vite.config.ts
  • examples/picks/package.json
  • examples/picks/src/cms.config.ts
  • examples/picks/src/cms.definition.ts
  • examples/picks/src/collection.ts
  • examples/picks/vite.config.ts
  • examples/wordpress-after/MIGRATION.md
  • examples/wordpress-after/README.md
  • examples/wordpress-after/package.json
  • examples/wordpress-after/scripts/migrate-wordpress.mjs
  • examples/wordpress-after/src/cms.config.ts
  • examples/wordpress-after/src/cms.definition.ts
  • examples/wordpress-after/vite.config.ts
  • knip.json
  • nx.json
  • package.json
  • packages/api/src/http.ts
  • packages/api/src/mcp.ts
  • packages/cli/README.md
  • packages/cli/src/commands/init.ts
  • packages/cli/src/index.ts
  • packages/cli/tests/cli.test.ts
  • packages/cms-connect-atproto/src/connector.ts
  • packages/cms-connect-atproto/src/index.ts
  • packages/cms-connect-atproto/tests/connector.test.ts
  • packages/cms-skills/src/engine/engine.ts
  • packages/cms-skills/src/engine/types.ts
  • packages/cms-skills/tests/skills.test.ts
  • packages/core/package.json
  • packages/core/src/assets.ts
  • packages/core/src/config.ts
  • packages/core/src/definition.ts
  • packages/core/src/index.ts
  • packages/core/src/interfaces.ts
  • packages/core/src/lib/authoring.ts
  • packages/core/src/lib/definition.ts
  • packages/core/src/lib/seo.ts
  • packages/core/src/lib/ui.ts
  • packages/core/src/schema.ts
  • packages/core/src/server/cms-as.ts
  • packages/core/src/server/store/internal.ts
  • packages/core/src/server/store/query.ts
  • packages/core/src/server/store/read.ts
  • packages/core/src/server/store/review.ts
  • packages/core/tests/access-context.test.ts
  • packages/core/tests/collections-array.test.ts
  • packages/core/tests/definition.test.ts
  • packages/core/tests/field-types.test.ts
  • packages/core/tests/plugins.test.ts
  • packages/core/tests/register-definition/register.ts
  • packages/core/tests/register-definition/tsconfig.json
  • packages/core/tests/schema.test.ts
  • packages/core/tests/seo.test.ts
  • packages/core/tests/ui.test.ts
  • packages/core/tsconfig.json
  • packages/core/tsdown.config.ts
  • packages/ui-dom/tests/ui-dom.test.ts
  • packages/ui-react/README.md
  • packages/ui-react/package.json
  • packages/ui-react/src/app-renderers.ts
  • packages/ui-react/src/components/blocks-view.tsx
  • packages/ui-react/src/components/content-list.tsx
  • packages/ui-react/src/components/editor/doc-form.tsx
  • packages/ui-react/src/components/editor/field-input.tsx
  • packages/ui-react/src/components/on-page-editor.tsx
  • packages/ui-react/src/components/on-page/page-content.tsx
  • packages/ui-react/src/components/on-page/post-content.tsx
  • packages/ui-react/src/index.ts
  • packages/ui-react/src/lib/renderers.ts
  • packages/ui-react/src/primitives.ts
  • packages/ui-react/src/routes/$.tsx
  • packages/ui-react/src/routes/__root.tsx
  • packages/ui-react/src/routes/agent.tsx
  • packages/ui-react/src/routes/content.tsx
  • packages/ui-react/src/routes/edit.$collection.$id.tsx
  • packages/ui-react/src/routes/index.tsx
  • packages/ui-react/src/routes/p.$id.tsx
  • packages/ui-react/src/routes/post.$id.tsx
  • packages/ui-react/src/routes/preview.$collection.$id.tsx
  • packages/ui-react/src/routes/review.tsx
  • packages/ui-react/src/routes/settings.tsx
  • packages/ui-react/src/site.ts
  • packages/ui-react/src/virtual-routes.ts
  • packages/ui-react/src/vite.ts
  • packages/ui-react/tests/doc-form.test.tsx
  • packages/ui-react/tests/field-renderers.test.tsx
  • packages/ui-react/tests/renderers.test.tsx
  • packages/ui-react/tests/s1-primitives-boundary.test.ts
  • packages/ui-react/tests/virtual-routes.test.ts
  • packages/ui-react/tests/vite-plugin.test.tsx
  • scripts/__fixtures__/definitions/clean/cms.definition.ts
  • scripts/__fixtures__/definitions/clean/collections.ts
  • scripts/__fixtures__/definitions/core-root-source/cms.definition.ts
  • scripts/__fixtures__/definitions/core-root-source/collections.ts
  • scripts/__fixtures__/definitions/core-root/cms.definition.ts
  • scripts/__fixtures__/definitions/definition-only/cms.definition.ts
  • scripts/__fixtures__/definitions/definition-only/collections.ts
  • scripts/__fixtures__/definitions/no-export/cms.definition.ts
  • scripts/__fixtures__/definitions/react/cms.definition.ts
  • scripts/__fixtures__/definitions/server-file/access.server.ts
  • scripts/__fixtures__/definitions/server-file/cms.definition.ts
  • scripts/__fixtures__/definitions/start/cms.definition.ts
  • scripts/__fixtures__/definitions/tsx-file/cms.definition.ts
  • scripts/__fixtures__/definitions/tsx-file/hero.tsx
  • scripts/__fixtures__/definitions/ui-react-root/cms.definition.ts
  • scripts/codemods/__fixtures__/create-routes/admin-base-path.input.ts
  • scripts/codemods/__fixtures__/create-routes/admin-base-path.output.ts
  • scripts/codemods/__fixtures__/create-routes/admin-base-path.warnings.json
  • scripts/codemods/__fixtures__/create-routes/bare.input.ts
  • scripts/codemods/__fixtures__/create-routes/bare.output.ts
  • scripts/codemods/__fixtures__/create-routes/base.input.ts
  • scripts/codemods/__fixtures__/create-routes/base.output.ts
  • scripts/codemods/__fixtures__/create-routes/build-options.input.ts
  • scripts/codemods/__fixtures__/create-routes/build-options.output.ts
  • scripts/codemods/__fixtures__/create-routes/build-options.warnings.json
  • scripts/codemods/__fixtures__/create-routes/docs.input.md
  • scripts/codemods/__fixtures__/create-routes/docs.output.md
  • scripts/codemods/__fixtures__/create-routes/prm.input.ts
  • scripts/codemods/__fixtures__/create-routes/prm.output.ts
  • scripts/codemods/__fixtures__/create-routes/unreadable.input.ts
  • scripts/codemods/__fixtures__/create-routes/unreadable.warnings.json
  • scripts/codemods/__fixtures__/definition-split/already-split/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/docs.input.md
  • scripts/codemods/__fixtures__/definition-split/docs.output.md
  • scripts/codemods/__fixtures__/definition-split/function/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/function/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/function/cms.definition.created.ts
  • scripts/codemods/__fixtures__/definition-split/local/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/local/cms.config.warnings.json
  • scripts/codemods/__fixtures__/definition-split/plugin.input.ts
  • scripts/codemods/__fixtures__/definition-split/plugin.output.ts
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.config.warnings.json
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.definition.created.ts
  • scripts/codemods/__fixtures__/definition-split/shared/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/shared/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/shared/cms.definition.created.ts
  • scripts/codemods/__fixtures__/definition-split/variable/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/variable/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/variable/cms.definition.created.ts
  • scripts/codemods/create-routes.ts
  • scripts/codemods/definition-split.test.ts
  • scripts/codemods/definition-split.ts
  • scripts/codemods/explicit-roles.ts
  • scripts/codemods/fixtures.test.ts
  • scripts/codemods/harness.test.ts
  • scripts/codemods/index.ts
  • scripts/codemods/lib/harness.ts
  • scripts/dialect-inventory.baseline.json
  • scripts/dialect-inventory.test.ts
  • scripts/dialect-inventory.ts
  • scripts/lib/definition-guard.mjs
  • scripts/lib/load-definition.mjs
  • scripts/pack-consumer.mjs
  • scripts/seo-snapshots/__snapshots__/examples__astro-starlight-after.json
  • scripts/seo-snapshots/__snapshots__/examples__blog-voting.json
  • scripts/seo-snapshots/__snapshots__/examples__blog.json
  • scripts/seo-snapshots/__snapshots__/examples__emdash-after.json
  • scripts/seo-snapshots/__snapshots__/examples__payload-after.json
  • scripts/seo-snapshots/__snapshots__/examples__wordpress-after.json
  • scripts/seo-snapshots/__snapshots__/starters__themed-smb-site.json
  • scripts/smoke-ssr.mjs
  • scripts/verify-definitions.test.ts
  • scripts/verify-definitions.ts
  • starters/admin-only/CMS-INTEGRATION.md
  • starters/admin-only/src/cms.config.ts
  • starters/admin-only/src/cms.definition.ts
  • starters/admin-only/tests/seam.test.ts
  • starters/contact-cards/CMS-INTEGRATION.md
  • starters/contact-cards/src/cms.config.ts
  • starters/contact-cards/src/cms.definition.ts
  • starters/contact-cards/tests/seam.test.ts
  • starters/directory-listings/CMS-INTEGRATION.md
  • starters/directory-listings/src/cms.config.ts
  • starters/directory-listings/src/cms.definition.ts
  • starters/documentation-kb/CMS-INTEGRATION.md
  • starters/documentation-kb/src/cms.config.ts
  • starters/documentation-kb/src/cms.definition.ts
  • starters/ecommerce-storefront/CMS-INTEGRATION.md
  • starters/ecommerce-storefront/src/cms.config.ts
  • starters/ecommerce-storefront/src/cms.definition.ts
  • starters/editorial-publication/CMS-INTEGRATION.md
  • starters/editorial-publication/src/cms.config.ts
  • starters/editorial-publication/src/cms.definition.ts
  • starters/existing-app/CMS-INTEGRATION.md
  • starters/existing-app/S7-CHECKLIST.md
  • starters/existing-app/src/cms.config.ts
  • starters/existing-app/src/cms.definition.ts
  • starters/existing-app/tests/seam.test.ts
  • starters/headless-api/CMS-INTEGRATION.md
  • starters/headless-api/src/cms.config.ts
  • starters/headless-api/src/cms.definition.ts
  • starters/membership-course/CMS-INTEGRATION.md
  • starters/membership-course/src/cms.config.ts
  • starters/membership-course/src/cms.definition.ts
  • starters/multi-tenant-fleet/CMS-INTEGRATION.md
  • starters/multi-tenant-fleet/src/cms.config.ts
  • starters/multi-tenant-fleet/src/cms.definition.ts
  • starters/runtime-tables/CMS-INTEGRATION.md
  • starters/runtime-tables/src/generated-views.tsx
  • starters/runtime-tables/tests/seam.test.ts
  • starters/team-ops/CMS-INTEGRATION.md
  • starters/team-ops/src/cms.config.ts
  • starters/team-ops/src/cms.definition.ts
  • starters/team-ops/tests/seam.test.ts
  • starters/themed-smb-site/CMS-INTEGRATION.md
  • starters/themed-smb-site/src/cms.config.ts
  • starters/themed-smb-site/src/cms.definition.ts
  • starters/themed-smb-site/src/cms.renderers.tsx
  • starters/themed-smb-site/src/theme.tsx
  • starters/themed-smb-site/tests/seam.test.ts
  • tsconfig.docs.json
  • tsconfig.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

TanStack is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.

  • Ask an admin to upgrade

Open in CodeRabbit

Walkthrough

The pull request threads explicit access contexts through core reads, operations, events, API requests, client read modes, caching, and search. It adds context-aware APIs, preserves deprecated session options, and adds tests and documentation.

Changes: Access context contracts and core reads

Layer / File(s) Summary
Access context contracts and builders
packages/core/src/lib/access-context.ts, packages/core/src/server/access-context.ts, packages/core/src/ops.ts, packages/core/src/schema.ts
The core defines access-context types, builders, read-mode parsing, validation, actor identities, and access-aware hook arguments. CmsOpContext.access is required.
Context-aware CMS reads
packages/core/src/server/cms-as.ts, packages/core/src/server/store/*, packages/core/src/server/cms-ops.ts
Bound reads and ...As functions use access contexts for filtering, redaction, revisions, relations, translations, and read hooks.
Events and tools
packages/core/src/server/dispatcher.ts, packages/core/src/server/cms-tools.ts, packages/core/src/events.ts
Event handlers receive system access contexts. Tool calls select runtime or configured access contexts before operation dispatch.

API, client, and search integration

Layer / File(s) Summary
API request and operation access
packages/api/src/ops.ts, packages/api/src/start.ts, packages/api/src/http.ts, packages/api/src/mcp.ts
Requests resolve access contexts from sessions, options, and x-cms-read-mode. Operations, MCP, WebMCP, event visibility, and media checks use those contexts.
Client read modes and cache keys
packages/client/src/client.ts, packages/client/src/keys.ts
Clients can send a configured read mode. Mode-specific cache keys distinguish live and edit reads.
Search access contexts
packages/search-cms/src/index.ts, packages/search-cms/tests/cms.test.ts
Search accepts an explicit access context and uses context-aware query and grouping functions. Legacy session and read options remain supported and are deprecated.

Supporting updates

Layer / File(s) Summary
Application helpers and tests
app/base/src/schema-registry.server.ts, app/base/tests/*, packages/api/tests/*, packages/core/tests/*, packages/client/tests/*
Application and test contexts now include edit-mode access contexts. Tests cover read modes, authorization, hooks, events, operations, client caching, and search totals.
Documentation and release metadata
.changeset/access-context-threading.md, docs/api/*, docs/architecture/*, docs/schema/*, docs/tutorials/*, .claude/skills/search-integration/SKILL.md
Documentation describes access-context APIs, read modes, event contexts, client behavior, search integration, and deprecated session-based forms.

Estimated code review effort: 5 (Critical) | ~90 minutes

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: TanStack/cms
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 0decb56
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 382100f0-c7c5-4f37-91be-095a156437ef
Commits

Reviewing files that changed from the base of the PR and between 0decb56 and ad79df1.

Files selected for processing: 50

  • .changeset/access-context-threading.md
  • .claude/skills/search-integration/SKILL.md
  • app/base/src/schema-registry.server.ts
  • app/base/tests/base.test.ts
  • app/base/tests/schema-registry.test.ts
  • app/base/tests/worker.test.ts
  • docs/api/cms-api.md
  • docs/api/cms-client.md
  • docs/api/cms-core-server.md
  • docs/architecture/events-and-hooks.md
  • docs/schema/building-pages.md
  • docs/schema/collections-and-fields.md
  • docs/tutorials/faceted-search.md
  • packages/api/src/http.ts
  • packages/api/src/index.ts
  • packages/api/src/interface-ops.ts
  • packages/api/src/mcp.ts
  • packages/api/src/media-ops.ts
  • packages/api/src/ops.ts
  • packages/api/src/start.ts
  • packages/api/tests/access-context.test.ts
  • packages/client/src/client.ts
  • packages/client/src/index.ts
  • packages/client/src/keys.ts
  • packages/client/tests/client.test.ts
  • packages/core/src/events.ts
  • packages/core/src/index.ts
  • packages/core/src/lib/access-context.ts
  • packages/core/src/ops.ts
  • packages/core/src/schema.ts
  • packages/core/src/server.ts
  • packages/core/src/server/access-context.ts
  • packages/core/src/server/cms-as.ts
  • packages/core/src/server/cms-ops.ts
  • packages/core/src/server/cms-tools.ts
  • packages/core/src/server/dispatcher.ts
  • packages/core/src/server/interface-schedules.ts
  • packages/core/src/server/interfaces.ts
  • packages/core/src/server/store.ts
  • packages/core/src/server/store/internal.ts
  • packages/core/src/server/store/query.ts
  • packages/core/src/server/store/read.ts
  • packages/core/src/server/store/review.ts
  • packages/core/src/server/store/revisions.ts
  • packages/core/tests/access-context.test.ts
  • packages/core/tests/events.test.ts
  • packages/core/tests/interface-schedules.test.ts
  • packages/core/tests/interfaces.test.ts
  • packages/search-cms/src/index.ts
  • packages/search-cms/tests/cms.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@cursor
cursor Bot force-pushed the cursor/access-context-threading-a931 branch from ad79df1 to f70436c Compare November 6, 2026 03:09
@cursor
cursor Bot force-pushed the cursor/access-context-threading-a931 branch from f70436c to a2c8059 Compare November 6, 2026 14:50
…, MCP, hooks and events (#26)

Chain step 10 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>
@jherr
jherr force-pushed the cursor/access-context-threading-a931 branch from a2c8059 to 044303f Compare November 6, 2026 15:07
@jherr
jherr merged commit 4f8e841 into main Nov 6, 2026
1 check passed
@jherr
jherr deleted the cursor/access-context-threading-a931 branch November 8, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants