Add Site Health test to detect excessive outbox activity#2928
Merged
Add Site Health test to detect excessive outbox activity#2928
Conversation
Third-party plugins can call wp_update_post() on published posts at high frequency, flooding the outbox with redundant Update activities. This adds a Site Health test that detects abnormal outbox creation rates and exposes outbox stats in the debug info section for support visibility. Fixes #2927
There was a problem hiding this comment.
Pull request overview
This PR adds a new Site Health test to detect and alert administrators when excessive outbox activity is occurring, which may indicate problematic plugin behavior causing excessive federation updates.
Changes:
- Adds
test_outbox_rate()method to detect abnormal outbox creation rates with three severity levels (good ≤10/hr, recommended 11-50/hr, critical >50/hr) - Displays the top 3 most-active object URLs when elevated rates are detected to help identify the source
- Adds outbox statistics (total, pending, last-hour count) to the Site Health debug info section
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| includes/wp-admin/class-health-check.php | Implements outbox rate detection logic, helper methods for data retrieval, and integrates stats into debug info |
| tests/phpunit/tests/includes/wp-admin/class-test-health-check.php | Adds comprehensive test coverage for the new outbox rate detection feature |
| .github/changelog/2928-from-description | Documents the patch release with changelog entry |
tests/phpunit/tests/includes/wp-admin/class-test-health-check.php
Outdated
Show resolved
Hide resolved
Vary timestamps across created items in the test helper and add a test verifying items older than 1 hour are excluded from the rate data.
Replace get_outbox_rate_data() (which fetched posts capped at 100 and grouped by object ID) with get_outbox_rate_count() that uses a single WP_Query to count all outbox items in the last hour via found_posts. This fixes undercounting on high-activity sites and removes the unnecessary per-object grouping.
jeherve
reviewed
Feb 17, 2026
Member
jeherve
left a comment
There was a problem hiding this comment.
This looks good, I only have minor comments.
tests/phpunit/tests/includes/wp-admin/class-test-health-check.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
The critical outbox rate test was asserting the old developer-jargon text `wp_update_post()` which was already removed from the description.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related #2927
Proposed changes:
test_outbox_rate) that queries recentap_outboxposts to detect abnormal creation rates — good (≤10/hr), recommended (11–50/hr), critical (>50/hr).Other information:
Testing instructions:
npm run env-test -- --filter=Health_Check— all 32 tests should pass.Changelog entry
Changelog Entry Details
Significance
Type
Message
Add Site Health test to detect excessive outbox activity rates.