Skip to content

Conversation

@pls78
Copy link
Member

@pls78 pls78 commented Oct 2, 2025

Context

  • We want to tidy up the AI-related code.
  • ⚠️ Adapt the Yoast SEO version number in the deprecation docblocks and _deprecated_function according to the release this PR will be part of.

Summary

This PR can be summarized in the following changelog entry:

  • Re-organizes AI-related code by collecting all modules into an ai parent directory and consequently losing the AI_ namespace/class prefix
  • Exposes the REST endpoints in the window object.

Relevant technical choices:

  • All the AI-related modules dropped the AI_ prefix and are now under an ai parent directory.
  • Endpoint_List and Endpoints_Repository classes have been moved to src/routes/endpoint directory, so that they can be re-used throughout the codebase and not being re-declared each time.
  • Consent_Endpoint_Interface, Free_Sparks_Endpoint_Interface, Generator_Endpoint_Interface have been introduced to let our DI container know which endpoints need to be gathered by the respective repository. As a result, they are attached to the respective integration window object in the endpoint property (exception made for the Free Sparks one, which is bundled in thewpseoAiGenerator window object.
  • This means we can now fetch routes URLs from the backend, avoiding hard-coding it in JavaScript ( like we already do in the Dashboard)

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Regression-test all the AI-related features in the following cases
    • Only Free (this PR/RC) installed -> test the free version of the AI Generate feature
    • Free + Premium both up-to-date (This PR/RC + corresponding Premium PR/RC)
    • Up-to-date Free and old version of Premium

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • N/A

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes Make deprecated AI-related classes usable by Premium

@pls78 pls78 added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Oct 2, 2025
@coveralls
Copy link

coveralls commented Oct 3, 2025

Pull Request Test Coverage Report for Build 947a0514c8ae6e99811eb0fc52c9b5725363aedd

Details

  • 671 of 732 (91.67%) changed or added relevant lines in 41 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on feature/re-organize-ai-code at 49.452%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ai/http-request/domain/exceptions/wp-request-exception.php 0 2 0.0%
src/ai/consent/application/consent-endpoints-repository.php 0 3 0.0%
src/ai/free-sparks/application/free-sparks-endpoints-repository.php 0 3 0.0%
src/ai/generate/application/generator-endpoints-repository.php 0 3 0.0%
src/routes/endpoint/endpoint-list.php 0 4 0.0%
src/ai/http-request/domain/exceptions/payment-required-exception.php 0 5 0.0%
src/ai/http-request/domain/exceptions/remote-request-exception.php 0 5 0.0%
src/routes/endpoint/endpoints-repository.php 0 7 0.0%
src/ai/http-request/domain/request.php 0 13 0.0%
src/ai/http-request/domain/response.php 0 16 0.0%
Totals Coverage Status
Change from base Build 44608024e022368daba1a3d1fdd2be87e0e4c75f: 49.5%
Covered Lines: 17323
Relevant Lines: 35030

💛 - Coveralls

@pls78 pls78 force-pushed the feature/re-organize-ai-code branch from 947a051 to b253898 Compare October 7, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make deprecated AI-related classes usable by Premium

2 participants