Repository navigation
fix(seo): default analysisType to full in wp_seo_analyze_content - #268
Conversation
The tool schema requires only postId and documents analysisType as
optional ("default: full"), but SEOTools.analyzeContent() validated
analysisType as required, so a call without it failed with "Missing
required parameters: analysisType". Apply the documented default before
validation; an omitted type now shares the cached "full" analysis.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer's GuideFixes Sequence diagram for default SEO content analysissequenceDiagram
participant Caller
participant SEOTools
participant Cache
participant WordPress
Caller->>SEOTools: analyzeContent(client, rawParams)
SEOTools->>SEOTools: Apply analysisType ?? "full"
SEOTools->>SEOTools: validateRequired(params, ["postId"])
SEOTools->>Cache: Lookup seo:analyze:site:postId:full
alt cached analysis
Cache-->>SEOTools: SEO analysis result
else cache miss
SEOTools->>WordPress: Fetch post content
WordPress-->>SEOTools: Post content
SEOTools->>Cache: Store analysis under full key
end
SEOTools-->>Caller: SEO analysis result
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the schema contract and includes focused regression coverage.
0 open findings
What changed in this PR
Fixes SEO analysis calls that omit the optional analysisType, defaulting them to "full" before validation and caching.
Changes:
- Applies the documented default and preserves
postIdvalidation. - Adds regression and cache-reuse tests.
- Documents schema/handler validation consistency.
| File | Description |
|---|---|
src/tools/seo/SEOTools.ts |
Defaults analysisType before validation and cache-key creation. |
tests/tools/seo/SEOToolsAnalyzeContent.test.js |
Adds regression coverage for defaults, caching, validation, and handler behavior. |
src/tools/AGENTS.md |
Documents schema/default handling requirements. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 720962fe8e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
wp_seo_suggest_internal_links documented maxSuggestions "default: 5" and wp_seo_site_audit documented maxPages "default: 100", but the code applies 10 and 50 (50 posts and 50 pages). The descriptions now name the real defaults, so the new AGENTS.md rule holds; behaviour is unchanged. docs/api regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up. The analysis cache key left out focusKeywords, but ContentAnalyzer scores them (the first as primary), so a second call with other keywords got the first call's keyword analysis back. The keywords are now part of the key, in order. Also: the maxPages description notes WordPress's per_page limit of 100, and the AGENTS.md rule names where required parameters are checked in code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Focus keywords were joined with "," into the analysis cache key, so ["caching,faster"] and ["caching", "faster"] shared a cached result although the scored primary keyword differs. Key them as JSON instead. src/tools/AGENTS.md: state the cache-key contract instead of the history of the old defaults (DOX: contracts, not diary entries). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
## [4.1.1](v4.1.0...v4.1.1) (2026-10-10) ### 🐛 Bug Fixes * **seo:** default analysisType to full in wp_seo_analyze_content ([#268](#268)) ([1705144](1705144))
|
🎉 This PR is included in version 4.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Pull Request
Description
wp_seo_analyze_contentfailed withoutanalysisType:Failed to analyze content: Missing required parameters: analysisType. The tool schema requires onlypostIdand describesanalysisTypeas optional ("default: full"), butSEOTools.analyzeContent()validated it as required. This is the regression reported in the v4.0.9 re-test results.Type of Change
Changes Made
SEOTools.analyzeContent()applies the documented default (analysisType ?? "full") before validating, and validates onlypostId. Because the default is applied before the cache key is built, an omitted type and an explicit"full"share one cached analysis.src/tools/AGENTS.md: a handler'svalidateRequired()list must not be stricter than the schema'srequired, and an optional property whose description names a default gets that default in code. Review follow-up (b40d835): two descriptions named defaults the code never applied.wp_seo_suggest_internal_linksmaxSuggestionssaid 5 and the code uses 10;wp_seo_site_auditmaxPagessaid 100 and the code uses 50 (50 posts and 50 pages). The descriptions now name the real defaults (no behaviour change), anddocs/apiis regenerated. All other(default: …)descriptions insrc/toolsmatch their handlers.tests/tools/seo/SEOToolsAnalyzeContent.test.js(5 tests): the schema keepsanalysisTypeoptional; calls without it work directly and throughhandleAnalyzeContent; the omitted and explicit"full"cases share the cache;postIdis still required.Testing
format:check,security:scanwp_seo_analyze_contentwithoutanalysisTypeon post 1649, which returned an analysis (44 words)Documentation
src/tools/AGENTS.md)Security
Independent review follow-up
focusKeywords(in order). It left them out, so a repeat call with other keywords got the earlier keyword analysis back. Test added; red before the fix.maxPagesdescription notes WordPress'sper_pagelimit of 100; the AGENTS.md rule names where required parameters are checked in code.CacheManagermeasures milliseconds, so the 6-hour analysis cache really lasts 21.6 s (this also affects theSEO_CACHE_*_TTLsettings). Fixing the units would make results stay cached for hours after a post edit, so it's a behaviour decision for its own change.🤖 Generated with Claude Code
Summary by Sourcery
Fix SEO content analysis defaults and cache isolation so optional inputs behave consistently with the tool contract.
Bug Fixes:
wp_seo_analyze_contentto defaultanalysisTypetofullwhile continuing to requirepostId.Enhancements:
Documentation:
Tests: