Skip to content

feat!: remove heuristic role cascades (R1b) - #23

Merged
jherr merged 1 commit into
mainfrom
cursor/remove-role-cascades-6828
Nov 6, 2026
Merged

jherr merged 1 commit into
mainfrom
cursor/remove-role-cascades-6828

Conversation

@jherr

@jherr jherr commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Implements cms-refactor-plan.md § 8 / Track R1b.

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

What

  • Field-name lists and cross-role fallbacks are removed.
    • cmsHead and cmsJsonLd no longer guess the description, image, date or author from field names, and no longer take them from the first block.
    • The title reads only titleField.
    • getSummaryField and getBylineField return only the declared role.
    • The on-page editor's defaults are reduced to title, and post cards read only declared roles.
  • Per-block aliases are removed. renderBlockToHtml in ui-dom now uses the same field names as the React renderer and the docs: image.image (was src) and callout.markdown (was body).
  • One deterministic rule per role remains (Q20). These are documented in collections-and-fields.md:
    • the first image field is the image;
    • the first markdown or richtext field that isn't the summary is the body;
    • the first blocks field holds the blocks;
    • the field named slug is the slug.
  • Docs, skills, tests and the dialect baseline are updated. The seoCascadeFields count drops from 9 to 0.
  • Changeset: remove-role-cascades.md names the silent behaviour change and points to the codemod.

Breaking changes (silent)

  • Undeclared roles go blank, with no error. A collection that doesn't declare summaryField, bylineField or dateField, or has no image field, loses:

    • its meta description and social image;
    • datePublished and the JSON-LD author;
    • the on-page summary and byline;
    • the post-card summary and byline.

    To fix, run pnpm codemod explicit-roles <app> before upgrading.

  • ui-dom block field renames. Blocks that store image.src or callout.body must rename those fields.

Divergence from plan

  • Not every R1a SEO snapshot stays unchanged. Every collection that declares roles renders exactly as before. The exception is the blocks-only page collections in the blog, blog-voting, payload, astro-starlight, emdash and wordpress examples and the themed-smb-site starter. Their description and image came from the first block, which is a banned cross-role fallback, and they have no document field to declare as the role. Those snapshot entries are updated, and the changeset tells users to add an seoField() or a declared summary or image field.
  • A new dateField role (added in R1a). It replaces the publishedDate/publishAt/date name cascade.
  • Left as follow-ups: the default text and image field lists in cms-connect-atproto, and the editor sizing for excerpt/description in ui-react. Both are name heuristics outside role resolution.
  • Skill count. The plan counts five migration skills; there are four.

Assumptions (tasks 8–12 defaults): none.

How verified

  • I ran nx affected with the CI test:pr targets, plus test:dts, test:dialects and test:scripts.
  • Everything passes, including the characterization suite, except the cms-api oxlint error that main already has.

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.

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

  • Breaking Changes
    • Content roles such as summary, byline, and date are no longer inferred from field names. Declare roles explicitly to keep associated editor content and SEO metadata visible.
    • Built-in blocks now read canonical field names only; legacy aliases no longer provide content.
  • Bug Fixes
    • Fixed an SSR issue that could cause duplicate React instances and “Invalid hook call” errors in pnpm-installed apps.
  • Documentation
    • Updated role and SEO guidance, including a codemod for declaring roles previously inferred automatically.

@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e710a5a

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-ui-react Minor
@tanstack/cms-ui-dom Minor
@tanstack/cms-api Minor
@tanstack/cms-cli Minor
@tanstack/cms-client Minor
@tanstack/cms-connect-atproto Patch
@tanstack/cms-migrate-wp Patch
@tanstack/cms-skills Patch
@tanstack/cms-media-s3 Minor
@tanstack/search-cms Patch
@tanstack/cms-store-libsql Minor
@tanstack/cms-store-postgres Patch

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 →

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 change removes field-name fallbacks for collection roles and built-in block fields. It also adds SSR shim handling to the Vite plugin and a shared smoke check for built example apps.

Changes: Declared Roles and Block Fields

Layer / File(s) Summary
Role resolution and migration guidance
packages/core/src/schema.ts, packages/core/tests/schema.test.ts, docs/api/cms-core.md, docs/schema/collections-and-fields.md, docs/deployment/upgrading.md, scripts/codemods/explicit-roles.ts, .changeset/remove-role-cascades.md
Summary and byline lookup now require declared fields. Body lookup uses the first eligible markdown or richtext field. Documentation and tests describe the remaining defaults and codemod.
SEO metadata from collection roles
packages/core/src/lib/seo.ts, packages/core/tests/seo.test.ts, scripts/seo-snapshots/__snapshots__/*, docs/schema/building-pages.md
SEO metadata and JSON-LD use configured role fields instead of the removed field-name and block-content fallbacks. Tests and snapshots reflect the resulting metadata.
Canonical built-in block fields
packages/core/src/lib/ui.ts, packages/core/tests/ui.test.ts, packages/ui-dom/tests/ui-dom.test.ts, packages/ui-react/src/components/blocks-view.tsx, docs/schema/blocks-and-rendering.md, .changeset/remove-role-cascades.md
Built-in block renderers now read canonical field names and ignore the listed aliases. Tests and documentation use the canonical fields.
Editor role selection and release notes
packages/ui-react/src/components/on-page/post-content.tsx, docs/api/cms-ui-react.md, docs/agents/on-page-editor.md, .claude/skills/emdash-to-tanstack-cms/SKILL.md, .changeset/remove-role-cascades.md
Without a collection, the on-page editor now supplies only the title role. Editor guidance and release notes describe declared role behavior.

SSR Shim Resolution and Smoke Checks

Layer / File(s) Summary
SSR shim resolution and plugin tests
packages/ui-react/src/vite.ts, packages/ui-react/tests/vite-plugin.test.tsx, docs/architecture/routes-in-a-package.md, .changeset/ssr-single-react.md
The Vite plugin resolves and loads selected SSR shim modules backed by React hooks. Tests cover resolution, rendering, store updates, and selection equality.
Example app plugin wiring
examples/*/vite.config.ts
Example Vite configurations register tanstackCms() and remove the listed SSR noExternal entries.
Built-server smoke check integration
scripts/smoke-ssr.mjs, examples/*/package.json, nx.json, knip.json
A shared script starts a built app, checks paths and server output, and cleans up. Example scripts and workspace configuration register the check.

E2E Approval Helper

Layer / File(s) Summary
Review approval test helper
app/base/e2e/base.spec.ts
A helper approves the first pending change and verifies that the pending count decreases. Five tests now use it.

Estimated code review effort: 4 (Complex) | ~50 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ViteSSR
  participant TanStackCmsPlugin
  participant React
  ViteSSR->>TanStackCmsPlugin: Resolve SSR shim import
  TanStackCmsPlugin-->>ViteSSR: Return virtual module ID
  ViteSSR->>TanStackCmsPlugin: Load virtual module
  TanStackCmsPlugin-->>ViteSSR: Return ESM source using React hooks
  ViteSSR->>React: Render with useSyncExternalStore
Loading
  • 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: 3b4a112
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 3c096626-8850-47a1-945b-b207a68c213d
Commits

Reviewing files that changed from the base of the PR and between 3b4a112 and 33e0766.

Files selected for processing: 49

  • .changeset/remove-role-cascades.md
  • .changeset/ssr-single-react.md
  • .claude/skills/emdash-to-tanstack-cms/SKILL.md
  • app/base/e2e/base.spec.ts
  • docs/agents/on-page-editor.md
  • docs/api/cms-core.md
  • docs/api/cms-ui-react.md
  • docs/architecture/routes-in-a-package.md
  • docs/deployment/upgrading.md
  • docs/schema/blocks-and-rendering.md
  • docs/schema/building-pages.md
  • docs/schema/collections-and-fields.md
  • examples/astro-starlight-after/package.json
  • examples/astro-starlight-after/vite.config.ts
  • examples/blog-voting/package.json
  • examples/blog-voting/vite.config.ts
  • examples/blog/package.json
  • examples/db-federated/package.json
  • examples/db-sqlite/package.json
  • examples/emdash-after/package.json
  • examples/emdash-after/vite.config.ts
  • examples/payload-after/package.json
  • examples/payload-after/vite.config.ts
  • examples/picks/package.json
  • examples/wordpress-after/package.json
  • examples/wordpress-after/vite.config.ts
  • knip.json
  • nx.json
  • packages/core/src/lib/seo.ts
  • packages/core/src/lib/ui.ts
  • packages/core/src/schema.ts
  • packages/core/tests/schema.test.ts
  • packages/core/tests/seo.test.ts
  • packages/core/tests/ui.test.ts
  • packages/ui-dom/tests/ui-dom.test.ts
  • packages/ui-react/src/components/blocks-view.tsx
  • packages/ui-react/src/components/on-page/post-content.tsx
  • packages/ui-react/src/vite.ts
  • packages/ui-react/tests/vite-plugin.test.tsx
  • scripts/codemods/explicit-roles.ts
  • scripts/dialect-inventory.baseline.json
  • 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

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

@jherr
jherr force-pushed the cursor/explicit-roles-6828 branch from 93a9a48 to a3acc49 Compare November 6, 2026 02:39
@cursor
cursor Bot force-pushed the cursor/explicit-roles-6828 branch from a3acc49 to 8553f16 Compare November 6, 2026 02:57
@cursor
cursor Bot force-pushed the cursor/remove-role-cascades-6828 branch from c409c56 to 1a864e0 Compare November 6, 2026 02:57
@jherr
jherr changed the base branch from cursor/explicit-roles-6828 to main November 6, 2026 03:16
@jherr
jherr force-pushed the cursor/remove-role-cascades-6828 branch from 1a864e0 to 7dcb118 Compare November 6, 2026 03:17
@cursor
cursor Bot force-pushed the cursor/remove-role-cascades-6828 branch from 7dcb118 to 33e0766 Compare November 6, 2026 14:50
Chain step 3 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/remove-role-cascades-6828 branch from 33e0766 to e710a5a Compare November 6, 2026 15:05
@jherr
jherr merged commit 863f6e1 into main Nov 6, 2026
1 of 8 checks passed
@jherr
jherr deleted the cursor/remove-role-cascades-6828 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