Problem/Motivation

Package Manager implements a ton of guardrails and validation. Some of it is useful ("is the filesystem writable?") and some of it is overly restrictive and prescriptive.

The overly restrictive stuff makes Package Manager fragile and frustrating to use. People with perfectly legitimate set-ups, doing perfectly legitimate things, get thwarted when trying to install modules via Project Browser because they accidentally went over some fiddly tripwire that Package Manager put there for "just in case" reasons.

Proposed resolution

Trust site owners more! Package Manager should assume they know what they're damn doing.

This takes the form of removing some things:

\Drupal\package_manager\PathExcluder\UnknownPathExcluder. In practice, this excluder means the recipes directory doesn't get synced from the sandbox into the live site, which breaks applying recipes in Project Browser. Multiple Drupal CMS users have run into this. Sure, you could just allow-list /recipes, but that's kicking the can down the road. What does this excluder give us, really? All it does is encode and enforce Package Manager's very limited idea of which files constitute a legitimate Drupal site. Those assumptions break down in the real world, and that means this class needs to go.

\Drupal\package_manager\Validator\ComposerPluginsValidator. What is the purpose of this validator? Its doc comment explains that it's there to keep changes to the file system within an anticipated set of boundaries. But Composer already does this with its allowed-plugins config. Package Manager enforcing that even further adds nothing except force us to maintain a separate allow/reject-list of plugins, which can change at any time (for example, if a dependency adds a plugin as a dependency, which happened with tbachert/spi) and may then break Package Manager operations unexpectedly. This is another one that has good intentions, but is actually bad in real life. Throw it out.

\Drupal\package_manager\Validator\ComposerPatchesValidator. Another one which does a lot of work because we don't trust that site owners know what they're doing. Developers are the only people who can apply patches. They can be trusted to configure the patcher plugin. If they have configured it, we can trust them to manage it. Package Manager's validation adds nothing but red tape. (This spun off into #3635628: Remove ComposerPatchesValidator, and will not be removed in this issue.)

There may be others, but these are the ones that occur to me right now.

Remaining tasks

Throw them all out, with their tests. All of these validators are explicitly marked as internal, so there are no API changes. This will immediately make Package Manager more reasonable and easier to use.

User interface changes

None. Package Manager has no UI.

Introduced terminology

None.

API changes

None of the removed classes are marked as API.

Data model changes

package_manager.settings will be completely removed. It only contains settings which are relevant to code which is being excised.

Release notes snippet

TBD

Issue fork drupal-3635625

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

After a little discussion in Slack with @catch, I've opened #3635628: Remove ComposerPatchesValidator to discuss the removal of ComposerPatchesValidator a little more.

phenaproxima’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Not that familiar with package_manager but this seems to be pure deletion.
Assuming since the module is experimental we don't need to do the whole BC dance here.

Applied locally and least verified the update hook ran fine.

Going on a limb I apologize to committers if I got it wrong, but will mark.