Problem/Motivation

Governed clients can create an unpublished forward revision, but cannot continue editing it through core JSON:API. A canonical PATCH is rejected when a working copy exists. Adding resourceVersion=rel:working-copy also fails because core rejects revision-selected PATCH requests. Reading a revision does not imply that it is writable.

Steps to reproduce

  1. Enable JSON:API, Content Moderation, and MCP Sentinel on a test site.
  2. Create a published node and an unpublished forward revision.
  3. Attempt a governed PATCH of the canonical resource. Core rejects the existing working copy.
  4. Attempt the same PATCH with resourceVersion=rel:working-copy. Core rejects the query parameter for this method.

Proposed resolution

Add an explicitly governed, revision-aware draft update path. Preserve the published/default revision and existing history. Apply body, structured fields, and reference changes atomically to a new unpublished continuation of the current draft.

  • Retain authenticated policy resolution, entity and field access, moderation validation, content locks, and audit evidence.
  • Require revision preconditions and refuse stale or ambiguous targets. Never discard a draft or fall back to modifying the published resource.
  • Provide a non-saving preflight that uses the same access, validation, and conflict checks as the write.
  • Return the live and resulting working revision identifiers distinctly.

Remaining tasks

Implement the server-side contract and client integration. Add integration tests for repeated draft edits, stale revisions, denied permissions, no-save preflight, and revision-pinned paragraph references. Verify the published revision remains unchanged. Test supported Drupal versions before release.

User interface changes

None planned.

API changes

A governed draft-update contract; exact route and precondition representation to be documented with the implementation.

Data model changes

None planned.

Comments

jmcerda created an issue. See original summary.

jmcerda’s picture

Status: Active » Fixed

Implemented and released in 2.15.0. The governed node endpoint creates unpublished continuations with live/working revision preconditions and a non-saving preflight. It preserves existing history and refuses publishing and public alias changes.

Unit/kernel and functional suites passed on Drupal 10.6, 11.3, and latest 11. Coverage includes repeated edits, stale preconditions, access denial, paragraph revision references, and an unchanged live revision.

See the endpoint contract. Rebuild Drupal caches after installing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

jmcerda’s picture

Status: Fixed » Needs work

Reopening for PostgreSQL acceptance coverage. With 2.15.0, a governed no-save PATCH to the draft endpoint can return HTTP 500: A transaction named mimic_implicit_commit is already in use. The active transaction stack contains drupal_transaction and mimic_implicit_commit. Revision pointers remain unchanged after the refused preflight.

The release functional matrix exercised SQLite, not PostgreSQL. Investigation will reproduce this on PostgreSQL, distinguish the endpoint interaction from core issue https://www.drupal.org/project/drupal/issues/2920527, and add database-specific regression coverage before a fix is released. No publishing or revision-deletion fallback is proposed.

jmcerda’s picture

Confirmed the PostgreSQL failure is core issue #2920527. The endpoint transaction exposes nested SELECT execution during node-reference validation; no Sentinel validation or access checks need to be removed.

Contributed core MR !17015 with a core-only regression and the current-API savepoint guard. Against a Composer-patched core 11.4.6 / PostgreSQL 16 fixture, draft continuation with node grants and an existing node-reference field passes 30 assertions, including preflight, repeated edits, stale preconditions, denied publishing, and preservation of the live revision.

Keeping this issue open through PostgreSQL acceptance. The module release remains 2.15.0; the correction is proposed in core rather than a governance workaround. Deployment verification and durable module-level PostgreSQL CI coverage remain follow-through work.

  • jmcerda committed 0fae3697 on 1.x
    Release 2.15.1
    
    Stamp the governed draft-continuation PostgreSQL...
jmcerda’s picture

Status: Needs work » Fixed

Released in 2.15.1. Draft continuation no longer holds the exclusive write transaction across nested SELECTs. Preflight does not open a transaction. The write still row-locks, re-checks live/working pointers, and rolls back if the live revision would change. Node grants and node-reference validation are covered on PostgreSQL. Core #2920527 remains the driver-level fix for other in-transaction nested SELECTs. Rebuild Drupal caches after updating.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.