Problem/Motivation
See #3564195: Disable Package Manager's scaffold validator because it prevents certain recipes from being applied for the situation that prompted this.
Drupal CMS needs to allow certain recipes to scaffold files. Package Manager squarely disallows this; that's the whole point of \Drupal\package_manager\Validator\AllowedScaffoldPackagesValidator.
This restriction, in retrospect, is stupid with extra stupid sauce, and I don't think whatever rationale we had for it makes any sense at all. I think the idea was that we didn't want things to do unexpected scaffolding, but that is just not possible. The root package is the only thing that can allow things to be scaffolded (apart from core's files), and it can only be done by explicit opt-in. That is the nature of the scaffolding plugin. It won't accept scaffold files from any package that you don't trust.
In other words, by adding this additional restriction, Package Manager is directly thwarting the explicit will of the site owner. That sucks like a black hole with a dust buster.
Proposed resolution
Remove that validator. Completely and entirely. Just throw it out.
Issue fork drupal-3564197
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:
- 3564197-package-manager-should
changes, plain diff MR !14147
Comments
Comment #2
phenaproximaComment #3
phenaproximaDrupal CMS can work around this for now, but it's still a release target.
Comment #4
phenaproxima@catch and I discussed in Slack. Here's what was said:
Comment #6
phenaproximaComment #7
phenaproximaLinking the issue where (I think) the restriction was introduced. It has a very detailed explanation of the rationale.
I still think we should remove it. Package Manager in contrib, and Automatic Updates as well, have in some cases put guardrails in place that may have seemed reasonable in theory, when Package Manager was not a critically important part of the default download of Drupal -- but those guardrails break workflows and frustrate people in the real world. We need to reevaluate many of those decisions and make a realistic assessment of whether they are really adding safety, or just adding friction in the name of safety.
The related issue's summary imagines some very bizarre, hacky uses of the scaffold plugin that I'm not sure anyone actually does in real life. But even if such cases exist, the scaffold plugin will not perform scaffold operations defined by any package not explicitly trusted by the site owner. So I think the rationale for that issue maybe never made sense; why that "only trusted packages can do things" bit was missed, I am not sure.
Comment #9
smustgrave commented@phenaproxima mind rebasing?
Comment #10
smustgrave commentedI can't find in the original ticket any specific reason AllowedScaffoldPackagesValidator was added. Leaning on the slack snippet here but pipeline is all green so will mark.
Comment #11
longwaveThe rationale given above makes sense to me. I also think this is eligible for a patch release, given it's only deleting code that was marked @internal in the first place.
Committed and pushed 4b07dbcc69f to main and b33c6f4be15 to 11.x and e2239424eae to 11.3.x. Thanks!