Skip to content

12E: Resolve a standalone conflict behind an interface a host can rebind - #26

Open
nikolaystrikhar wants to merge 2 commits into
12D-hook-guardfrom
12E-conflict-resolver
Open

12E: Resolve a standalone conflict behind an interface a host can rebind#26
nikolaystrikhar wants to merge 2 commits into
12D-hook-guardfrom
12E-conflict-resolver

Conversation

@nikolaystrikhar

Copy link
Copy Markdown
Contributor

What: adds Conflict\Resolver behind Conflict\Contracts\Resolver_Interface, the Provider binding and the Absorber::resolver() accessor.

Usage:

$container->singleton( Resolver_Interface::class, My_Resolver::class );

Absorber::resolver()->resolve_all();

Why this way:

Nothing wires it in this PR. The plugins_loaded step that runs it lands at the priority ahead of the load pass, and separating the class from its timing keeps the seam a host rebinds reviewable on its own.

An unrecognised policy normalises to the branch that only queues a notice. Conflict_Policy::is_valid() decides before the switch, so a typo like 'defered' — in an option a host persisted, or in whatever the filter returned — is never read as consent to turn off a plugin the site owner deliberately turned on.

Every collaborator is a constructor argument with no default — the registry reader, the detector, the deactivator, the notice queue and the redirector — so the object a test builds is the object the provider builds, and a host's rebinding of either plugin seam reaches it without the resolver knowing a container exists.

Adds Conflict\Resolver behind Conflict\Contracts\Resolver_Interface, the
Provider binding and the Absorber::resolver() accessor. Nothing wires it yet --
the plugins_loaded step that runs it arrives at the priority ahead of the load
pass, and the resolver is the half a host is invited to replace.

It switches on the policy: DEFER no-ops, NOTICE_ONLY queues a notice, and
DEACTIVATE (the default) deactivates network-aware, queues a merge notice and
redirects. An unknown policy is normalised to NOTICE_ONLY through
Conflict_Policy::is_valid() before the switch, so a typo like 'defered' is never
read as consent to turn off a plugin the site owner deliberately turned on.

Every collaborator is a constructor argument with no default -- the registry
reader, the detector, the deactivator, the notice queue and the redirector -- so
the object a test builds is the object the provider builds, and a host's
rebinding of either plugin seam reaches it without the resolver knowing a
container exists.
Every new PHP file declares strict_types, so the rule arrives with the file
rather than as a sweep over it afterwards. PR 21 covers everything that already
existed on main.

@d4mation d4mation left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Being able to rebind this from the Host Plugin could be super powerful 👀

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