Skip to content

feat(core)!: change sets carry strategy state; publish/update events, one source per change set, stale proposals, change-set scheduling (4b) - #29

Merged
jherr merged 1 commit into
mainfrom
cursor/phase-4b-change-sets-02f8
Nov 6, 2026
Merged

jherr merged 1 commit into
mainfrom
cursor/phase-4b-change-sets-02f8

Conversation

@jherr

@jherr jherr commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Implements cms-refactor-plan.md § Phase 4 (4b) and § 7 (document state strategy):

Merge chain: step 12 of 24. Base: main. Merge it right after #27. The branch is main 3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commit 730fd75 (tree 227646c).

What

  • Strategy state lives on the change set. A decision's state is stored on the document's one coalesced change set and handed back as ChangeSetView.workflow on the next decision.
    • If the change set was written by an older version of the same strategy, its state is upgraded with migrate.
    • Otherwise the change set is stranded: another strategy wrote it, or there's no migrate, or migrate fails. Core then refuses every decision on it except discard and emit. The new listStrandedChangeSets() lists them.
  • New audit transition fields: changeSet, from / to state, effects and reason. There's a new transitioned decision for a change set that moves to a new state or gets a publish time.
  • Stage decisions are audited (coordinator ruling, 2026-11-06, from the plan's mandatory-audit rule). The affected characterization rows are relabelled "decided in phase 4".
  • One event vocabulary (coordinator ruling, 2026-11-06). The bus, webhooks and SSE deliver the durable document.* names: document.created, document.updated, document.published, document.unpublished and document.deleted.
    • The short names (publish, unpublish, delete, change, update) still match in subscriptions and webhook events lists as deprecated aliases until phase 6.
    • Deliveries always carry the document.* name.
  • docs: add architecture diagrams to the README (data loading, storage, mutations) #2: published means going live. document.published fires only on the unpublished → published transition. Saving a document that stays live fires document.updated, which the update alias matches.
  • store-postgres tests: start an embedded Postgres when POSTGRES_TEST_URL is unset #4: one source per change set. While a change set is open, a write from another source fails with CONFLICT, naming the open change set. Same-source re-saves merge onto it.
  • ci(assembly): move concurrency to job level #5: stale proposals. A direct commit that doesn't overlap an open proposal rebases the proposal onto the new live revision. An overlapping commit invalidates it: the proposal is discarded through the strategy and audited with reason stale, and the proposer gets review.discarded.
  • docs(architecture): add mermaid architecture diagrams #7: scheduling a change set. Scheduling a future publish on a live document schedules the change set, and the live version stays up. A scheduler sweep later fires the strategy's publish action as actor scheduler.
  • Migrations: SQLite/libsql v16 and Postgres v8. Both are additive. Postgres has a down migration.
  • Storage conformance gains round-trip tests for change-set workflow state, change-set scheduling and the audit transition fields.
  • Review screen: labels transitioned decisions as "advanced".

Breaking changes

The changeset, document-state-change-sets.md, is minor for core, api and store-postgres and a patch for client and ui-react.

  • Event names. Deliveries carry document.* names. Code that switches on the delivered name must use them. Filters that use the short names keep matching until phase 6.
  • Published events fire only when a document goes live. Cache-purge listeners, and webhooks with an explicit events list, must add document.updated (or update). The upgrade guide has a recipe.
  • Cross-source writes while a change set is open now return CONFLICT instead of absorbing the change set.
  • Approving an invalidated proposal returns NOT_FOUND.
  • Scheduling a future publish on a live document no longer unpublishes it. With nothing pending, it returns BAD_REQUEST.
  • Stage decisions add audit rows.
  • Custom storage adapters should persist PendingRecord.workflow and publishAt, and the new audit fields.

Assumptions (tasks 8–12 defaults)

  1. Save event name: the event for saving live content is document.updated on a document that stays live, with the alias update.
  2. Stale notice: the stale notification is the strategy's discard with reason: 'stale'.
  3. Scheduled publish: a scheduled change-set publish is the publish action with input.changeSet.
  4. Audit decision: transitioned covers state-only and change-set-schedule decisions.
  5. Versioning: a rebase bumps the change-set version.
  6. Agent floor: it treats schedule({ publishAt }) like publish.
  7. Overlap: it compares values, so a field both sides set to the same value isn't a conflict.

Divergence from plan

  • Postgres stores only the lookup fields as columns. from, to, effects and reason stay in the record JSONB.
  • A rebase isn't audited. The commit that caused it is.
  • A staged delete counts as overlapping any change.
  • The admin review UI (strategy labels, available actions, stranded and scheduled change sets) moves to 4c.

How verified

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. Three conflicts:

  • the plugin example in cms-core.md, now in the definition/runtime form with document.published;
  • upgrading step 24;
  • the imports in plugins.test.ts.

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: 1241dde

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/cms-store-postgres Minor
@tanstack/cms-ui-react 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/search-cms Patch
@tanstack/cms-store-libsql Minor
@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

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: TanStack/cms
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 260814f
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 850cc3fa-b8b4-48b9-8fc8-b26e270e9408
Commits

Reviewing files that changed from the base of the PR and between 260814f and 1241dde.

Files selected for processing: 56

  • .changeset/document-state-change-sets.md
  • docs/agents/review-queue.md
  • docs/api/cms-client.md
  • docs/api/cms-core-server.md
  • docs/api/cms-core.md
  • docs/api/routes-and-endpoints.md
  • docs/architecture/terminology.md
  • docs/deployment/upgrading.md
  • packages/api/src/http.ts
  • packages/api/src/openapi.ts
  • packages/api/src/ops.ts
  • packages/api/tests/characterization/save-paths.test.ts
  • packages/api/tests/events.test.ts
  • packages/api/tests/health.test.ts
  • packages/api/tests/helpers.ts
  • packages/api/tests/readiness.test.ts
  • packages/api/tests/workflow.test.ts
  • packages/client/src/db.ts
  • packages/client/tests/db.test.ts
  • packages/core/src/config.ts
  • packages/core/src/document-state.ts
  • packages/core/src/index.ts
  • packages/core/src/server.ts
  • packages/core/src/server/events.ts
  • packages/core/src/server/outbox.ts
  • packages/core/src/server/storage.ts
  • packages/core/src/server/store.ts
  • packages/core/src/server/store/document-state.ts
  • packages/core/src/server/store/internal.ts
  • packages/core/src/server/store/scheduling.ts
  • packages/core/src/server/store/write.ts
  • packages/core/src/server/transfer.ts
  • packages/core/src/server/webhooks.ts
  • packages/core/src/storage/conformance.ts
  • packages/core/src/storage/migrations.ts
  • packages/core/src/storage/sql-storage.ts
  • packages/core/src/storage/types.ts
  • packages/core/tests/characterization/workflow-suite.ts
  • packages/core/tests/document-state-strategy.sketch.test.ts
  • packages/core/tests/document-state.test.ts
  • packages/core/tests/plugins.test.ts
  • packages/core/tests/readiness.test.ts
  • packages/core/tests/seo.test.ts
  • packages/core/tests/storage-conformance.test.ts
  • packages/core/tests/store.test.ts
  • packages/core/tests/transfer.test.ts
  • packages/core/tests/webhooks-outbox.test.ts
  • packages/store-postgres/README.md
  • packages/store-postgres/src/index.ts
  • packages/store-postgres/src/migrations.ts
  • packages/store-postgres/tests/events.test.ts
  • packages/store-postgres/tests/invariants.test.ts
  • packages/ui-react/src/lib/i18n.ts
  • packages/ui-react/src/routes/review.tsx
  • scripts/dialect-inventory.baseline.json
  • scripts/dialect-inventory.ts

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

… one source per change set, stale proposals, change-set scheduling (4b) (#29)

Chain step 12 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-4b-change-sets-02f8 branch from 730fd75 to 1241dde Compare November 6, 2026 15:07
@jherr
jherr merged commit 2b1aee0 into main Nov 6, 2026
@jherr
jherr deleted the cursor/phase-4b-change-sets-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