Skip to content

AI Recommendations - #701

Draft
ilicfilip wants to merge 26 commits into
developfrom
filip/ai-changes
Draft

AI Recommendations#701
ilicfilip wants to merge 26 commits into
developfrom
filip/ai-changes

Conversation

@ilicfilip

Copy link
Copy Markdown
Collaborator

ilicfilip and others added 12 commits October 28, 2025 15:26
Co-authored-by: Sculptor <sculptor@imbue.com>
Co-authored-by: Sculptor <sculptor@imbue.com>
Co-authored-by: Sculptor <sculptor@imbue.com>
Co-authored-by: Sculptor <sculptor@imbue.com>
Co-authored-by: Sculptor <sculptor@imbue.com>
Resolved conflicts in:
- assets/js/recommendations/ai-task.js: Kept HEAD version with web component attribute approach
- classes/suggested-tasks/providers/class-ai-tasks-from-server.php: Kept HEAD version with button and data attributes

The agent branch implementation uses document.activeElement to identify which trigger button was clicked, allowing multiple AI tasks to share the same popover while maintaining correct task-specific data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Sculptor <sculptor@imbue.com>
Co-authored-by: Sculptor <sculptor@imbue.com>
@github-actions

github-actions Bot commented Oct 31, 2025

Copy link
Copy Markdown
Contributor

Test on Playground
Test this pull request on the Playground
or download the zip

@github-actions

github-actions Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
12 0 12

⚠️ Warnings (12)

📁 AI_TASKS_QUICK_START.md (1 warning)
📍 Line 🔖 Check 💬 Message
0 unexpected_markdown_file Unexpected markdown file "AI_TASKS_QUICK_START.md" detected in plugin root. Only specific markdown files are expected in production plugins.
📁 AI_TASKS_IMPLEMENTATION.md (1 warning)
📍 Line 🔖 Check 💬 Message
0 unexpected_markdown_file Unexpected markdown file "AI_TASKS_IMPLEMENTATION.md" detected in plugin root. Only specific markdown files are expected in production plugins.
📁 classes/suggested-tasks/providers/class-content-review.php (4 warnings)
📍 Line 🔖 Check 💬 Message
232 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
377 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
381 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
388 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/data-collector/class-unpublished-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
103 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/data-collector/class-yoast-orphaned-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
111 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_row()\n$query assigned unsafely at line 98.
📁 classes/suggested-tasks/data-collector/class-terms-without-description.php (1 warning)
📍 Line 🔖 Check 💬 Message
108 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 106.
📁 classes/suggested-tasks/data-collector/class-terms-without-posts.php (1 warning)
📍 Line 🔖 Check 💬 Message
120 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 118.
📁 classes/activities/class-query.php (2 warnings)
📍 Line 🔖 Check 💬 Message
71 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $table_name used in $wpdb->query()\n$table_name assigned unsafely at line 58.
163 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_args used in $wpdb->get_results()\n$where_args assigned unsafely at line 153.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

One conflict, in classes/class-base.php: develop removed the
Onboard_Wizard @method annotation along with the class itself (the
onboarding revert), while this branch added get_ai_tasks() on the
adjacent line. Resolved by keeping get_ai_tasks() and dropping
get_onboard_wizard(), since Progress_Planner\Onboard_Wizard no longer
exists on develop.

classes/class-suggested-tasks.php and
classes/suggested-tasks/class-tasks-manager.php auto-merged; verified
both sides survived — this branch's three prpl_ai_* REST meta fields and
the AI_Tasks_From_Server registration, alongside develop's
rest_sanitize_recommendation XSS filter and the
progress_planner_task_activity_category filter.
The two new AI classes shipped with no coverage, which dropped overall
coverage by 0.78% and failed the Code Coverage Check gate (threshold
-0.5%).

AI_Tasks (9 tests): the get_items() failure paths -- transport error,
non-200 status, non-JSON body -- each return an empty array rather than
propagating an error, plus the caching behaviour, that a different
branding uses a separate cache entry, and the per-task response
cache/clear round-trip.

AI_Tasks_From_Server (10 tests): the AJAX entry point's capability check,
nonce check and required task_id, the cached-response short-circuit
(asserting no HTTP call is made), the missing-license-key path (likewise
no HTTP call), a server error surfacing the server's message without
caching it, a successful execution being cached, and task injection --
including that re-running injection does not duplicate an existing task
and that a task without a title falls back to the default.

Verified by mutation: removing the capability check, the nonce check, the
license-key guard, the non-200 status check, the JSON-decode check or the
cache short-circuit each fail at least one test.

Two notes on what is deliberately not asserted. The non-200 test uses a
valid-JSON body, because a non-JSON body would be caught by the decode
check instead and would not exercise the status guard. And the
is_wp_error() branch in get_items() is not separately pinned: with it
removed, wp_remote_retrieve_response_code() returns '' for a WP_Error, so
the status check already returns the same empty array. That branch only
changes which message is logged.
@github-actions

Copy link
Copy Markdown
Contributor

✅ Code Coverage Report

Metric Value
Total Coverage 32.94% 📉
Base Coverage 32.27%
Difference 📈 0.67%

⚠️ Coverage below recommended 40% threshold

🎉 Great job maintaining/improving code coverage!

📊 File-level Coverage Changes (6 files)

🆕 New Files

Class Coverage Lines
🟢 Progress_Planner\AI_Tasks 100.00% 34/34
🔴 Progress_Planner\Suggested_Tasks\Providers\AI_Tasks_From_Server 54.25% 83/153

📈 Coverage Improved

Class Before After Change
Progress_Planner\Suggested_Tasks\Task 20.00% 23.33% +3.33%
Progress_Planner\Base 45.40% 46.63% +1.23%
Progress_Planner\Suggested_Tasks\Tasks_Manager 62.83% 63.16% +0.33%

📉 Coverage Decreased

Class Before After Change
Progress_Planner\Suggested_Tasks 9.60% 9.02% -0.58%
ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants