Skip to content

feat(core,api,ui-react)!: default flow Draft → Pending Review → Approved → Published; PRM's owner-direct strategy; S3 restated (4d) - #37

Merged
jherr merged 1 commit into
mainfrom
cursor/phase-4d-default-flow-02f8
Nov 6, 2026
Merged

jherr merged 1 commit into
mainfrom
cursor/phase-4d-default-flow-02f8

Conversation

@jherr

@jherr jherr commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Implements cms-refactor-plan.md § Phase 4 (4d):

  • the new default-flow naming (Pending Review, Approved);
  • per-collection overrides;
  • PRM's "owner direct, agent review" as an explicit strategy;
  • the S3 rewrite in starters/ARCHITECTURE.md.

It also covers § 7 layer 3.

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

What

  • reviewStrategy() runs Draft → Pending Review → Approved → Published.
    • Labels: Draft, Pending Review (was Pending review), Approved, Published, Unpublished.
    • Approving without publish rights. A reviewer with review.decide but not content.publish approves into approved. That emits review.approved, is audited as transitioned, and leaves the live document untouched.
    • Publishing an approved change set. A publisher's publish commits and publishes it. An approved deletion is offered as Delete and needs content.delete. A scheduled change set takes the same path.
    • Publisher fast path. A reviewer who can publish still approves and publishes in one decision, so every starter, example and default role behaves as before.
    • Resubmission. A new submission sends an approved change back to Pending Review.
    • Offered actions in approved. Publishers get Publish (or Delete), reviewers get Reject, and a reviewer can't approve twice.
    • Charts. describe() adds the Approved node, and the regenerated chart is checked by 4c's drift test. directStrategy() now charts only its own states.
  • Per-collection overrides use 4a's collection.documentState, unchanged.
  • API and UI:
    • approveChange passes a reviewer without content.publish through to the strategy after a read check. Core re-checks access for any decision that writes live content.
    • /review shows non-publishing reviewers a single Approve button (review.approve). Publishers see Publish on approved changes, through actOnChange.
  • PRM. app/prm/src/document-state.ts exports ownerDirectAgentReview({ autoApprove }), which replaces review.autoApprove.
    • A person who may publish commits their own edit, submit and import saves directly.
    • These go through review: agents, MCP keys, import_people, people without publish rights, and every change-set decision.
  • Seam S3 now reads "Every write passes through one door — the collection's document state strategy". It says plainly that the code was looser than the old "everything staged" wording, and that this restatement aligns the docs with what is enforced.
  • Docs: review-queue.md (states, the reviewer/publisher split, a reviewer role example, the chart), terminology.md, and the approveChange rows in the op tables.

Breaking changes (default-flow-approved.md: core, api and ui-react minor)

  • Labels and state. The labels become Pending Review and the new Approved, and ReviewState gains 'approved'.
  • approveChange without publish rights. When called by a reviewer without content.publish, it used to return FORBIDDEN. It now moves the change to Approved.
  • No second event. Publishing an approved change set doesn't emit a second review.approved.
  • directStrategy().describe() charts only Unpublished, Published and Draft.

How verified

GitHub Actions is out of billing, so everything ran locally. On a scratch branch, I merged head 132dccc into origin/main at 3b4a112.

Check Result
pnpm install --frozen-lockfile passes
pnpm test:ci Only the known @tanstack/cms-api:test:oxlint fails. The starters' seam suites, app/prm and app/base all pass.
test:dts / test:dialects / test:scripts pass / pass / 59
E2E blog / base blog 28/28 (asserts Pending Review); base 12/12
Characterization core / libsql / postgres 37 / 83 / 120
Packages core 628, api 206, ui-react 85, app/prm 10. tsc, oxlint, knip, test:docs and kiira (128/128) are clean.

New tests:

  • Core:
    • a reviewer who can't publish approves into Approved, and a publisher applies it;
    • resubmission returns the change to Pending Review;
    • an approved deletion needs content.delete;
    • a publisher approves and publishes in one decision.
  • Api: approving into Approved and then publishing, through approveChange, reviewSnapshot and actOnChange.
  • app/prm: "owner direct, agent review", with approvalRequired on and off.

Assumptions (tasks 8–12 defaults)

  1. Approved shows up only when reviewing and publishing are separate roles. The publisher fast path stays.
  2. "Can publish" is the context's global content.publish permission. A collection rule that denies publishing makes core refuse the commit.
  3. review@1 isn't bumped, because states were added and none were removed.
  4. Per-collection overrides use the existing collection.documentState.
  5. review.approved fires at approval, not at publish.
  6. PRM: people without content.publish and non-user actors go through review. import_people stays reviewed.
  7. PRM strategy id prm-owner-direct@1. Change sets written under review@1 by an unreleased 4b/4c build would be stranded and need a discard. Released PRM data has no stored strategy state.

Divergence from plan

  1. The publisher fast path stays. No default role is a reviewer without publish rights, so the docs show a reviewer: ['content.read', 'review.decide'] role.
  2. PRM's strategy lives in app/prm, composed from the two built-ins.
  3. directStrategy() has its own chart.
  4. The XState example's label becomes Pending Review (…).
  5. The starters' seam tests are unchanged.

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: app/prm/src/cms.config.ts is now defineCms(definition, { …, documentState: ownerDirectAgentReview({ autoApprove }) }).

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 

@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: df9b7ed

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-ui-react 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
@tanstack/cms-ui-dom 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 →

Caution

Review failed

The pull request is closed.

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

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

…ved → Published; PRM's owner-direct strategy; S3 restated (4d) (#37)

Chain step 14 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/phase-4d-default-flow-02f8 branch from b27fa37 to df9b7ed Compare November 6, 2026 15:08
@jherr
jherr merged commit 5c474b0 into main Nov 6, 2026
@jherr
jherr deleted the cursor/phase-4d-default-flow-02f8 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