close
Skip to content

Filter Guidelines service queries by content guideline type#593

Merged
dkotter merged 3 commits into
developfrom
fix/guidelines-content-type-filter
May 20, 2026
Merged

Filter Guidelines service queries by content guideline type#593
dkotter merged 3 commits into
developfrom
fix/guidelines-content-type-filter

Conversation

@gziolo
Copy link
Copy Markdown
Member

@gziolo gziolo commented May 20, 2026

Summary

  • Restrict Guidelines::fetch_guidelines() to the content term of the new wp_guideline_type taxonomy so a newer artifact guideline can't shadow the content singleton in prompt assembly.
  • Fall back to the existing "newest wins" query when the taxonomy isn't registered (Gutenberg < 23.1), preserving backwards compatibility.
  • Add Guidelines::TAXONOMY / Guidelines::TERM_CONTENT constants and three regression tests covering the content-vs-artifact preference, artifact-only sites, and the pre-taxonomy fallback path.

Fixes #529.

Test plan

  • composer run-script format — clean
  • composer run-script lint — clean
  • composer run-script phpstan — clean for changed files (pre-existing unrelated Requirements.php warning)
  • npm run test:php -- --filter Guidelines_Test — 31/31 pass
  • npm run test:php -- --filter Abstract_Ability_Guidelines_Test — 9/9 pass

🤖 Generated with Claude Code

Open WordPress Playground Preview

Gutenberg 23.1 introduced the `wp_guideline_type` taxonomy and now auto-
tags guidelines saved without a type as `artifact`. The service queried
the newest `wp_guideline` without filtering, so an artifact guideline
could shadow the content singleton in prompt assembly.

Restrict the query to the `content` term when the taxonomy is
registered; fall back to the legacy "newest wins" behavior on older
Gutenberg.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: gziolo <gziolo@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: henryperkins <htperkins@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@gziolo gziolo requested review from dkotter and jeffpaul May 20, 2026 10:04
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.18%. Comparing base (514a7a7) to head (c541748).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #593      +/-   ##
=============================================
+ Coverage      73.16%   73.18%   +0.02%     
- Complexity      1730     1731       +1     
=============================================
  Files             85       85              
  Lines           7467     7473       +6     
=============================================
+ Hits            5463     5469       +6     
  Misses          2004     2004              
Flag Coverage Δ
unit 73.18% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkotter dkotter added this to the 1.1.0 milestone May 20, 2026
@dkotter dkotter merged commit 246680c into develop May 20, 2026
18 checks passed
@dkotter dkotter deleted the fix/guidelines-content-type-filter branch May 20, 2026 20:56
simison pushed a commit to simison/ai that referenced this pull request May 25, 2026
…s#593)

Changed - Filter Guideline queries by the guideline type content

Co-authored-by: gziolo <gziolo@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: henryperkins <htperkins@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter Guidelines service queries by content guideline type

2 participants