Distributed Editing: An alternative to RTC#12334
Conversation
Lock the working native PHP Yjs port at 1694b1f1997945f1f362453f79f5da286a9dfd37 so WordPress server-side merge work has a stable dependency. Use a relative local URL in .gitmodules for this server workspace.
Expand the WordPress DE-RTC runtime boundary for server-side sync metadata handling, retry-save merge decisions, presence, history, and capability-sensitive review behavior. Keeps server persistence authoritative while preserving guarded failure paths for unsafe or conflicting edits.
Add and update PHPUnit coverage for sync-meta recovery, post snapshots, history, presence, settings, permission gates, retry-submit, and retry-save behavior including partial-safe review and merge outcomes.
Update the WordPress editor asset package hash after the Gutenberg DE-RTC editor build changes so the default site can serve the matching working copy.
Add guarded review-item storage and REST list/detail/resolution endpoints for unsafe blocks rejected from partial-safe retry-save. Safe edits remain the persisted authority while review-required source is kept in bounded, capability-gated workflow storage with descriptor/detail separation. Also records queued review-item descriptors in retry-save responses and extends retry-save REST coverage for author descriptors, admin-only detail, escaped source display, and idempotent rejection. Verification: npm run test:php -- --filter Tests_DE_RTC_REST_Retry_Save
Extend the DE-RTC presence heartbeat to accept sanitized, content-free selection state and persist it in the presence table without raw text, client IDs, DOM selectors, post content, or save authority. Presence reads now expose selection presence as liveness data only; receivers still decide whether a canvas overlay can be mapped safely. Bump the presence storage schema to v4, cover heartbeat/read contracts for v1/v2 selection payloads, and sync the Gutenberg editor asset version generated from the current build. Verification: npm run test:php -- --filter 'Tests_DE_RTC_(REST_Presence|Presence_Storage)'; docker PHP syntax checks for src/wp-includes/de-rtc.php and the touched DE-RTC presence tests; git diff --check.
Bootstrap the risky-block review UI whenever DE-RTC is enabled and classify lower-privileged retry-save content relative to the current server body. This lets WordPress persist safe edits from an author while holding only KSES-sensitive proposed blocks for review instead of rejecting safe edits because an unchanged admin-authored unsafe block exists in the post. The hypothesis was that Post 810 was not reaching the guarded review path because riskyBlockReview was bootstrapped false, and that safe author edits were being rejected by whole-document KSES comparison rather than change-relative KSES review. After enabling the gate and using the review-item classifier for retry-save and partial-safe candidates, the server persisted the safe italic Cheese edit, withheld the unsafe Custom HTML proposal, and exposed one review item. npm run build was run afterward to copy the Gutenberg bundle into the WordPress tree. Confirmed with: - npm run test:php -- --filter Tests_DE_RTC_Settings - DE_RTC_POST_810_PARTIAL_SAFE_ARTIFACT_DIR=.rtc/public-plan/cycle-20260531-220413-cest/post-810-after-ghost-render-fix npm run test:de-rtc-browser:post-810-partial-safe-cheese-video
Record the generated WordPress block file drift produced while starting the default DE-RTC test environment. The files now guard Gutenberg-specific shared navigation helpers with function_exists checks instead of only checking IS_GUTENBERG_PLUGIN, matching the generated runtime copy used by the localhost:3880 site. This was not a product-code hypothesis for Round 001; it is committed separately to restore git hygiene before the worker evidence cycle continues.
Add conservative server-side same-block merge paths for disjoint rich-text marks and independent table cells while keeping same-cell, structure, and unsupported same-block edits as manual conflicts. Surface content-free merge evidence for table-cell coordinates and rich-text merged blocks. Keep KSES-sensitive review checks focused on newly introduced unsafe material so safe author edits are not rejected only because existing unsafe markup remains in the post. Sync the Gutenberg editor build metadata. Verification: - npm -C wordpress-develop run test:php -- --group de-rtc --filter "table_cell"
Add the native Automerge PHP port as the DE-RTC sync metadata runtime and remove the old Yjs submodule. Rename retry-save evidence, raw post-content preservation hooks, recovery repair helpers, and test expectations from Yjs to Automerge. Keep the guarded save/review paths server-owned, including no-write review-required responses and canonical Automerge repair metadata. Verified with php -l src/wp-includes/de-rtc.php and npm run test:php -- --group de-rtc.
Checkpoint current Automerge migration work before investigating the same-paragraph non-conflicting save failure. Includes retry-save revision handling, sync-meta/recovery test updates, and navigation package metadata updates that were already present in the working tree.
Add block-native RichText content operation evidence for Automerge retry-save and merge two disjoint text splices in one paragraph. The merge remains conservative: overlapping ranges and mark/splice collisions still require manual conflict handling. Hypothesis tested: non-overlapping paragraph word edits need to be expressed and validated as RichText text-splice operations instead of rejecting same-block text changes wholesale. Verified with focused retry-save PHPUnit coverage and the two-tab browser proof.
Treat direct database or plugin-side post_content replacement as authoritative external input when the current body no longer matches the latest valid Automerge sync meta. The snapshot path now applies the guarded recovery candidate, imports the current body as a server-owned Automerge update, and reloads the persisted post instead of returning a synthetic repaired snapshot. Recovery apply now persists the validated candidate exactly, with scoped sync-meta KSES allowance, so the repair is not reinterpreted as a new editor save. Automerge retry-save also preserves an accepted-base revision before every write so later stale editors can still merge against the base they opened. Verified with full DE-RTC PHPUnit coverage and post 963, where the repaired sync meta advanced from version 10 to 11 after an HTML-only direct database replacement.
Derive a public attribution key from the opaque presence session hash, carry the session key through guarded retry-save, and record authorship evidence in Automerge sync metadata without exposing raw session keys. Treat harmless KSES serialization normalization, such as compact separator hr markup, as safe for lesser-privileged author saves while retaining review-required handling for actual unsafe HTML changes. Verified with php -l on modified PHP files, git diff --check, targeted KSES/retry-save phpunit subset (4 tests, 77 assertions), and broader DE-RTC KSES/retry-save filter (17 tests, 382 assertions).
Refresh the WordPress-develop side of the integrated development site after the Gutenberg presence hover fix so localhost:3880 can serve the updated editor package version. The source behavior change lives in Gutenberg commit b8534fc3049. Browser proof: npm run test:de-rtc-browser:presence-hover-panel.
Update the generated WordPress script-loader package version after syncing Gutenberg's DE-RTC status-surface changes into the default runtime. Generated by npm run sync:gutenberg so localhost:3880 serves the dismissible review-required save notice behavior.
Update the generated script-loader package hash after syncing the Gutenberg build that contains the visible presence activity ring fix. This is generated runtime metadata only; the source change is recorded in Gutenberg commit f9258bf194a.
Return the current user's visible pending review count separately from the post-wide pending review count so clients do not show stale review UI when no actionable review item is visible. Normalize review item timestamps before expiry calculation and cover author/admin visibility behavior in retry-save tests. Includes the matching Gutenberg editor asset version update.
Move the native PHP Automerge port from a nested submodule into wp-includes/automerge-php and update the DE-RTC runtime loader to use the vendored Core path. Excludes nested upstream checkout and local VCS metadata so the runtime can be distributed with WordPress source.
|
Hi there! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
Testing and early-previews. Entirely generated by Codex.
Pairs with WordPress/gutenberg#79602