Skip to content

fix: defer failed Requirement messages until translation functions are available#453

Merged
dkotter merged 4 commits intoWordPress:developfrom
justlevine:fix/defer-notice-messages
Apr 21, 2026
Merged

fix: defer failed Requirement messages until translation functions are available#453
dkotter merged 4 commits intoWordPress:developfrom
justlevine:fix/defer-notice-messages

Conversation

@justlevine
Copy link
Copy Markdown
Contributor

@justlevine justlevine commented Apr 21, 2026

What?

This PR moves the failed requirement message generation so they're triggered inside {network_}admin_notices.

RequirementsTest has been cleaned up to cover the full public API (mocking the `::$requirements) instead of testing individual methods), and to cover this particular edge case.

Why?

While we need to resolve the checks as early as possible, messages can only be generated after translation functions are loaded.

How?

::get_admin_notice_message_html() is now a static method that takes the array of ::$requirements passed inside the {network_}admin_notices callback.

Use of AI Tools

GitHub Copilot autocomplete

Testing Instructions

Screenshots or screencast

image

(This screenshot is with #268 applied
image
)

Changelog Entry

Added - New feature.
Changed - Existing functionality.
Deprecated - Soon-to-be removed feature.
Removed - Feature.
Fixed - Bug fix.
Security - Vulnerability.
Development Update - Development related updates.

Fixed - Defer failed Requirements messages until translation functions are available.

Open WordPress Playground Preview

@justlevine justlevine requested review from Copilot and dkotter and removed request for dkotter April 21, 2026 20:22
@github-actions
Copy link
Copy Markdown

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: justlevine <[email protected]>

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an initialization edge case in the plugin’s requirements checks by deferring failed-requirement message generation until {network_}admin_notices, when translation functions/text domain are available, and updates integration tests accordingly.

Changes:

  • Defer requirement error-message callback invocation to admin notice render time (instead of during early checks).
  • Refactor get_admin_notice_message_html() into a static method that accepts resolved requirement results.
  • Update/expand RequirementsTest to validate notice output behavior (single vs multiple failures) and the deferral behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
includes/Requirements.php Defers error-message generation to admin notice hooks; makes notice-message builder static and parameterized.
tests/Integration/Includes/RequirementsTest.php Adjusts tests to validate notice output and ensures error-message callbacks aren’t invoked until notices render.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/Requirements.php Outdated
Comment thread tests/Integration/Includes/RequirementsTest.php Outdated
Comment thread tests/Integration/Includes/RequirementsTest.php Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.87%. Comparing base (e63d8c0) to head (9aa9111).
⚠️ Report is 17 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #453      +/-   ##
=============================================
- Coverage      67.41%   66.87%   -0.54%     
  Complexity       907      907              
=============================================
  Files             59       59              
  Lines           4352     4695     +343     
=============================================
+ Hits            2934     3140     +206     
- Misses          1418     1555     +137     
Flag Coverage Δ
unit 66.87% <100.00%> (-0.54%) ⬇️

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.

@jeffpaul jeffpaul added this to the 0.8.0 milestone Apr 21, 2026
@jeffpaul jeffpaul requested a review from dkotter April 21, 2026 20:48
@jeffpaul jeffpaul moved this to Needs review in WordPress AI Planning & Roadmap Apr 21, 2026
@dkotter dkotter merged commit c95d0fe into WordPress:develop Apr 21, 2026
17 of 18 checks passed
@github-project-automation github-project-automation Bot moved this from Needs review to Done in WordPress AI Planning & Roadmap Apr 21, 2026
@justlevine justlevine deleted the fix/defer-notice-messages branch April 21, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants