Generated with the help of an LLM.
Problem/Motivation
drupal/core-recipe-unpack removes every recipe it unpacks from composer.lock without checking whether a package that stays installed still requires it. When an install profile, a module, or a recipe that is not unpacked requires that recipe, composer.lock is left with a requirement it cannot satisfy. composer validate still passes, but composer install from the lock fails, so every fresh checkout and every deploy that installs from the lock breaks:
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- vardot/varbase is locked to version 11.0.1 and an update of this package was not requested.
- vardot/varbase 11.0.1 requires drupal/varbase_ai_base ~1.0.0 -> could not be found in any version, there may be a typo in the package name.
Both paths do it: Plugin::unpackOnCreateProject() queues every recipe in the project, and Unpacker::processPackageDependencies() queues every recipe that a required recipe depends on, recursively. A distribution whose install profile requires recipes gets a broken lock from a plain composer create-project.
Steps to reproduce
- In a project with
drupal/core-recipe-unpack, require an install profile that requires recipe B:composer require fixtures/profile-a - Require recipe A, which also requires recipe B:
composer require fixtures/recipe-a. Recipe B is unpacked along with recipe A and removed fromcomposer.lock. rm -rf vendor && composer installfails with the error above.
Real project: composer create-project drupal/varbase_project:~11.0.0 example, then rm -rf vendor && composer install in it.
Proposed resolution
Before unpacking, keep packed every recipe that a package which stays installed still requires, and the recipes that recipe requires. A kept recipe stays in composer.lock; when it is a dependency of a recipe being unpacked, it is added to the root composer.json, as an ignored recipe already is. composer drupal:recipe-unpack refuses a kept recipe. Two build tests cover composer require and composer create-project, and install the resulting lock on a clean checkout.
Remaining tasks
- Review the MR
User interface changes
None.
Introduced terminology
None.
API changes
None (the plugin classes are @internal).
Data model changes
None.
Release notes snippet
N/A
Issue fork drupal-3639596
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