Skip to content

Add Site Health test to detect excessive outbox activity#2928

Merged
pfefferle merged 12 commits intotrunkfrom
add/outbox-rate-health-check
Feb 17, 2026
Merged

Add Site Health test to detect excessive outbox activity#2928
pfefferle merged 12 commits intotrunkfrom
add/outbox-rate-health-check

Conversation

@pfefferle
Copy link
Member

@pfefferle pfefferle commented Feb 16, 2026

Related #2927

Proposed changes:

  • Add a new Site Health test (test_outbox_rate) that queries recent ap_outbox posts to detect abnormal creation rates — good (≤10/hr), recommended (11–50/hr), critical (>50/hr).
  • Show the top 3 most-active object URLs when elevated rates are detected, helping admins identify which posts are being updated excessively.
  • Add outbox stats (total, pending, last-hour count) to the Site Health debug info section for support visibility.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to Tools → Site Health → Status and verify the new "Outbox Activity Rate Test" appears with a "good" badge on a clean install.
  • Go to Tools → Site Health → Info → ActivityPub and verify the new outbox stats fields appear (Outbox Total Items, Outbox Pending Items, Outbox Items (Last Hour)).
  • Run npm run env-test -- --filter=Health_Check — all 32 tests should pass.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch

Type

  • Added - for new features

Message

Add Site Health test to detect excessive outbox activity rates.

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
Copilot AI review requested due to automatic review settings February 16, 2026 22:05
@pfefferle pfefferle self-assigned this Feb 16, 2026
@pfefferle pfefferle requested a review from a team February 16, 2026 22:05
Copy link

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 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

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.
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This looks good, I only have minor comments.

pfefferle and others added 5 commits February 17, 2026 12:32
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.
@pfefferle pfefferle merged commit 33c7db9 into trunk Feb 17, 2026
10 checks passed
@pfefferle pfefferle deleted the add/outbox-rate-health-check branch February 17, 2026 11:50
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.

3 participants

Comments