feat(bulk-editor): smart-select posts that need improvement#23470
feat(bulk-editor): smart-select posts that need improvement#23470JorPV wants to merge 7 commits into
Conversation
5fae9a9 to
d84ba76
Compare
Coverage Report for CI Build 6604Warning No base build found for commit Coverage: 46.331%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
Adds “smart-select” actions to the bulk editor’s Select menu to quickly select rows whose SEO/social fields need improvement, using the same per-field verdict logic as the “needs improvement” filters so the UI stays consistent across filter vs selection.
Changes:
- Adds a per-post, per-field
needs_improvementmap to the bulk editor posts payload (both indexable-backed and postmeta-backed collectors). - Adds “needs improvement” smart-select menu items (with ScoreIcon + accessible labels) that select matching rows on the current page.
- Extends unit tests (PHP + JS) to cover the new payload field and the new Select-menu behavior.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/Unit/Doubles/Models/Indexable_Mock.php |
Extends the indexable mock with score properties used by needs-improvement verdicts. |
tests/Unit/Bulk_Editor/Infrastructure/Posts/Post_Meta_Posts_Collector/Get_Posts_Test.php |
Updates expectations for additional meta reads and the needs_improvement payload. |
tests/Unit/Bulk_Editor/Infrastructure/Posts/Indexable_Posts_Collector/Get_Posts_Test.php |
Adds score inputs + asserts needs_improvement output for indexable-backed collection. |
tests/Unit/Bulk_Editor/Domain/Posts/Posts_Page_Test.php |
Ensures page serialization includes the new needs_improvement field. |
tests/Unit/Bulk_Editor/Domain/Posts/Post_Test.php |
Ensures Post domain object serializes needs_improvement. |
src/bulk-editor/infrastructure/posts/post-meta-posts-collector.php |
Computes needs_improvement from post meta (emptiness + score range when enabled). |
src/bulk-editor/infrastructure/posts/indexable-posts-collector.php |
Computes needs_improvement from indexable columns (emptiness + score range when enabled). |
src/bulk-editor/domain/posts/post.php |
Adds needs_improvement to the domain model and to_array() output. |
packages/js/src/bulk-editor/services/use-posts.js |
Maps backend needs_improvement into needsImprovement on the client model. |
packages/js/src/bulk-editor/components/bulk-editor-content.js |
Builds smart-select items and dispatches selection based on needsImprovement. |
packages/js/src/bulk-editor/components/bulk-action-bar.js |
Renders smart-select items in the Select menu with icon + aria-label support. |
packages/js/tests/bulk-editor/services/use-posts.test.js |
Updates client mapping test to include needsImprovement. |
packages/js/tests/bulk-editor/bulk-action-bar.test.js |
Adds test for smart-select menu item accessible name + click behavior. |
.phpcs.xml.dist |
Excludes the property type-hint sniff for test doubles. |
ed00a5f to
b6ea584
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/bulk-editor/domain/posts/post.php:84
- The property doc says
needs_improvementis “Empty for a post whose fields are not editable”, butto_array()always merges it with defaults and returns all keys. Updating the doc avoids misleading future readers about the serialized shape.
/**
* Whether each field needs improvement, keyed by field param (e.g. `seo_title`). Empty for a post whose
* fields are not editable.
*
Introduced a new property to the Post class to track whether each field requires improvement, keyed by field parameter.
The double/mock classes mirror the real classes' properties; enforcing native/@var type hints on the mock's own untyped property declarations adds no value, so exclude tests/*/Doubles/* from the PropertyTypeHint sniff, matching the existing Doubles exclusions for the comment sniffs. Lower the phpcs ERRORS threshold to 2244 to lock in the errors this exclusion removes across the test doubles. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b6ea584 to
fb1c913
Compare
|
A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch. |
…mprovement Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Important
Based on PR #23434 so wait until that PR is merged.
Context
The bulk editor's Filters dropdown (#23438) added "needs improvement" quality filtering, backed by per-field SEO title / meta description scores stored on the indexable. This PR adds the matching one-click smart-select: the Select menu gains quality-based options that select the current page's rows whose title or description need improvement, reusing the exact same per-field verdict the filter applies — so the two can never disagree.
It is available to all users (Free).
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
needs_improvementflag computed from the same stored scores and empty-field rule as the filter'sapply_needs_improvement, so smart-select and the filter stay in lock-step.selectAll; the backend is untouched by the select and no new endpoint is added.ScoreIcon: the red "needs improvement" dot is the same indicator shown in the analysis and post overview, so no new component is introduced.Test instructions
Test instructions for the acceptance test before the PR gets merged
Note
Stacked on #23438 — test on this branch, which already includes the scores work. Some posts need populated scores to exercise the score path: edit a post in the bulk editor (or re-index) so its per-field score is stored; posts with an empty field always qualify regardless of score.
/wp-admin/admin.php?page=wpseo_page_bulk_edit).needs improvementdot: SEO titles and Meta descriptions (check design).166pxwide, matching the design).composer test -- --filter "Post_Test|Posts_Collector|Indexable_Posts_Collector|Post_Meta_Posts_Collector"andcd packages/js && yarn test -- bulk-editor; confirm both pass.Relevant test scenarios
The console is useful to confirm the selection ids via
wp.data.select( "@yoast/bulk-editor" ).selectSelectedIds(). Content types matter because the options are tab- and content-type-aware.Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
needs_improvementflag added per row).bulk-action-bar.js,bulk-editor-content.js).Other environments
Documentation
Quality assurance
Innovation
Fixes #1271