Skip to content

Suggest mode: Suggestion summary, attribute conflict detection, and architecture docs#78352

Open
adamsilverstein wants to merge 10 commits into
phase-5a-rest-backendfrom
phase-5c-summary-diff-docs
Open

Suggest mode: Suggestion summary, attribute conflict detection, and architecture docs#78352
adamsilverstein wants to merge 10 commits into
phase-5a-rest-backendfrom
phase-5c-summary-diff-docs

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented May 15, 2026

Copy link
Copy Markdown
Member

Overview

One of three replacement PRs for the now-closed #77407. This slice introduces the suggestion summary renderer, per-attribute conflict detection, snackbar feedback, and architecture documentation.

Tracking issue: #73411.

What's in this PR

Suggestion-mode component additions

  • suggestion-summary.js — Compact alternative to the full inline diff. Renders an Add / Delete / Format line per operation suitable for sidebar threads. Used by the collab-sidebar PR on top of this branch.
  • hasAttributeConflict + parseSuggestionPayload (provider) — Replaces the post-modified_gmt staleness compare with a per-attribute divergence check. modified_gmt flagged nearly every auto-saved suggestion as stale because every save bumps the post timestamp; the new check only prompts when the specific attributes a suggestion targets have moved off baseline.
  • with-suggestion-overlay and suggestion-diff refinements to match the new contract.

Editor store / UX

  • setEditorIntent snackbar — Mode transitions now surface a snackbar ("You're suggesting" / "You're editing" / "You're viewing") alongside the existing a11y announcement.
  • Store wiringactions.js, reducer.js, selectors.js updated for the new selectors; use-block-editor-settings.js wires the suggestion provider settings through.
  • Stylesuggestion-mode/style.scss is the home for suggestion visuals (block bracket marker, summary card); imported from packages/editor/src/style.scss.

Documentation

  • docs/explanations/architecture/suggestions.md — Architecture doc covering the provider abstraction, overlay subsystem, and lifecycle.
  • docs/reference-guides/data/data-core-editor.md — Updated to cover the new editor-store selectors / actions.

Tests

  • Unit: test/provider.js (extended), test/suggestion-summary.js (new), test/with-suggestion-overlay.js (extended).
  • e2e: suggestion-mode.spec.js updated to exercise the new flow.

Test plan

npm run test:unit -- packages/editor/src/components/suggestion-mode
npm run test:unit -- packages/editor/src/store/test/actions.js
npm run test:e2e -- test/e2e/specs/editor/various/suggestion-mode.spec.js
npm run lint:js -- packages/editor/src/components/suggestion-mode packages/editor/src/store

Manual:

  1. Switch to Suggest mode → snackbar reads "You're suggesting".
  2. Edit a paragraph → SuggestionSummary renders in the inline diff and (after the sidebar PR lands) in the note thread.
  3. Submit, then in another window edit the same paragraph's attributes → reopening the original suggestion in the sidebar shows the staleness confirmation only when the specific attributes diverge — not on any unrelated post change.

Replaces part of #77407.


🗺️ PR Stack Navigation

# PR Phase
1 #77403 Intent scaffolding Edit / Suggest / View mode
2 #77404 Overlay capture In-memory suggestion overlay
3 #77405 Provider + Accept/Reject _wp_suggestion meta, provider, sidebar actions
4 #77406 Summary + docs + attribute tests Add/Delete/Formatting summary, architecture stub, conflict scoping
5a #78351 REST permissions and PHP coverage Permissions, payload cap, PHP tests
5b #78352 Summary + attribute conflict + docs ← this PR Renderer, per-attribute staleness, architecture docs
5c #78353 Surface Apply/Reject in the collaboration sidebar Icon buttons + e2e + sidebar wiring
6 #78308 Auto-save subsystem Background debounced save (replaces commit-bar)

📋 Tracking issue: #73411

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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: adamsilverstein <adamsilverstein@git.wordpress.org>

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

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown

Size Change: +1.36 kB (+0.02%)

Total Size: 7.51 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 481 kB +219 B (+0.05%)
build/styles/editor/style-rtl.css 31 kB +302 B (+0.98%)
build/styles/editor/style-rtl.min.css 26.4 kB +267 B (+1.02%)
build/styles/editor/style.css 31.1 kB +302 B (+0.98%)
build/styles/editor/style.min.css 26.4 kB +269 B (+1.03%)

compressed-size-action

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown

Flaky tests detected in df62560.
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.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27780297253
📝 Reported issues:

@adamsilverstein adamsilverstein requested review from Mamaduka and t-hamano and removed request for ajitbohra, fabiankaegy and juanmaguitar May 18, 2026 22:13
@adamsilverstein adamsilverstein added Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Type] Enhancement A suggestion for improvement. and removed [Status] In Progress Tracking issues with work in progress [Package] Editor /packages/editor [Type] Feature New feature to highlight in changelogs. labels May 18, 2026
…and architecture docs

Introduce SuggestionSummary as a compact alternative to the full inline diff,
swap post-modified_gmt staleness for hasAttributeConflict (per-attribute
divergence from the captured baseline), wire snackbar feedback into
setEditorIntent transitions, and add the wp/suggestions architecture doc plus
core/editor data-reference updates. Provider, with-suggestion-overlay,
suggestion-diff, and the suggestion-mode e2e spec follow the new contract.
The suggest-mode stack diverged from trunk before #75147 landed, so
addNoteIdToMetadata and getNoteIdsFromMetadata are absent from this
branch's collab-sidebar/utils.js. suggestion-mode/provider.js imports
both, breaking the JS bundle build (esbuild: no matching export) and
cascading into the PHP, Playwright, and release checks.

Vendor the two pure helpers verbatim from trunk (786c69c) so this
PR builds independently of a full-stack rebase. They resolve cleanly
against trunk's identical definitions when the stack is updated.
Three e2e tests asserted behavior not present on this branch; they were
masked until the JS build break was fixed and the suite could run.

editor-intent-switcher: the intent is session-scoped by design (see
setEditorIntent / editorIntent reducer) - reload returns to Edit. Rewrite
the reload test to assert that reset instead of expecting Suggest to
persist, which the implementation deliberately refuses.

suggestion-mode: 'auto-saves a content edit' and the heading-level
capture test wait for an automatic debounced POST /wp/v2/comments. The
debounced auto-save subsystem is Phase 6 (#78308), not in this stack's
ancestry; here a suggestion is only persisted via the explicit commit-bar
Submit button. Skip both with a tracking reference to #78308.
Commit d055691 vendored addNoteIdToMetadata/getNoteIdsFromMetadata
onto this branch because the stale stack predated #75147. With trunk
merged back into the stack, those helpers exist canonically in
collab-sidebar/utils.js again, so the vendored copy is redundant and
caused a duplicate-definition build break. Remove it; suggestion-mode
provider.js now imports the trunk-supplied versions.
@adamsilverstein adamsilverstein force-pushed the phase-5c-summary-diff-docs branch from 5dfa6f2 to df62560 Compare June 18, 2026 18:19
Remove 17 vestigial bulk-suppression entries for files byte-identical to
trunk (which carries no suppression for them), fixing the failing lint job.
…e-5c-summary-diff-docs

# Conflicts:
#	test/e2e/specs/editor/various/editor-intent-switcher.spec.js
#	tools/eslint/suppressions.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting [Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant