Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/document-state-acceptance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@tanstack/cms-core': minor
---

The document state strategy acceptance suite ships as `@tanstack/cms-core/document-state/acceptance`: `runDocumentStateAcceptance(name, { database, strategies }, runner)` runs the parallel-approval spec (eleven steps plus core's rules) with an injected test runner and strategies, and the built-in SQLite, libsql and Postgres storages all run it. The XState parallel-approval example in the new "Custom Document State Strategies" docs page passes it. New exports: `stateGraphToMermaid(graph)` (a Mermaid chart of a strategy's `describe()`; the review-queue docs embed the default strategy's) and, from `@tanstack/cms-core/server`, `readChangeSet(collection, id)` (the open change set as its strategy reads it).

Breaking changes:

- Core no longer asks the strategy about a stranded change set. Every action on it except `discard` is refused (`rule: 'stranded'`), and core runs the `discard` itself for a reviewer (`review.decide`, not an agent); a strategy's emits on that discard no longer run. `availableDocumentActions` offers reviewers only **Discard change set** on it, and `documentStateLabel` reads `Stranded`.
- An audit entry's `to` records the state a closing decision returned (for example the final approval's `published`); it was always `null` once the change set closed.
8 changes: 8 additions & 0 deletions .changeset/review-queue-strategy-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@tanstack/cms-api': minor
'@tanstack/cms-ui-react': minor
---

The review queue follows each collection's document state strategy. `reviewSnapshot` items carry `review: { label, actions, stranded? }` (type `ChangeSetReview`: the strategy's state label and the actions it offers the caller), and the new `actOnChange({ id, action, publishAt?, reason?, expectedVersion? })` operation (also a `createServerFn` in `@tanstack/cms-api/start`) runs any offered action that doesn't carry a document, such as a custom sign-off, `schedule` or `discard`. The `/review` page shows the label, renders buttons from the offered actions (Approve and Reject only when the strategy offers them), lets reviewers set or clear a change set's publish time, and lists stranded change sets with a **Discard change set** button.

Behavior change: `reviewSnapshot` now also lists stranded drafts (a stranded change set has to be discarded from the queue), and the Approve and Reject buttons follow the strategy's offered actions instead of the caller's `review.decide` permission alone.
2 changes: 1 addition & 1 deletion docs/agents/ai-images.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Media & AI Images
id: ai-images
order: 4
order: 5
description: "Upload, browse, and render images in TanStack CMS, and generate or edit them with an app-supplied @tanstack/ai image adapter."
keywords:
- tanstack cms
Expand Down
Loading
Loading