Repository navigation
Fix: Read Guidelines from wp_knowledge storage - #988
Conversation
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #988 +/- ##
=============================================
+ Coverage 74.57% 74.62% +0.04%
- Complexity 3132 3151 +19
=============================================
Files 132 132
Lines 12213 12243 +30
=============================================
+ Hits 9108 9136 +28
- Misses 3105 3107 +2
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:
|
a2b7dc7 to
ff933cc
Compare
|
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. |
- Filter rows by the guideline knowledge type when the taxonomy is registered, so a foreign row with a guideline slug never reaches prompts. Covered by new tests. - Fall back to the built-in scopes when the scope registry returns nothing usable. - Fetch the block row in the same query as the scope rows. - Read the block row by its slug key instead of reset(). - Derive the fallback scope list from CATEGORY_TAG_NAMES. - Move the shared strip-and-truncate logic into one helper. - Make the slug builders public and reuse them in the test helpers, and drop the redundant cache resets there. - Update docs that still described the old wp_guideline meta storage.
dkotter
left a comment
There was a problem hiding this comment.
Overall this looks good to me but any thoughts on a migration routine for those that had been using this? Not sure if we care about migrating existing Guidelines to the new post type and taxonomy or if we are fine with breaking changes here
|
Good point. I worked on the upstream Gutenberg changes and can confirm we intentionally decided against migration. Guidelines is still an opt-in experiment, so we accepted the breaking storage change while the feature remains experimental. |
What?
Follow-up to #949. This extracts the Guidelines service repair requested in #949 (comment) so it can be reviewed and merged independently.
The service now reads published guideline rows from the shared
wp_knowledgepost type instead of the removedwp_guidelinepost type and its post meta.Why?
Current Gutenberg stores each guideline scope and per-block guideline as its own
wp_knowledgerow. The AI plugin still queried the removed storage model, so prompt-building integrations quietly stopped receiving guidelines.How?
guideline-{scope}slugs.guideline-block-{namespace}_{name}slugs.Use of AI Tools
AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-5
Used for: Extracting the fix from #949, adapting it to remain standalone, identifying a registry key type-safety issue, and adding verification. The resulting diff and test output were reviewed.
Testing Instructions
The original Guidelines integration was implemented in #359 for #322. These steps adapt its testing instructions to the current
wp_knowledgestorage.Automated testing
npx wp-env --config=.wp-env.test.json run cli --env-cwd=wp-content/plugins/ai vendor/bin/phpunit -c phpunit.xml.dist --filter '/(Guidelines_Test|Abstract_Ability_Guidelines_Test|HelpersTest|Editorial_NotesTest)/'Validation on the latest commit:
Manual testing without Guidelines storage
wp_knowledgepost type, open a post and run a guideline-aware AI ability such as title generation.Manual testing with the Gutenberg Guidelines experiment
wp_knowledgestorage, then enable Guidelines under Gutenberg → Experiments.<guidelines>,<site-context>, and<copy-guidelines>.<block-guidelines>.