Skip to content

9 [3/4]. Report a host basename no installed plugin answers to - #65

Merged
nikolaystrikhar merged 1 commit into
mainfrom
54-host-basename-validated
Aug 25, 2026
Merged

9 [3/4]. Report a host basename no installed plugin answers to#65
nikolaystrikhar merged 1 commit into
mainfrom
54-host-basename-validated

Conversation

@nikolaystrikhar

@nikolaystrikhar nikolaystrikhar commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

What: Conflict\Detector::deactivation_would_strand_sites() reports through _doing_it_wrong() and the error action when Config::set_host_plugin_basename() names no installed plugin.

Usage:

Config::set_host_plugin_basename( __FILE__ ); // instead of plugin_basename( __FILE__ )
// error: 'The host plugin basename "…" names no installed plugin' — instead of a
// stranding notice that recurs on every admin GET with nothing to act on.

Why this way:

The check belongs at the point of use, not in the setter. set_host_plugin_basename() is static and a host calls it at plugin-file scope, where get_plugins() does not exist. The detector asks on the request where the value is about to decide whether a standalone is deactivated.

The answer is not changed, only reported. A typo, an mu-plugin host or a symlinked directory all answer "not network-active" for ever, which is indistinguishable from the guard working — but a name we cannot resolve is not consent to pull a plugin from every site on a network. An unset basename stands the guard down exactly as before.

Once per request, on the instance. The detector is a singleton, so one report and one get_plugins() per request. A static flag would go quiet for the rest of the worker's life and would need a reset seam in src/.

Summary by CodeRabbit

  • Bug Fixes

    • Improved multisite conflict handling when the configured host plugin is missing, unknown, or incorrectly specified.
    • Standalone installations remain active instead of repeatedly triggering conflict guard notices.
    • Developers now receive clear incorrect-usage warnings for invalid host plugin values.
    • Added validation for installed host plugins while preserving existing network activation and stranding behavior.
  • Documentation

    • Clarified that host plugins must be configured using their plugin basename.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Enterprise

Run ID: cd072b69-431f-4d54-88a5-cf1aba03381a

📥 Commits

Reviewing files that changed from the base of the PR and between aa7fd99 and c1f4cf1.

📒 Files selected for processing (4)
  • docs/conflict-handling.md
  • src/Conflict/Detector.php
  • tests/unit/Conflict/DetectorTest.php
  • tests/unit/Scenario/ConflictTest.php

Included review availability: Your plan provides up to 12 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The detector now validates configured host plugin basenames against installed plugins, reports invalid values through _doing_it_wrong(), and checks each detector instance once. Documentation and unit and scenario tests cover valid, missing, unknown, and unset basenames.

Changes

Host Plugin Validation

Layer / File(s) Summary
Detector validation and configuration contract
src/Conflict/Detector.php, docs/conflict-handling.md
The detector lazily verifies the configured host basename against installed plugins once per instance. Unknown values trigger _doing_it_wrong() and do not alter the existing stranding decision. Documentation requires an installed plugin basename.
Validation and scenario coverage
tests/unit/Conflict/DetectorTest.php, tests/unit/Scenario/ConflictTest.php
Tests cover installed, missing, unknown, and unset basenames. Scenario fixtures now stub installed host and standalone plugins. Tests verify reporting, caching, activation, and queued notices.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to c1f4c

This change adds reporting for an unresolved host plugin basename without changing the existing detection answer; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: d4mation

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. (1 skipped: 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the main change: report when the configured host basename has no installed plugin. The wording is awkward, but it remains specific and related to the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 54-host-basename-validated

Comment @coderabbitai help to get the list of available commands.

@nikolaystrikhar
nikolaystrikhar force-pushed the 54-host-basename-validated branch from b4f04cf to e53b1e5 Compare August 24, 2026 13:41
@nikolaystrikhar nikolaystrikhar changed the title 7B. Report a host basename no installed plugin answers to 9B. Report a host basename no installed plugin answers to Aug 25, 2026
@nikolaystrikhar
nikolaystrikhar force-pushed the 48-conflict-sees-the-load-gate branch from abe252d to 4727abf Compare August 25, 2026 08:44
@nikolaystrikhar
nikolaystrikhar force-pushed the 54-host-basename-validated branch from e53b1e5 to 06b0335 Compare August 25, 2026 08:44
@nikolaystrikhar nikolaystrikhar changed the title 9B. Report a host basename no installed plugin answers to 7B. Report a host basename no installed plugin answers to Aug 25, 2026
@nikolaystrikhar
nikolaystrikhar force-pushed the 48-conflict-sees-the-load-gate branch from 4727abf to ca1b3ba Compare August 25, 2026 10:22
@nikolaystrikhar
nikolaystrikhar force-pushed the 54-host-basename-validated branch from 06b0335 to c1f4cf1 Compare August 25, 2026 10:23
@nikolaystrikhar nikolaystrikhar changed the title 7B. Report a host basename no installed plugin answers to 5 [3/4]. Report a host basename no installed plugin answers to Aug 25, 2026
@nikolaystrikhar
nikolaystrikhar changed the base branch from 48-conflict-sees-the-load-gate to 39-registry-survives-a-collision August 25, 2026 10:23
@nikolaystrikhar nikolaystrikhar changed the title 5 [3/4]. Report a host basename no installed plugin answers to 9 [3/4]. Report a host basename no installed plugin answers to Aug 25, 2026
@nikolaystrikhar
nikolaystrikhar force-pushed the 39-registry-survives-a-collision branch from aa7fd99 to 39a2196 Compare August 25, 2026 13:03
@nikolaystrikhar
nikolaystrikhar force-pushed the 54-host-basename-validated branch from c1f4cf1 to c3d1f6d Compare August 25, 2026 14:13
Base automatically changed from 39-registry-survives-a-collision to main August 25, 2026 14:15
@nikolaystrikhar
nikolaystrikhar merged commit 3952a33 into main Aug 25, 2026
6 checks passed
@nikolaystrikhar
nikolaystrikhar deleted the 54-host-basename-validated branch August 25, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants