Remove unused ai service class - #905
Conversation
AI_Service was introduced in WordPress#101 (0.2.1) as a proposed centralized layer for AI provider access. It was never adopted by any experiment or ability, and a follow-up PR (WordPress#898) to wire it in was closed as not wanted. Removing the dead code rather than carrying it forward. Refs WordPress#233
Companion removal to the AI_Service class deletion. No other test depends on this file. Refs WordPress#233
Drops the get_ai_service() function and its AI_Service use-import. No longer needed now that AI_Service itself is gone; experiments and abilities call wp_ai_client_prompt() directly. Refs WordPress#233
The Services/ folder description referenced AI_Service; updated to reflect that it now only contains Guidelines. Refs WordPress#233
Drops the includes/Services/AI_Service.php entry from the Related Files list since the file no longer exists. Refs WordPress#233
Documents the removal under Unreleased. The historical 0.2.1 entry describing AI_Service's original introduction is left untouched. Refs WordPress#233
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #905 +/- ##
==========================================
Coverage 80.43% 80.44%
- Complexity 2565 2566 +1
==========================================
Files 110 110
Lines 10448 10451 +3
==========================================
+ Hits 8404 8407 +3
Misses 2044 2044
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dkotter
left a comment
There was a problem hiding this comment.
@theaminulai Thanks for the PR! In thinking about it a bit more, since the class is public and the helper function is also public, better to deprecate those and remove later than just remove entirely. Otherwise anyone that is relying on those will hit fatal errors.
I've pushed changes to handle that deprecation process but let me know if all of that looks good to you. In addition, would be great to get the PR title and description updated since we're not removing anything in this release, just deprecating
What?
See #233
Removes the unused
AI_Servicelayer (includes/Services/AI_Service.php), its test file, and theget_ai_service()helper.Why?
AI_Servicewas introduced in #101 (0.2.1) as a proposed centralized layer for AI provider access, and #233 tracked refactoring the experiments to use it. A follow-up PR (#898) that wired several abilities throughAI_Servicewas closed, since per [@jeffpaul's comment](#233 (comment)) and @dkotter's review on #898, the layer isn't used anywhere, hasn't been adopted by newer experiment PRs, and doesn't provide value over callingwp_ai_client_prompt()directly. Rather than carry the dead code forward, this PR removes it.How?
includes/Services/AI_Service.php(thecreate_textgen_prompt()wrapper and singleton).tests/Integration/Includes/Services/AI_ServiceTest.php.get_ai_service()helper and itsuse WordPress\AI\Services\AI_Service;import fromincludes/helpers.php. Theai_experiments_service_initializedaction referenced only in the deleted test was never fired anywhere (do_action()for it doesn't exist in the codebase), so no hook needs replacing.docs/ARCHITECTURE_OVERVIEW.mdanddocs/experiments/multi-provider-support.mdto drop references toAI_Service(theincludes/Services/folder still exists forGuidelines.php).AI_Service::get_instance()orget_ai_service()— all AI calls already go throughwp_ai_client_prompt()directly, so this is a pure removal with no functional change.Testing Instructions
AI_Serviceandget_ai_service— no matches should remain outside historical CHANGELOG entries.composer test