Collaboration: Replace post meta storage with dedicated database table#11256
Draft
josephfusco wants to merge 12 commits intoWordPress:trunkfrom
Draft
Collaboration: Replace post meta storage with dedicated database table#11256josephfusco wants to merge 12 commits intoWordPress:trunkfrom
josephfusco wants to merge 12 commits intoWordPress:trunkfrom
Conversation
Introduces the wp_collaboration table for storing real-time editing data (document states, awareness info, undo history) and the WP_Collaboration_Table_Storage class that implements all CRUD operations against it. Bumps the database schema version.
Replaces WP_HTTP_Polling_Sync_Server with WP_HTTP_Polling_Collaboration_Server using the wp-collaboration/v1 REST namespace. Switches to string-based client IDs, fixes the compaction race condition, and uses UPDATE-then-INSERT for awareness data.
Deletes WP_Sync_Post_Meta_Storage and WP_Sync_Storage interface, and removes the wp_sync_storage post type registration from post.php. These are superseded by the dedicated collaboration table.
Adds wp_is_collaboration_enabled() gate, injects the collaboration setting into the block editor, registers cron event for cleaning up stale collaboration data, and updates require/include paths for the new storage and server classes.
Registers a duplicate REST route under the wp-sync/v1 namespace so that the Gutenberg plugin's bundled sync package continues to work against WordPress 7.0+.
Adds 67 tests for WP_HTTP_Polling_Collaboration_Server covering document sync, awareness, undo/redo, compaction, permissions, and the backward-compatible wp-sync/v1 route. Removes the old sync server tests. Updates REST schema setup and settings controller tests for the new collaboration endpoints and setting.
Adds end-to-end tests for real-time collaboration covering presence indicators, document synchronization across browser contexts, and collaborative undo/redo behavior. Includes shared test utilities and fixtures.
wp_collaboration
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Increment $wp_db_version from 61833 to 61834 so the upgrade_700() routine triggers dbDelta() for the new collaboration table. Add a PHPUnit test covering the backward-compatible wp-sync/v1 route alias, including a $_namespace parameter on the dispatch_collaboration helper.
Fix stale changes in default-filters.php that were carried over from the old branch during the rewrite. Restores the Connectors API init hook, login_head resource hints action, wp_default_styles hook for classic theme block styles, and admin_init hook for collaboration setting injection.
Clarify that the $_namespace parameter defaults to the primary namespace, matching Weston's suggestion from PR 11068 review.
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.
The real-time collaboration sync layer currently stores messages as post meta, which works but creates side effects at scale. This moves it to a single dedicated
wp_collaborationtable purpose-built for the workload.Table Definition
Testing
Testers who already had the local env running before checking out your branch will hit the upgrade.php redirect without it. A fresh
npm run env:installwould also work, but core update-db is non-destructive and faster.Note for beta testers: If upgrading from a previous beta, the old wp_sync_updates table is no longer used and can be dropped:
npm run env:cli -- db query "DROP TABLE IF EXISTS wp_sync_updates"Use of AI Tools
Co-authored with Claude Code (Opus 4.6), used to synthesize discussion across related tickets and PRs into a single implementation. All code was reviewed and tested before submission.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.