23302 manage user consent through yoast ai#23306
Open
pls78 wants to merge 8 commits into
Open
Conversation
Coverage Report for CI Build 0Warning No base build found for commit Coverage: 50.322%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
b0f2e6e to
879a3d1
Compare
879a3d1 to
a2074da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
RequestandAPI_Clientfrom abool $is_postflag to astring $http_method(withRequest::METHOD_GET/POST/DELETEconstants), to accommodate the newDELETE /user/consentcall.grant_consent()is transactional (any HTTP failure → propagate, local meta untouched: this means the local meta is only written if the remote call succeeded);revoke_consent()is security-first (HTTP failure → log via the PSR-3 logger + swallow, local meta always cleared no matter what).Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
wp-content/mu-plugins/api-calls.phpor through a plugin to log every outbound HTTP call toyoa.stin the PHP error log:tail -f wp-content/debug.logwithWP_DEBUG_LOGon).Happy path
Grant consent, click it and confirm in the modal.Revoke consentand confirm in the modal.revoke_consentis security-firstwp-content/mu-plugins/yoast-ai-failure-sim.phpor through a plugin. This pre-empts theDELETE /user/consentcall with a synthetic 500 and logs the error with a concrete implementation of our PSR-3 loggerRevoke consent.wp_usermeta, verify_yoast_wpseo_ai_consentfor your user is deleted despite the simulated failure.yoast-ai-failure-sim.phpwhen done with this section.grant_consentis transactional'DELETE'to'POST'in the method check, so thePOST /user/consentcall is the one pre-empted.Grant consent.wp_usermeta, verify_yoast_wpseo_ai_consentfor your user is not set (local meta untouched on grant failure).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:
Request/API_Clienttouches the primitive used by every outbound AI service call. Worth a smoke test of all AI-related features (Generate, Optimize, Summarize, Content Planner, Usage) on top of the consent-specific tests above. Please note https://github.com/Yoast/wordpress-seo-premium/pull/4971 needs to be merged first/checked out to test Premium features with this PR.UI changes
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.Documentation
Quality assurance
Innovation
innovationlabel.Fixes #23302