Problem/Motivation

We need a testing trigger that re-tests a specified environment when any upstream dependency changes, and we should change our build process to ignore core's lock file and instead test with minimum declared dependencies, as well as testing with the maximum dependencies available when they change.

This would allow us to automatically detect issues with upstream dependency minor/patch level updates while also eliminating the need for a lock file in core at all as we could assure end users that the values in the composer.json were tested with core.

Additionally this would allow us to configure our contrib testing to treat drupal core as a dependency and only re-test contrib when upstream core changes, and not simply 'daily', thus saving on many tests when there are lulls in core activity.

Proposed resolution

First: The trigger.

This check would occur if Composer-based dependencies have been changed. How do we determine if they have changed? If the goal is to double-check the version constraints present in the composer.json, then we have to use that. Since core's composer.json merges other composer.json files, we'd have to check the merged files as well.

We shouldn't use the composer.lock file because it could change even if the version constraints do not.

Second: The test.

There are a few different degrees of severity or strictness we can apply here.

One is to simply try to update all the composer dependencies (with --prefer-lowest and without) and allow Composer to present a dependency conflict error as a test build fail. This would be a build step that could easily fit into the existing testbot simpletest build.

Another would be to perform the above update, and then also run some tests to get code execution. Unit test suite only would be reasonable. This would allow for different versions to break the build by being incompatible, even though they don't declare their incompatibility in Composer. Implementing this would be somewhat complex because it would require extra steps that depend on each other. This might mean creating a new build type and allowing the D.O UI to specify it.

A third option would be that our assessment plugin would have a 'build Composer min/max' flag. This would cause the assessment phase to make enough copies of itself in the build to specify composer install, composer update, and composer update --prefer-lowest for each copy, and then run all the tests. This would be set up in the codebase phase when we discover whether composer.json has changed. This would be a little bit of a violation of our isolated plugins rule. The benefit of this would be: Relatively easy to implement, no D.O prefs to set up, and very thorough.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Mixologic created an issue. See original summary.

mile23’s picture

eliminating the need for a lock file in core at all as we could assure end users that the values in the composer.json were tested with core.

I'm not sure that removing the lock file is the greatest idea, but it'd be a great promise to be able to make.

So minimally:

  • Some kind of UI on d.o so maintainers could set it up.
  • (Probably) need another build definition in the testbot.
  • Expand the Composer plugin to allow update and update --prefer-lowest config to pass in.

Additionally this would allow us to configure our contrib testing to treat drupal core as a dependency and only re-test contrib when upstream core changes, and not simply 'daily', thus saving on many tests when there are lulls in core activity.

It seems like that would be possible now, using the commit hash of HEAD.

Also: Since we have the wholesome and delightful subtree split, we could remove drupal/drupal's dependency on wikimedia/composer-merge-plugin and just require drupal/core now. But that change shouldn't come until 8.4.0 is released.

dawehner’s picture

I like that! Would there be a way to ship that as a test inside Drupal itself? I guess this would be potentially easier to deal with?

mile23’s picture

We can't really do it inside Drupal because we shouldn't be calling composer from within a test framework managed by composer. :-)

I made a semi-automatic version of this in travis: https://github.com/paul-m/drupal_dependency_bounds_test

kim.pepper’s picture

How about a composer.lock.min and a composer.lock.yolo which has no version constraints at all?

amateescu’s picture

Big +1 for composer.lock.yolo!

mile23’s picture

composer.lock.yolo would be the same as typing composer update.

kim.pepper’s picture

Sorry was thinking a composer.json that has * for each version constraint.

mile23’s picture

Category: Task » Feature request
Issue summary: View changes

Updated with some plans.

mile23’s picture

OK, so now that we have drupalci.yml files, this can be performed using some container_command and run_test commands, so the plugin part is done, and the strategy part is up to the project maintainer.

What's left is allowing users to specify when this type of test is run, so we don't end up doubling test time for all builds. In #2949207: Put control of the build in the hands of developers we see the concept of 'triggers,' which will eventually allow for project maintainers to say what build processes happen for different types of builds, such as patch vs. RTBC vs. commit.

Example here: #2951843-4: Use drupalci.yml to fail test runs early

Mixologic’s picture

I think pift needs to add a new test type like we have for RTBC retesting that is min/max dependency testing, and enable it for core development only.

Mixologic’s picture

Assigned: Unassigned » Mixologic

Lets re-open this.

1. Need to create a new type of testing trigger in project_issue_file_test that will run `composer update --prefer-lowest` -> how often should this be run?

  • On commit
  • daily
  • weekly
  • Ad hoc
  • whenever cores composer.json changes

We want to run this only when its likely to give us information and fail, but not so often as to introduce additional testing burden. If core goes down the road of introducing simultaneous support for symfony 3 and 4, then we'll definitely need to know if a new feature is added that breaks on symfony 3, which potentially means any commit could introduce a regression. At the same time, I think finding out about those regressions on a daily basis also seems fast enough such that HEAD doesnt get too far away from the devs to be repairable.

As far as what environments to run this in, I think we'd be okay with only the primary mysql 5.7 database, since most of our db handling code isnt determined by our dependencies.

However, the version of php can have a big impact on what gets installed, so perhaps we want one for 7.0/7.1/7.2/7.3 - so, four core tests a day against the minimum versions.

The same goes for the maximum testing, which would be - ignore core's lockfile, and just run composer install (which should get the max versions available). so, about 8 more tests per day, which would let us know if
1. any commits that day broke one of our early deps
2. any commits that day broke on a 'newer' dep.
3. any new releases to deps that day broke our code

This would allow us to eliminate core's lockfile.

However, core's lockfile *is* useful to contrib testing where they don't necessarily want to test against a potentially broken upstream. So perhaps we store a lockfile for contrib that is the last successful max test or something.

So some things that need to happen:

create a job on jenkins to run the regression tests.
Create a ui on core testing to configure the environments for min/max testing, and point it at the proper jenkins job.
update the drupalci policy docs to include this.
Ensure that drupalci has a simple way via the drupalci.yml file to enable min/max testing.

mxr576’s picture

Not sure if anyone else is doing highest-lowest testing with Drupal modules but the fact that Drupal core contains outdated minimum requirements causing some troubles for those who try.

For example:
* https://github.com/Pronovix/devportal-drupal-module/pull/69/commits/20c0... is required because https://github.com/minkphp/Mink/pull/760
* https://github.com/Pronovix/devportal-drupal-module/pull/69/commits/9a5c... why it is needed is described in the commit message

mile23’s picture

We're trying... :-)

The current plan looks like adding this: #3031379: Add a new test type to do real update testing which will eventually allow us to do min/max testing without having to change the testbot or other infrastructure parts.

See also: #2876669: Fix dependency version requirement declarations in components

jibran’s picture