Problem/Motivation

Currently, some of core's require-dev constraints constrain those packages to non-latest major versions. This prevents an application from installing both drupal/core-dev and other packages that might require later versions of the same dependencies. For example, core currently constrains symfony/filesystem to ^4.4, but Drush would like to be able to use symfony/filesystem v5 (see https://github.com/drush-ops/drush/pull/5264 which broke compatibility with drupal/core-dev and is about to be reverted until this issue is fixed).

Steps to reproduce

Proposed resolution

Broaden our require-dev constraints (e.g., change the symfony/filesystem one to ^4.4 || ^5.4 or maybe even ^4.4 || ^5.4 || ^6.1) where doing so still passes all of our tests (on the "updated deps" DrupalCI job).

CommentFileSizeAuthor
#11 3315217-11.patch3.13 KBeffulgentsia

Issue fork drupal-3315217

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

mikemadison’s picture

Status: Active » Needs review
gábor hojtsy’s picture

Sent for a retest as the fails seems to be unrelated JS fails.

Also as we verbally discussed Drupal 9.5 is also affected. I find it strange that Drush 11 would not be compatibe anymore with Drupal 9 as per https://www.drush.org/latest/install/ that is the ONLY version of Drush that is even supposed to be compatible with Drupal 9 at this point. So I think this is a drush bug?

mikemadison’s picture

I've cross posted the issue on Github for the drush team as well, https://github.com/drush-ops/drush/issues/5277

moshe weitzman’s picture

@Gabor Drush is compatible with drupal/core:9. We have many many tests that confirm that. It is the variant drupal/core-dev that is the issue. It would be better to adjust Drupal as the patch here proposes, but I'm adjusting Drush now to stop inconvenience for core-dev users.

gábor hojtsy’s picture

Is it possible to set up Drush testing for core-dev as well?

effulgentsia’s picture

Title: Core's require-dev incompatible with drush 11.x-dev » Loosen core's require-dev constraints to allow higher major versions that work
Version: 9.4.x-dev » 9.5.x-dev
Category: Bug report » Feature request
Issue summary: View changes
Status: Needs review » Needs work

Given #6, I'm recategorizing this as a feature request. I'm +1 to the feature request, and not just for symfony/filesystem, so retitling to be broader.

Since #3225966-46: Consider loosening our constraint to allow sites to install Guzzle 6 or 7, or otherwise handle PHP 8.1 deprecations for Guzzle 6, we already have the DrupalCI jobs running that would ensure we're testing both the composer.lock version and the maximum allowed, so I don't see much, if any, downside to a more permissive range.

alexpott’s picture

One thing that this makes a bit trickier is updating dependencies. What should we be keeping them on? The highest possible minor and bug in lowest possible possible major I think. Composer doesn't make this that simple - it's better now because the --with option will allow us to do this but it's still not that simple - we might need to add our own composer command to do this reliably for us.

alexpott’s picture

#9 should have also said that I'm +1 to relaxing our constraints to be compatible with as many versions as possible.

effulgentsia’s picture

Status: Needs work » Needs review
StatusFileSize
new3.13 KB

Good point on #9. In addition to a composer command that facilitates the update, we can also add a precommit check that ensures that the lock file is pinned to the lowest allowed major.

This patch does not add either. All it does is relax all the require-dev constraints in order to see if tests pass.

effulgentsia’s picture

Status: Needs review » Needs work

Cool that tests passed! However, the update wasn't able to get to the latest major versions. According to https://dispatcher.drupalci.org/job/drupal_patches/152736/consoleFull, at 8:28:15:

  • symfony/phpunit-bridge was updated to 6.1.
  • symfony/browser-kit, symfony/css-selector, symfony/dom-crawler, symfony/filesystem, symfony/finder, and symfony/lock were all updated from 4.4 to 5.4, but not to 6.1.
  • symfony/var-dumper was already constrained to a minimum of 5.4, and was not updated to 6.1.
  • symfony/error-handler stayed on 4.4.
  • phpspec/prophecy stayed on 1.12.

So other constraints prevented these from upgrading to their latest majors. That might be okay, but it's something to keep in mind when reading the composer.json changes and remembering that the "updated deps" test isn't necessarily able to update to the highest listed majors, and is therefore not testing them.

Meanwhile, Needs work for #9.

effulgentsia’s picture

So other constraints prevented these from upgrading to their latest majors.

That other constraint is the config.platform.php setting in Drupal's root composer.json. Since that's an artifact of drupal/drupal and not of what Drupal applications (e.g., ones installed from drupal/recommended-project) would have, I opened #3316100: Unset the config.platform.php constraint from DrupalCI's "updated deps" jobs.

ioanmar’s picture

The patch didn't apply to my 9.5.2 build, but I was able to resolve the dependency issue.

Running composer require drupal/core-dev:9.5.2 --dev --update-with-all-dependencies returned

Using version ^10.0 for drupal/core-dev
./composer.json has been updated
Running composer update drupal/core-dev --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/core-dev 9.5.2 -> satisfiable by drupal/core-dev[9.5.2].
    - drupal/core-dev 9.5.2 requires symfony/filesystem ^4.4 -> found symfony/filesystem[v4.4.0, ..., v4.4.42] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
composer [require drupal/core-dev:9.5.2 --dev --update-with-all-dependencies] failed, composer command failed: exit status 2. stderr=

While researching online, I stumbled upon this comment and I tried to first uninstall drush, then install version 9.5.2 of drupal/core-dev (10 not an option, composer still complains) and finally reinstall drush/drush. This worked!

composer remove drush/drush
composer require drupal/core-dev:9.5.2 --dev --update-with-all-dependencies
composer require drush/drush

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.