Problem/Motivation
This is spun off from #3635625: Remove parts of Package Manager which tend to thwart site owners. In that issue, I railed against \Drupal\package_manager\Validator\ComposerPatchesValidator:
[It] 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.
I still think we should remove it, but in Slack, @catch asked for this piece to be made into its own issue so we can discuss and consider the removal more carefully.
Proposed resolution
Either remove ComposerPatchesValidator, or make it a simple StatusCheckEvent subscriber that warns if you have the patcher enabled.
Remaining tasks
TBD
User interface changes
TBD
Introduced terminology
None.
API changes
None anticipated. The validator is explicitly marked as internal.
Data model changes
None.
Release notes snippet
TBD
Comments
Comment #2
phenaproximaAs far as I know, the main argument in favor of keeping this validator is the fact that patches can break updates.
And that's absolutely true, but let's consider:
cweagans/composer-patchesis enabled at the root of the project.And that is true for Drupal CMS 2.3.0 and up, but not the core project template.We have since reverted that, so: neither core nor Drupal CMS trust the patches plugin by default.In Slack, @bbrala did a quick search, ecosystem-wide, for
"patches", and it's a lot:To me, that makes the documentation problem urgent. People do this, and they shouldn't! Without guidance, people do the thing that gets them out of their current pickle, even if it's a bad idea long-term.
Granted,
ComposerPatchesValidatorisn't too problematic in and of itself; it doesn't validate the patches themselves, it just validates that the patches plugin is configured in a specific way. I could live with keeping it. But it's not Package Manager's job to be this prescriptive. Package Manager actually has no opinion on this beyond "a patch that doesn't apply, should cause a failed Composer operation". Which is already the case; the current, supported version of the patches plugin (2.x) will always crap out with an error if it encounters a patch it can't apply. Indeed, one of the settings the validator checks for (composer-exit-on-patch-failure) no longer even exists.So that leaves us with a validator that is mostly useless, relying on a configuration option that doesn't exist, and neither helping or harming the ecosystem-wide problem of people shipping patches when they shouldn't.
It's cruft. Let's throw it out.