Complete @TODOs#22966
Conversation
Pull Request Test Coverage Report for Build 7dbdd5b30c2be320bd70990ef32b421f81e316d7Details
💛 - Coveralls |
…ession at the DI level and child tasks are included there
…h-the-remaining-todos-of-phase-2
…ngTrailingComma sniff
…Operator.RequiredNullCoalesceEqualOperator sniff
…ngTrailingComma sniff for tests too
There was a problem hiding this comment.
Pull request overview
This PR completes remaining TODO-driven refactors in the task-list feature (phase-2 backend), focusing on reducing duplication, tightening invariants around child-task usage, and aligning tests/PHPCS formatting with the updated implementation.
Changes:
- Add a hard safeguard in
Tasks_Collectorto prevent passingChild_Task_Interfaceinstances directly (throwsIncorrect_Child_Task_Usage_Exception), with a matching unit test. - Introduce
Abstract_Task_Analyzerand refactorScore_Task_Analyzeraccordingly; extract shared child-task behavior intoContent_Score_Child_Task_Trait. - Remove the no-op
Abstract_Completeable_Taskabstraction and drop theparentTaskflag from parent task serialization; update affected unit tests and minor formatting/trailing-comma fixes.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Task_List/Infrastructure/Tasks_Collectors/Tasks_Collector_Parent_Tasks_Test.php | Trailing-comma/array formatting updates for task collector parent/child behavior tests. |
| tests/Unit/Task_List/Infrastructure/Tasks_Collectors/Tasks_Collector_Constructor_Test.php | Adds coverage ensuring constructor throws when given a child task. |
| tests/Unit/Task_List/Infrastructure/Indexables/Recent_Content_Indexable_Collector_Constructor_Test.php | Formatting update (trailing comma). |
| tests/Unit/Task_List/Infrastructure/Indexables/Abstract_Recent_Content_Indexable_Collector_Test.php | Formatting update (trailing comma). |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_SEO_Child/Improve_Content_SEO_Child_To_Array_Test.php | Formatting updates (trailing commas) for child task serialization tests. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_SEO_Child/Improve_Content_SEO_Child_Copy_Set_Test.php | Formatting updates (trailing commas) for copy-set tests. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_SEO_Child/Improve_Content_SEO_Child_Constructor_Test.php | Formatting update (trailing comma). |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_SEO_Child/Abstract_Improve_Content_SEO_Child_Test.php | Formatting updates (trailing commas) in setup/helpers. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_SEO/Improve_Content_SEO_To_Array_Test.php | Updates expectations to match removal of parentTask flag. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_SEO/Improve_Content_SEO_Constructor_Test.php | Formatting updates (trailing commas) in assertions. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_SEO/Abstract_Improve_Content_SEO_Test.php | Formatting updates (trailing commas) in setup. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_Readability_Child/Improve_Content_Readability_Child_To_Array_Test.php | Formatting updates (trailing commas) for child task serialization tests. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_Readability_Child/Improve_Content_Readability_Child_Copy_Set_Test.php | Formatting updates (trailing commas) for copy-set tests. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_Readability_Child/Improve_Content_Readability_Child_Constructor_Test.php | Formatting update (trailing comma). |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_Readability_Child/Abstract_Improve_Content_Readability_Child_Test.php | Formatting updates (trailing commas) in setup/helpers. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_Readability/Improve_Content_Readability_To_Array_Test.php | Updates expectations to match removal of parentTask flag. |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_Readability/Improve_Content_Readability_Constructor_Test.php | Formatting updates (trailing comma). |
| tests/Unit/Task_List/Application/Tasks/Improve_Content_Readability/Abstract_Improve_Content_Readability_Test.php | Formatting updates (trailing commas) in setup. |
| tests/Unit/Task_List/Application/Tasks/Child_Tasks/Content_Score_Child_Task_Trait_Constructor_Test.php | New unit test validating the trait’s guard behavior. |
| tests/Unit/Task_List/Application/Score_Groups/SEO_Score_Groups/SEO_Score_Groups_Repository_Constructor_Test.php | Formatting update (trailing comma). |
| tests/Unit/Task_List/Application/Score_Groups/SEO_Score_Groups/Abstract_SEO_Score_Groups_Repository_Test.php | Formatting update (trailing comma). |
| tests/Unit/Task_List/Application/Score_Groups/Readability_Score_Groups/Readability_Score_Groups_Repository_Constructor_Test.php | Formatting update (trailing comma). |
| tests/Unit/Task_List/Application/Score_Groups/Readability_Score_Groups/Abstract_Readability_Score_Groups_Repository_Test.php | Formatting update (trailing comma). |
| src/task-list/infrastructure/tasks-collectors/tasks-collector.php | Adds constructor-level guard to throw on direct child-task injection; keeps post-type task filtering. |
| src/task-list/infrastructure/register-post-type-tasks-integration.php | Formatting update (trailing comma). |
| src/task-list/infrastructure/indexables/recent-content-indexable-collector.php | Formatting updates (trailing commas) in method calls and data mapping. |
| src/task-list/domain/tasks/parent-task-trait.php | Removes parentTask flag from serialized parent task output. |
| src/task-list/domain/tasks/abstract-completeable-task.php | Deletes unused abstraction (no added behavior beyond interface marker). |
| src/task-list/domain/exceptions/incorrect-child-trait-usage-exception.php | New exception used to enforce trait usage constraints. |
| src/task-list/domain/exceptions/incorrect-child-task-usage-exception.php | New exception used when child tasks are passed directly to the collector. |
| src/task-list/domain/components/score-task-analyzer.php | Refactors analyzer to extend Abstract_Task_Analyzer and inherit to_array(). |
| src/task-list/domain/components/abstract-task-analyzer.php | New shared analyzer base implementing to_array() for analyzers. |
| src/task-list/application/tasks/improve-content-seo.php | Formatting updates and trailing commas; child task creation call formatting. |
| src/task-list/application/tasks/improve-content-readability.php | Formatting updates and trailing commas; child task creation call formatting. |
| src/task-list/application/tasks/enable-llms-txt.php | Switches from removed Abstract_Completeable_Task to Abstract_Task + interface implementation. |
| src/task-list/application/tasks/delete-hello-world.php | Switches from removed Abstract_Completeable_Task to Abstract_Task + interface implementation. |
| src/task-list/application/tasks/complete-ftc.php | Formatting update (trailing comma). |
| src/task-list/application/tasks/child-tasks/improve-content-seo-child.php | Refactors child task to use shared Content_Score_Child_Task_Trait. |
| src/task-list/application/tasks/child-tasks/improve-content-readability-child.php | Refactors child task to use shared Content_Score_Child_Task_Trait. |
| src/task-list/application/tasks/child-tasks/content-score-child-task-trait.php | New trait centralizing shared content-score child-task behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vraja-pro
left a comment
There was a problem hiding this comment.
Except for the Copilot suggestion, I noticed you removed the property parentTask. But I had to use that propery eventually in the latest PR for Fix task list UX feedback. That was the way for me to know if a task is a parent task if there are no child tasks... and then display the message that there are no children. So Actually we do need that property, but maybe we can give it a better name that would indicate it's a boolean value, like : isParentTask
|
Also did the |
Context
Abstract_Completeable_Taskabstract class, as per this, since it doesnt add any functionalityIncorrect_Child_Task_Usage_ExceptionexceptionAbstract_Task_Analyzerclass. Will be proven useful whenever we add more types of analyzers.Content_Score_Child_Task_Trait, to remove a lot of code duplicationSummary
This PR can be summarized in the following changelog entry:
@TODOsin the task-list feature branch.Relevant technical choices:
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Only regression tests:
get_tasksGET request and confirm that you get the very same response with this PR and without (make sure you delete transients or wait a minute between requests)parentTaskattribute should now be namedisParentTask.Relevant test scenarios
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:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation
innovationlabel.Fixes #