fix: #3639596 Keep a recipe packed when another installed package requires it

Issue: https://www.drupal.org/i/3639596

Unpacking a recipe removes it from composer.lock. When a package that stays installed, such as an install profile, a module or an ignored recipe, still requires that recipe, the lock is left with a requirement it cannot satisfy and composer install fails on a clean checkout.

Before unpacking, UnpackManager::keepRecipesRequiredByOtherPackages() now keeps such a recipe packed, together with the recipes it requires:

  • A kept recipe stays in composer.lock. As 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.
  • Nothing is written when nothing was unpacked.
  • The README lists the new case.

Two new build tests in UnpackRecipeTest, one through composer require and one through create-project, use a new fixtures/profile-a that requires recipe B. Both install the resulting lock on a clean checkout and fail without the fix. On a Varbase 11 project, the fixed plugin keeps all 56 recipes its install profile requires and the lock installs on a clean checkout.

AI-Generated: Yes

Checkpoints:

  • File an issue
  • Addition/Change/Update/Fix
  • Testing to ensure no regression
  • Automated unit testing coverage
  • Automated functional testing coverage
  • UX/UI designer responsibilities
  • Readability
  • Accessibility
  • Performance
  • Security
  • Developer Documentation
  • User Guide Documentation
  • Reviewed by human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Release notes snippet
  • Release

Merge request reports

Loading
Loading