Repository navigation
Conversation
…rollback Add a Review before going live setting (off by default). With it on, static exports finalize without going live and a Staged version card offers a private preview, a copyable preview link, Go live and Discard. A Versions panel lists the last 20 versions with Make live for rollback. Editors can stage; administrators promote, with a spacefast_wordpress_can_promote filter. Static connections now request publish:write, which covers promotion and preview sessions; existing installs see a reconnect notice. When Spacefast requires a person to approve a promotion, keep the continuation token server-side, link to the approval, and resend the same request on Finish. Sync state saved by earlier releases keeps working: compare-and-swap now compares against the stored row.
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 59 minutes. View limit details
|
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.
Summary
Static publishes went straight to the public site with no way to review them first or undo them from WordPress. Now a site owner can turn on "Review before going live" (off by default) and stage each publish. A Staged version card offers Open preview, Copy preview link, Go live and Discard, and a Versions panel lists the last 20 versions with Make live to roll back.
Why this matters
Every static publish is created with
finalize: { channel: 'live' }, so a theme change, a bad crawl or a half-finished page is public the moment the export finishes, and the admin only shows the last version ID. Spacefast's API already supports each step: a nullable finalize channel, preview sessions, promote and the version list. This puts them in wp-admin, where the person editing the site already is.Demo
Simulated demo (HyperFrames), built from a real run: Docker WordPress connected to a Spacefast Space, driven through the actual admin forms:
Changes
Spacefast_Clientgets achannelargument oncreate_static_version(null stages), pluslist_versions,preview_session,promote_versionanddelete_version. With the toggle off, the publish request is byte-for-byte what it is today. Sync state records the staged version and whether each version came from a manual or automatic publish. Partial exports stay additive while staged.Editors (
edit_others_posts) can stage and preview when review is on. Administrators promote, roll back and discard, and thespacefast_wordpress_can_promotefilter can narrow or delegate that.spaces:publishdoesn't cover promote or preview sessions, so static connections now requestpublish:write. Existing installs see a Reconnect notice and keep publishing until they reconnect.Spacefast can answer a promote with
confirmation_required, asking a person to approve it. The plugin then shows a Waiting for approval card that links to the approval, instead of the API's raw text. Finish resends the same request with the continuation token and the original Idempotency-Key. The token stays in a non-autoloaded option, is never rendered, and is cleared on finish, cancel, expiry, disconnect and uninstall.This also fixes an upgrade problem. Sync state saved by 0.5.x lacks the new keys, so the compare-and-swap in
Spacefast_Sync_State::mutatenever matched, and every post save hit a fatal error. It now compares against the stored row.Testing
bin/test.shbehavior tests pass. New cases cover the staged and toggle-off payloads, go live, rollback and discard (including stale forms, capability limits and failed promotions), the approval card, early Finish, token and key reuse, expiry, an already-open approval, and state written by an earlier release.bin/test-wordpress.shcontainer acceptance passes.Live, through wp-admin: with review on, I edited a page and clicked Publish now. The export staged in about 20 seconds while the public page kept the old text. Open preview served the new text and returned 403 without the preview session, and Go live made it public. Make live on an older version showed the approval card with a working Approve in Spacefast link. Finish before approval kept the card open and left the live site alone. I didn't approve it myself, since that gate is meant for a person. The upgrade fatal reproduced live before the fix and is gone after it.
This overlaps files that open #13, #15 and #16 change, and #18 also bumps to 0.6.0, so I'll rebase after whichever lands first. If you'd rather review it in two parts, Versions plus rollback could go first, then staging. One thing for the API side: the version endpoint reported 0 added/changed/removed for a staged version whose page did change, so the card's counts may need a look.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.