Skip to content

SEO: Keep the empty-language schema test passing on WordPress trunk - #53264

Merged
adamwoodnz merged 1 commit into
trunkfrom
fix/seo-website-schema-empty-language-test
Oct 7, 2026
Merged

adamwoodnz merged 1 commit into
trunkfrom
fix/seo-website-schema-empty-language-test

Conversation

@adamwoodnz

Copy link
Copy Markdown
Contributor

Why

The "PHP tests: PHP 8.4 WP trunk" job fails on every PR that runs the SEO package tests, for example #53011. WordPress trunk (7.2) now ignores an empty value from the locale filter and falls back to en_US. WebsiteSchemaNodeTest::test_optional_fields_omitted_when_empty used that empty filter to fake a site with no language, so on trunk the language is en-US and inLanguage appears. The SEO code is correct; only the test's setup stopped working.

Proposed changes

  • The test blanks the html_lang_attribute translation through gettext, in place of an empty locale. get_bloginfo( 'language' ) returns an empty translation as-is on every WordPress version, so the test still reaches the "no language" branch.
  • tearDown() also clears gettext. No other test in the package filters it.

Test-only, so the changelog entry is empty with a comment.

Verification

  • Reproduced the CI failure locally by installing roots/wordpress:dev-main (7.2-alpha-64163) in the PHP test environment, as the WP trunk job does.
  • With the fix, the SEO suite passes on WordPress trunk and on 7.1.3: 235 tests, 824 assertions on each.
  • Mutation check: with the '' !== $language guard removed, the test fails, so it still catches an empty inLanguage.
  • PHPCS passes on the changed file.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • CI: the "PHP tests: PHP 8.4 WP trunk" job passes for packages/seo.
  • Locally: jp test php packages/seo passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL

WordPress 7.2 ignores an empty value from the `locale` filter and falls
back to en_US, so the test's empty locale no longer produced an empty
language and `inLanguage` appeared. The PHP 8.4 WP trunk job fails on
every PR that runs the SEO tests.

Blank the `html_lang_attribute` translation instead: get_bloginfo()
returns an empty translation as-is on every WordPress version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL
@adamwoodnz adamwoodnz added [Status] Needs Review This PR is ready for review. [Type] Bug labels Oct 7, 2026
@adamwoodnz adamwoodnz self-assigned this Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the fix/seo-website-schema-empty-language-test branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/seo-website-schema-empty-language-test

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@adamwoodnz
adamwoodnz requested a review from gmjuhasz October 7, 2026 01:44
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@adamwoodnz
adamwoodnz requested review from Nikschavan and chihsuan and a balanced review from Copilot October 7, 2026 02:04
@adamwoodnz

Copy link
Copy Markdown
Contributor Author

Codex review

The revised test reliably produces an empty language value without relying on an empty locale filter, and cleans up the added filter.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused test compatibility fix is correct, isolated, and properly cleaned up.

Review effort: Balanced
Findings: None

What changed in this PR

Updates the SEO schema test to remain compatible with WordPress 7.2 trunk.

Changes:

  • Simulates an empty language through gettext.
  • Cleans up the added filter and records the test-only change.
File Description
projects/​packages/​seo/​tests/​php/​WebsiteSchemaNodeTest.php Updates empty-language setup and cleanup.
projects/​packages/​seo/​changelog/​fix-seo-website-schema-empty-language-test Records the test-only compatibility update.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@adamwoodnz
adamwoodnz merged commit c13f6d1 into trunk Oct 7, 2026
88 checks passed
@adamwoodnz
adamwoodnz deleted the fix/seo-website-schema-empty-language-test branch October 7, 2026 02:12
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Oct 7, 2026
@adamwoodnz

Copy link
Copy Markdown
Contributor Author

Merged this to unblock trunk. Open to suggestions on a better fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants