Chore: Warn when updating a Spaces page with an active editor draft#377
Open
rafaeljusto wants to merge 1 commit into
Open
Chore: Warn when updating a Spaces page with an active editor draft#377rafaeljusto wants to merge 1 commit into
rafaeljusto wants to merge 1 commit into
Conversation
Publishing page content through the REST API updates only the published
content, not the collaborative OT editor draft ("Edit version"). When a
page already has an active draft, that draft goes stale and a subsequent
edit-and-publish from the Spaces web editor can silently overwrite the
API-published content. This is a Spaces backend limitation with no REST
surface to update the draft, so the MCP cannot fix the data itself.
As an interim mitigation, twspaces-update_page now detects the dangerous
case and warns without blocking: when a write changes published content
(content set, or isPublish present) and the page's draftVersion > 1, the
tool result is prefixed with a draft-sync warning that points the user to
"Revert to last published version" in the web editor to resync. The
draftVersion is read from the request argument first, falling back to a
best-effort get only when absent/<=1, so the common path adds no extra
call. Pages with draftVersion <= 1 (no real draft yet; the editor
self-heals on first edit) produce no warning. The update_page tool
description also states the limitation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Publishing page content through the REST API updates only the published content, not the collaborative OT editor draft ("Edit version"). When a page already has an active draft, that draft goes stale, and a subsequent edit-and-publish from the Spaces web editor can silently overwrite the API-published content. This is a Spaces backend limitation with no REST surface to update the draft, so the MCP cannot fix the data itself.
As an interim mitigation, twspaces-update_page now detects the dangerous case and warns without blocking: when a write changes published content (content set, or isPublish present) and the page's draftVersion > 1, the tool result is prefixed with a draft-sync warning that points the user to "Revert to last published version" in the web editor to resync. The draftVersion is read from the request argument first, falling back to a best-effort get only when absent/<=1, so the common path adds no extra call. Pages with draftVersion <= 1 (no real draft yet; the editor self-heals on first edit) produce no warning. The update_page tool description also states the limitation.
Type of Change
Testing
go test -v ./...)Checklist