Skip to content

Core Data: Keep read-only taxonomy fields out of collaborative edits - #84838

Merged
ciampo merged 2 commits into
trunkfrom
codex/fix-synced-taxonomy-dirty-record
Oct 15, 2026
Merged

ciampo merged 2 commits into
trunkfrom
codex/fix-synced-taxonomy-dirty-record

Conversation

@ciampo

@ciampo ciampo commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #79908. Related to #78594. Found through the failing Playwright job on #84584.

What?

Keep read-only taxonomy term fields out of collaborative edits so stale counts and links do not mark unchanged categories as dirty.

Why?

After another post is published, REST can return a category count of 1 while its shared document still contains 0. Applying that stale count as an edit changes the pre-publish button to "Save" and can trigger an unsaved-changes warning.

Taxonomy record syncing was introduced in #74665. The comparison added in #79908 excludes equal values, but stale read-only values still differ and reach the store as edits. The original test passes on a fresh site; changing the count between tabs reproduces the failure on trunk.

How?

Use a taxonomy-specific sync config that excludes id, count, link, taxonomy, _links, and _embedded when writing and reading shared documents. Reading also filters documents created before this fix. Editable term fields, plugin fields, and taxonomy assignments continue to sync.

Testing Instructions

  1. Enable the real-time collaboration experiment and open a draft post.
  2. Open its pre-publish panel to load the default category into sync.
  3. Publish another post assigned to that category in another tab.
  4. Open the original draft and its pre-publish panel in a second tab.
  5. After both tabs exchange sync updates, confirm the category has no unsaved edits and the panel button still says "Publish".

The existing Playwright regression test now performs this sequence automatically.

Verification
  • The two new unit cases and the strengthened Playwright test fail without the fix.
  • 121 focused unit tests pass with the fix, including stale-document handling and editable/plugin field coverage.
  • The Playwright regression test passes three consecutive runs on Chromium.
  • The full build, type check, and focused JavaScript lint pass.

Testing Instructions for Keyboard

Follow the same steps using Tab to reach each Publish button and Enter to open the panel. The change does not alter keyboard interaction.

Use of AI Tools

Codex investigated the failure, traced its history, implemented the fix and tests, and ran local verification.

@github-actions github-actions Bot added the [Package] Core data /packages/core-data label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +50 B (0%)

Total Size: 8.65 MB

📦 View Changed
Filename Size Change
build/scripts/core-data/index.min.js 79 kB +50 B (+0.06%)

a6040dc Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 77e7376 trunk % Change
timeToFirstByte 42.2 ms +13.03% -9.72% 36.7 ms +12.94% -5.04% 14.99%
largestContentfulPaint 72 ms +11.11% -5.56% 68 ms +0% -8.82% 5.88%
lcpMinusTtfb 28.6 ms +22.9% -7.52% 26.55 ms +23.73% -3.39% 7.72%
wpBeforeTemplate 21.81 ms +19.35% -8.62% 19.06 ms +13.8% -2.52% 14.43%
wpTemplate 15.54 ms +12.55% -4.57% 14.42 ms +6.03% -10.54% 7.77%
wpTotal 38.96 ms +10.93% -10.73% 33.48 ms +14.19% -5.59% 16.37%
wpMemoryUsage 7.61 MB +0% -0% 7.57 MB +0% -0% 0.45%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric 77e7376 trunk % Change
timeToFirstByte 33.6 ms +9.37% -3.13% 31.95 ms +8.29% -4.85% 5.16%
largestContentfulPaint 76 ms +10.53% -2.63% 72 ms +5.56% -5.56% 5.56%
lcpMinusTtfb 40.85 ms +14.08% -1.84% 40.05 ms +3.37% -4.49% 2%
wpBeforeTemplate 18.41 ms +10.54% -3.75% 17.37 ms +7.6% -3.68% 5.99%
wpTemplate 12.27 ms +7.82% -3.67% 11.48 ms +4.62% -5.49% 6.88%
wpTotal 30.83 ms +9.83% -4.31% 29.25 ms +8.48% -4.79% 5.4%
wpMemoryUsage 6.27 MB +0% -0% 6.22 MB +0% -0% 0.7%
wpDbQueries 14 +0% -0% 14 +0% -0% 0%

media-processing

Metric 77e7376 trunk % Change
mediaProcessingJpeg 232.61 ms +6.63% -2.38% 234.41 ms +1.62% -0.89% -0.77%
mediaProcessingAvif 3788.96 ms +1.37% -0.82% 3749.54 ms +0.56% -1.44% 1.05%
mediaProcessingJpegToAvif 2601.78 ms +0.78% -0.63% 2623.65 ms +0.07% -2.41% -0.83%

media-upload

Metric 77e7376 trunk % Change
jpegUploadProcessing 1163.69 ms +21.78% -21.68% 950.66 ms +46.99% -3.83% 22.41%
pngUploadProcessing 167.22 ms +4.3% -1.6% 174.41 ms +2.3% -2.38% -4.12%
largeJpegUploadProcessing 925.4 ms +51.33% -1.31% 917.66 ms +1.68% -1.35% 0.84%
multipleImageUploadProcessing 1535.78 ms +1.2% -1.78% 1513.56 ms +0.77% -0.88% 1.47%

post-editor

Metric 77e7376 trunk % Change
serverResponse 412.26 ms +8.64% -5.77% 415.65 ms +2.87% -7.1% -0.82%
firstPaint 283.47 ms +76.15% -26.98% 274.73 ms +72.16% -13.35% 3.18%
domContentLoaded 1174.04 ms +3.06% -0.3% 1178.15 ms +1.88% -3.84% -0.35%
loaded 1175.56 ms +3.05% -0.31% 1179.55 ms +1.86% -3.83% -0.34%
firstContentfulPaint 500.92 ms +7.4% -9.91% 516.47 ms +3.13% -8.42% -3.01%
firstBlock 3453.39 ms +1.51% -1.27% 3432.8 ms +0.67% -0.64% 0.6%
type 18.73 ms +5.18% -1.23% 19.24 ms +1.61% -1.35% -2.65%
typeWithoutInspector 19.45 ms +1.03% -3.75% 19.23 ms +1.14% -3.43% 1.14%
typeWithTopToolbar 23.64 ms +3.26% -3.51% 23.38 ms +13.99% -4.75% 1.11%
typeContainer 9.04 ms +6.08% -8.74% 9.74 ms +6.88% -10.88% -7.19%
focus 122.16 ms +4.46% -3.31% 120.18 ms +3% -4.63% 1.65%
firstFocus 227.97 ms +0% -0% 244.46 ms +0% -0% -6.75%
selectAll 577.4 ms +3.14% -2.75% 559.54 ms +3.48% -0.71% 3.19%
listViewOpen 79.23 ms +3.53% -4.85% 79.54 ms +5% -6.74% -0.39%
inserterOpen 40.64 ms +15.97% -3.74% 40.32 ms +12.45% -5.95% 0.79%
inserterHover 13.05 ms +7.2% -6.51% 13.06 ms +8.19% -11.26% -0.08%
inserterSearch 8.83 ms +1.81% -5.32% 9.19 ms +7.07% -3.16% -3.92%
loadPatterns 660.52 ms +6.67% -6.35% 670.66 ms +2.24% -5.22% -1.51%
wpTotal 400.98 ms +8.81% -5.99% 404.53 ms +2.92% -7.29% -0.88%
wpMemoryUsage 13.29 MB +0% -0% 13.26 MB +0% -0% 0.28%
wpDbQueries 54 +0% -1.85% 54 +0% -1.85% 0%

site-editor

Metric 77e7376 trunk % Change
serverResponse 488.04 ms +6.48% -3.62% 479.34 ms +3.71% -3.59% 1.81%
firstPaint 278.69 ms +9% -26.18% 247.39 ms +9.82% -8.49% 12.65%
domContentLoaded 1214.15 ms +2.58% -0.34% 1232.31 ms +3.64% -1.53% -1.47%
loaded 1215.28 ms +2.58% -0.34% 1233.69 ms +3.63% -1.55% -1.49%
firstContentfulPaint 509.57 ms +3.25% -1.84% 510.75 ms +2.06% -3.63% -0.23%
firstBlock 4519.84 ms +1.87% -1.14% 4577.45 ms +2.4% -0.83% -1.26%
type 18.27 ms +4.32% -0.55% 17.98 ms +9.51% -6.23% 1.61%
navigate 111.74 ms +7.92% -0.17% 117.26 ms +1.14% -3.33% -4.71%
loadPatterns 1219.78 ms +5.88% -2.69% 1166.35 ms +8.78% -8.48% 4.58%
loadPages 996.43 ms +1.98% -1.96% 999.96 ms +2.17% -2.1% -0.35%
wpTotal 478.12 ms +6.58% -3.58% 469.64 ms +3.88% -3.63% 1.81%
wpMemoryUsage 12.35 MB +0% -0% 12.32 MB +0% -0% 0.3%
wpDbQueries 43 +2.33% -0% 43 +2.33% -0% 0%

a6040dc Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

default to a list of pages if there are no menus in /test/e2e/specs/editor/blocks/navigation.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: locator('[name="editor-canvas"]').contentFrame().getByRole('document', { name: 'Block: Page List' })
Expected: visible
Timeout: 10000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" locator('[name="editor-canvas"]').contentFrame().getByRole('document', { name: 'Block: Page List' }) with timeout 10000ms
  - waiting for locator('[name="editor-canvas"]').contentFrame().getByRole('document', { name: 'Block: Page List' })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation.spec.js:34:34
refuses the drop and uploads nothing in /test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js, passed after 1 failed attempt.
Error: expect(received).toHaveLength(expected)

Expected length: 0
Received length: 1
Received array:  [{"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "curies": [{"href": "https://api.w.org/{rel}", "name": "wp", "templated": true}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=244"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/244", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}], "wp:attached-to": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/posts/243", "id": 243, "post_type": "post"}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-244", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-10-15T15:23:52", "date_gmt": "2026-10-15T15:23:52", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/67966720-f621-4fac-ad55-808a93e7d61a.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/67966720-f621-4fac-ad55-808a93e7d61a.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "67966720-f621-4fac-ad55-808a93e7d61a.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/67966720-f621-4fac-ad55-808a93e7d61a.png"}, "id": 244, "link": "http://localhost:8889/?attachment_id=244", "media_details": {"file": "2026/10/67966720-f621-4fac-ad55-808a93e7d61a.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-10-15T15:23:52", "modified_gmt": "2026-10-15T15:23:52", "ping_status": "closed", "post": 243, "slug": "67966720-f621-4fac-ad55-808a93e7d61a", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/67966720-f621-4fac-ad55-808a93e7d61a.png", "status": "inherit", "template": "", "title": {"rendered": "67966720-f621-4fac-ad55-808a93e7d61a"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45

a6040dc Run

@ciampo ciampo self-assigned this Oct 15, 2026
@ciampo
ciampo requested a balanced review from Copilot October 15, 2026 15:06
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Oct 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused filtering handles stale documents while preserving editable fields, with regression coverage and no identified blocking issues.

0 open findings

What changed in this PR

Prevents stale read-only taxonomy data from marking unchanged terms as dirty during collaboration.

Changes:

  • Filters read-only fields when writing and reading shared taxonomy documents, including older documents.
  • Preserves editable and plugin fields.
  • Adds regression coverage and documents the fix.
File Description
test/​e2e/​specs/​editor/​collaboration/​http-only/​collaboration-taxonomy-record-dirty.spec.ts Reproduces category count changes between sessions.
packages/​core-data/​src/​utils/​test/​crdt.jsdom.test.ts Tests filtering and preservation of editable fields.
packages/​core-data/​src/​utils/​crdt.ts Introduces taxonomy-specific read/write filtering.
packages/​core-data/​src/​entities.js Applies the taxonomy sync configuration.
packages/​core-data/​CHANGELOG.md Records the bug fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@ciampo
ciampo marked this pull request as ready for review October 15, 2026 15:10
@ciampo
ciampo requested a review from t-hamano October 15, 2026 15:39
@ciampo

ciampo commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Seeing CI errors across a bunch of PRs, I'm going to merge this PR to unblock things

@ciampo
ciampo merged commit 39f1a25 into trunk Oct 15, 2026
135 of 137 checks passed
@ciampo
ciampo deleted the codex/fix-synced-taxonomy-dirty-record branch October 15, 2026 15:54
@github-actions github-actions Bot added this to the Gutenberg 24.3 milestone Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Core data /packages/core-data [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants