This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
[CYS] Fix regression and ensure AI-generated content is assigned to products after the third attempt #12016
Merged
Conversation
This file contains 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
…ontent after the 3rd attempt.
nefeline
added
type: bug
The issue/PR concerns a confirmed bug.
focus: ai
Issues related to AI generated content in blocks and patterns
labels
Dec 1, 2023
nefeline
added
the
status: blocker
Used on issues or pulls that block work from being released.
label
Dec 4, 2023
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.53 MB ℹ️ View Unchanged
|
albarin
approved these changes
Dec 4, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great @nefeline thanks for working on this! and sorry for introducing the regression 🙏
I've merged trunk to solve some conflicts, approving! 🚀
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
focus: ai
Issues related to AI generated content in blocks and patterns
status: blocker
Used on issues or pulls that block work from being released.
type: bug
The issue/PR concerns a confirmed bug.
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.
What
On #11952 we made a change to ensure the product permalink is updated whenever AI generates content for it and also flushed the rewrite rules.
Unfortunately, this change caused a regression in the assignment of content to products due to changes in the hashes for the products used by the
should_update_dummy_product
method.This method,
should_update_dummy_product
, is responsible for determining if a given dummy product should be updated by AI: when updating the post viawp_update_post
we would update the hash for the product ahead of time, causingshould_update_dummy_product
to identify the content of the dummy product as manually modified by the user, when in reality it wasn't.As a consequence, the store owner would:
generate_content
method.woocommerce-blocks/src/Patterns/ProductUpdater.php
Line 144 in 25067f3
To solve this problem, this PR introduces the following changes:
wp_update_post
for updating the post (aka product) content, relying on the native WooCommerce methods instead.$product->set_slug
for updating the permalink.product_content
as an empty array instead of an error.Why
This change is required to ensure product content is successfully generated by AI and assigned to products independent of the number of attempts.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Setup
rsync
to sync this branch with your remote install.If you don't have any install configured yet, create a new WooExpress or JN install from scratch
Remove the pre-existing WooCommerce plugin via SSH and
Install and activate WooCommerce from the following zip file: woocommerce.zip
Install and activate WooCommerce Blocks from the following zip file: woocommerce-gutenberg-products-block.zip
Install and activate WooCommerce Beta Tester (the plugin is available within the monorepo)
Install and activate Woo AI (the plugin is available within the monorepo)
Head over to
/wp-admin/tools.php?page=woocommerce-admin-test-helper
and enablecustomize-store
feature flag:Test the CYS experience
Caveat: the AI endpoint is known for being unstable, so you might encounter errors during the loading screen. If that happens, click "Try Again" to attempt updating one more time. We have additional upcoming changes to ensure better error handling planned for implementation in upcoming PRs.
Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog