Skip to content

Only one of the three network site-status filters is reachable #398

Description

@josephfusco

The network read path filters archived, spam, and deleted sites at three get_sites() calls. Only wp_presence_compute_network_snapshot() is positioned to drop anything, because the other two read its output.

wp_presence_hydrate_network_snapshot() has one caller (network-functions.php:535), and the sites-by-user index is built at :409. Both take compute's return value, and the presence_network cache group is non-persistent, so a snapshot cannot outlive the request that built it.

The is_array() guards alongside them are likewise unreachable: get_sites() returns an array unless 'count' => true is passed, which nothing here does.

Evidence

One edit each, then WP_MULTISITE=1 ./vendor/bin/phpunit --group ms-required:

Mutation Result
Drop the six downstream arguments 62 pass
Drop all nine 3 failures, one per regression test

Tasks

  • Narrow the status filter to wp_presence_compute_network_snapshot()
  • Drop the five is_array() guards
  • Confirm each regression test fails when its flag is removed from compute, now that nothing masks it

Leave uninstall.php and wp_presence_get_network_site_ids() unfiltered by status. Both need to reach archived, spam, and deleted sites, or their presence tables are left behind.

Follow-up to #351.

Use of AI Tools
  • AI assistance: Yes
  • Tool(s): Claude Code
  • Model(s): Opus 5
  • Used for: Assisting with mutation testing and drafting this issue.

Activity

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

Metadata

Metadata

Assignees

Labels

Good First IssueIssue particularly suitable to be worked on by new contributors[Area] MultisiteNetwork-wide presence, aggregation, and Network Admin surfaces[Type] EnhancementA suggestion for improvement of an existing featurephpPull requests that update php code

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions