Skip to content

Collaboration/single table#563

Draft
desrosj wants to merge 123 commits into7.0from
collaboration/single-table
Draft

Collaboration/single table#563
desrosj wants to merge 123 commits into7.0from
collaboration/single-table

Conversation

@desrosj
Copy link
Copy Markdown
Owner

@desrosj desrosj commented Apr 24, 2026

Trac ticket:

Use of AI Tools


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.

josephfusco and others added 30 commits March 16, 2026 13:02
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 to 61840.
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, adds a backward-compatible wp-sync/v1
route alias, 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.
Adds 67 PHPUnit tests for WP_HTTP_Polling_Collaboration_Server covering
document sync, awareness, undo/redo, compaction, permissions, cursor
mechanics, race conditions, cron cleanup, and the backward-compatible
wp-sync/v1 route. Adds E2E tests for 3-user presence, sync, and
undo/redo. Removes the old sync server tests. Updates REST schema
setup and fixtures for the new collaboration endpoints.
Adds a cache-first read path to get_awareness_state() following the
transient pattern: check the persistent object cache, fall back to
the database on miss, and prime the cache with the result.

set_awareness_state() updates the cached entries in-place after the
DB write rather than invalidating, so the cache stays warm for the
next reader in the room. This is application-level deduplication:
the shared collaboration table cannot carry a UNIQUE KEY on
(room, client_id) because sync rows need multiple entries per
room+client pair.

Sites without a persistent cache see no behavior change — the
in-memory WP_Object_Cache provides no cross-request benefit but
keeps the code path identical.
Restore the `wp_client_side_media_processing_enabled` filter and the
`finalize` route that were accidentally removed from the REST schema
test. Add the `collaboration` table to the list of tables expected to
be empty after multisite site creation.
The connectors API key entries in wp-api-generated.js were
incorrectly carried over during the trunk merge. Trunk does not
include them in the generated fixtures since the settings are
dynamically registered and not present in the CI test context.
Rename the `update_value` column to `data` in the collaboration table
storage class and tests, and fix array arrow alignment to satisfy PHPCS.

The shorter name is consistent with WordPress meta tables and avoids
confusion with the `update_value()` method in `WP_REST_Meta_Fields`.
Add a composite index on (type, client_id) to the collaboration table
to speed up awareness upserts, which filter on both columns.

Bump $wp_db_version from 61840 to 61841 so existing installations
pick up the schema change via dbDelta on upgrade.
Introduce MAX_BODY_SIZE (16 MB), MAX_ROOMS_PER_REQUEST (50), and
MAX_UPDATE_DATA_SIZE (1 MB) constants to cap request payloads.

Wire a validate_callback on the route to reject oversized request
bodies with a 413, add maxItems to the rooms schema, and replace
the hardcoded maxLength with the new constant.
Reject non-numeric object IDs early in
can_user_collaborate_on_entity_type(). Verify that a post's actual
type matches the room's claimed entity name before granting access.

For taxonomy rooms, confirm the term exists in the specified taxonomy
and simplify the capability check to use assign_term with the
term's object ID.
Cover oversized request body (413), exceeding max rooms (400),
non-numeric object ID, post type mismatch, nonexistent taxonomy
term, and term in the wrong taxonomy.
…rage

Convert consecutive single-line comments to block comment style per
WordPress coding standards, replace forward slashes with colons in
cache keys to avoid ambiguity, hoist `global $wpdb` above the cache
check in `get_awareness_state()`, and clarify the `$cursor` param
docblock in `remove_updates_before_cursor()`.
When collaboration is disabled, run both DELETE queries (sync and
awareness rows) before unscheduling the cron hook so leftover data
is removed. Hoist `global $wpdb` to the top of the function so the
disabled branch can use it. Add a comment noting future persistent
types may also need exclusion from the sync cleanup query.
The wp-sync/v1 namespace was a transitional alias for the Gutenberg
plugin. Remove it so only wp-collaboration/v1 is registered.
The backward-compatible wp-sync/v1 route alias was removed in
24f4fdc, making this test invalid.
The rooms array schema includes a maxItems constraint of 50, but
the committed wp-api-generated.js fixture was missing it, causing
git diff --exit-code to fail on every PHPUnit CI job.
…hrough_cursor

The previous name was ambiguous — it suggested exclusive semantics,
but the query uses inclusive deletion (id <= %d). "through" clearly
communicates the inclusive behavior without needing to read the docblock.
Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
SergeyBiryukov and others added 30 commits April 6, 2026 23:51
Follow-up to [62213].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62218 602fd350-edb4-49c9-b593-d223f7449a82
Set `_wp_ignored_hooked_blocks` post meta in the REST API response sent from post-like endpoints that support Block Hooks (see `rest_block_hooks_post_types` filter).

Previously, it was enough to set that post meta on write (i.e. save to DB). However, due to the way real-time collaboration syncs posts and reconciles them with content received from the server side, this information is now vital on the client side to ensure hooked blocks aren't duplicated.

Developed in WordPress#11410.

Props bernhard-reiter, czarate, ingeniumed.
Fixes #65008.


git-svn-id: https://develop.svn.wordpress.org/trunk@62219 602fd350-edb4-49c9-b593-d223f7449a82
Remove WordPress-internal properties (`sanitize_callback`, `validate_callback`, `arg_options`) from ability `input_schema` and `output_schema` fields in REST responses. These properties are used server-side but are not valid JSON Schema keywords and cause client-side validators to fail.

Props jorgefilipecosta, ocean90, gziolo.
Fixes #65035.

git-svn-id: https://develop.svn.wordpress.org/trunk@62221 602fd350-edb4-49c9-b593-d223f7449a82
Follow-up to [62213], [62218].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62222 602fd350-edb4-49c9-b593-d223f7449a82
Props sagardeshmukh.
See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62223 602fd350-edb4-49c9-b593-d223f7449a82
…rage.php

Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Add a maxLength constraint to the client_id argument schema so
overlong values are rejected at the REST layer rather than being
silently truncated (or erroring) at the database. The 32-character
limit matches the client_id varchar(32) column in schema.php and
mirrors the approach already used for the room argument.

Also document why both minimum and minLength are present: client_id
has a union type (string|integer), and WordPress REST API validation
dispatches string values to minLength/maxLength and integer values to
minimum, so both keywords are required to bound each branch of the
union.
…table.

Add a composite KEY room_type_date (room, type, date_gmt) so the
awareness read path in get_awareness_state() can seek directly to a
room's live awareness rows instead of relying on the KEY room (room,
id) prefix and post-filtering by type and date_gmt.

In the single-table design where awareness and update rows share
$wpdb->collaboration and are distinguished only by the type column,
the previous indexes left no covering path for the hot-path query
WHERE room = %s AND type = 'awareness' AND date_gmt >= %s, which runs
on every cache-miss awareness poll (~0.5-1s per active editor).
EXPLAIN on a populated table (11k rows) confirms MySQL switches from
KEY room (rows=55, Using where) to KEY room_type_date (rows=3, Using
index condition), with the full WHERE clause pushed down into the
index lookup.

The set_awareness_state() existence check (WHERE room = %s AND type
= 'awareness' AND client_id = %s) also picks up the new index as a
side benefit: its plan switches from an index_merge intersection of
type_client_id and room to a single-index seek on room_type_date.
The old intersection plan wasn't pathological, but a single composite
seek is simpler and more predictable.

Bump $wp_db_version to 61842 so dbDelta picks up the new index on
upgrade.
…ordpress-develop into collaboration/single-table
Follow-up to [34903], [62223].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62224 602fd350-edb4-49c9-b593-d223f7449a82
In preparation for later work to allow non-US-ASCII email addresses, this change extends the unit test suite for `is_email()` and adds new tests covering `antispambot()` and `sanitize_email()`.

This work was done collaboratively during WordCamp Vienna, 2026 as a Contributor Challenge in cooperation with and support from ICANN and also GeoTLDs Universal Acceptance Local Initiative.

Developed in: WordPress#11552
Discussed in: https://core.trac.wordpress.org/ticket/31992

Props agulbra, akirk, benniledl, dmsnell.
See #31992.


git-svn-id: https://develop.svn.wordpress.org/trunk@62225 602fd350-edb4-49c9-b593-d223f7449a82
…ke 2)

When the original patch from PR#11552 was merged, it did not include the latest version of the PR code, which had removed a failing test.

This patch removes the failing test to match what ran in the tests on the PR.

Developed in: WordPress#11552
Discussed in: https://core.trac.wordpress.org/ticket/31992

Follow-up to: [62225].

Props agulbra, akirk, benniledl, dmsnell.
See #31992.


git-svn-id: https://develop.svn.wordpress.org/trunk@62226 602fd350-edb4-49c9-b593-d223f7449a82
Includes moving the data provider after the corresponding test for consistency with the rest of the test suite.

Follow-up to [34903], [62223], [62224].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62227 602fd350-edb4-49c9-b593-d223f7449a82
Follow-up to [62223].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62228 602fd350-edb4-49c9-b593-d223f7449a82
Includes removing the `external-http` group for a `WP_Embed::run_shortcode()` test which does not perform any HTTP requests.

Follow-up to [50448], [62223], [62228].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62229 602fd350-edb4-49c9-b593-d223f7449a82
…setup screen.

This changeset updates the link colors on the setup screen and the default `wp_die()` fallback styles to use the new default admin color scheme.

Props audrasjb, darshitrajyaguru97, dhrumilk, hbhalodia, huzaifaalmesbah, ismail0071, mikinc860, pooja-n, shailu25, sumitsingh, vishitshah, wildworks
Fixes #64962. See #64308.

git-svn-id: https://develop.svn.wordpress.org/trunk@62230 602fd350-edb4-49c9-b593-d223f7449a82
…ents

When WP_ENVIRONMENT_TYPE is not `production`, disable pingbacks and trackbacks.

Otherwise, when `WP_ENVIRONMENT_TYPE` is `local`, `development`, or `staging`, pingbacks and trackbacks are sent when posts are published. This creates confusion on the receiving end and is unnecessary for testing workflows.

Props arcangelini, cagrimmett, ramonopoly, tyxla.

Fixes #64837.



git-svn-id: https://develop.svn.wordpress.org/trunk@62231 602fd350-edb4-49c9-b593-d223f7449a82
…pse and move buttons.

Fixes an issue where the focus outline on metabox collapse buttons and move handles was being clipped.

Props abcd95, audrasjb, brianhogg, darshitrajyaguru97, poena, wildworks.
Fixes #65060.

git-svn-id: https://develop.svn.wordpress.org/trunk@62232 602fd350-edb4-49c9-b593-d223f7449a82
…taging environments

Commits to trunk have been paused for 7.0.

See: https://make.wordpress.org/core/2026/04/02/the-path-forward-for-wordpress-7-0/

Props arcangelini, cagrimmett, ramonopoly, tyxla, ocean90, khushipatel15.

Follow-up to [64837].

See #64837.



git-svn-id: https://develop.svn.wordpress.org/trunk@62233 602fd350-edb4-49c9-b593-d223f7449a82
Follow-up to [37708], [37892], [62224], [62227].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62234 602fd350-edb4-49c9-b593-d223f7449a82
Follow-up to [62213], [62218], [62222].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62237 602fd350-edb4-49c9-b593-d223f7449a82
…n WP_Error.

Wraps `invoke_callback()` in a try/catch so that exceptions thrown by execute or permission callbacks are converted to a `WP_Error` with the `ability_callback_exception` code instead of propagating as uncaught throwables.

Developed in: WordPress#11544

Props priyankagusani, jamesgiroux, jeffpaul, dkotter, adamsilverstein, justlevine, jorbin, pavanpatil1.
Fixes #65058.



git-svn-id: https://develop.svn.wordpress.org/trunk@62238 602fd350-edb4-49c9-b593-d223f7449a82
…T` constant.

When `WP_AI_SUPPORT` is explicitly set to `false`, `wp_supports_ai()` now returns early before the filter runs. This ensures the site owner's explicit preference to disable AI cannot be overridden by a plugin via the `wp_supports_ai` filter.

The filter default is now always `true`, since the constant check happens beforehand.

Developed in: WordPress#11295

Follow-up to [62067].

Props justlevine, westonruter, gziolo, mindctrl, adamsilverstein, johnjamesjacoby, ahortin, nilambar, ozgursar, audrasjb, jeffpaul.
Fixes #64706.



git-svn-id: https://develop.svn.wordpress.org/trunk@62239 602fd350-edb4-49c9-b593-d223f7449a82
… test.

This particular test checks the list of theme features hardcoded into Core and does not perform an external API request.

Follow-up to [39906].

See #64225.

git-svn-id: https://develop.svn.wordpress.org/trunk@62243 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.