Composer tests fail because of invalid Drupal version

Created on 4 May 2024, 7 months ago
Updated 23 May 2024, 6 months ago

Problem/Motivation

The VERSION constant in Drupal.php was changed from 11.0-dev to 11.0.0-dev. This breaks Drupal\Tests\Composer\Generator\MetapackageUpdateTest and Drupal\BuildTests\Composer\Component\ComponentsIsolatedBuildTest.

Steps to reproduce

Proposed resolution

Revert the change to the VERSION constant.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

N/A

๐Ÿ› Bug report
Status

Fixed

Version

11.0 ๐Ÿ”ฅ

Component
Baseย  โ†’

Last updated about 4 hours ago

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States benjifisher Boston area

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @benjifisher
  • Merge request !7909Restore the VERSION constant to 11.0-dev โ†’ (Closed) created by benjifisher
  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States benjifisher Boston area
  • Pipeline finished with Success
    7 months ago
    Total: 793s
    #163970
  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany tobiasb Berlin

    Right fix for branch 11.x.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany tobiasb Berlin

    In case 11.x should reflect the latest minor version, then bug was fixed via ๐Ÿ› Update composer metapackages Active .

  • ๐Ÿ‡ญ๐Ÿ‡บHungary Gรกbor Hojtsy Hungary

    What fails currently without this?

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany tobiasb Berlin

    At the moment nothing. The question is, is the branch 11.x === 11.0.x, then later 11.1.x ....Like a branch alias. (I would say yes) Then the MR/Issue can be closed. Or should the branch and \Drupal::Version in branch 11.x be unique?

  • ๐Ÿ‡ญ๐Ÿ‡บHungary Gรกbor Hojtsy Hungary

    The 11.x branch is "main", so its the latest dev version. 11.2.x will be branched from there, etc. See https://www.drupal.org/about/core/blog/new-drupal-core-branching-scheme-... โ†’

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    I've run both tests locally on 11.x and 11.0.x and they are passing. @benjifisher how and where are they failing?

    Given that the version in 10.3.x is const VERSION = '10.3.0-dev'; I think this should be fine.

    Making this a normal as we're not seeing fails in the pipelines due to this and setting to needs work to get more info from @benjifisher

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    Is this a dupe of ๐Ÿ› Update composer metapackages Active ?

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany tobiasb Berlin

    @alexpott The issue was created before the fix of ๐Ÿ› Update composer metapackages Active was commited.

    And because 11.x is a "main" branch, is \Drupal::Version 11.0.0-dev correct with the combination of the fix ๐Ÿ› Update composer metapackages Active .

    So we can closed the MR/Issue, but we can still wait until @benjifisher say the same.

  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States benjifisher Boston area

    Short version: I think we can close this issue as a duplicate of ๐Ÿ› Update composer metapackages Active .

    The only thing I still question is why the failing tests did not show up in automated tests when 8ddf9986e0 was committed. There was a failure on a MR I added to the private fork used by the security team.

    From #6:

    What fails currently without this?

    In the issue summary, I mentioned two tests.

    Details:

    At the time I created this issue, the HEAD of the 11.x branch was 8ddf9986e0. The commit for #3445224 is d7235bfe2f.

    $ git log -1
    commit 8ddf9986e0ab6f59d8b77d7545a629f104d6b5fe (HEAD -> 11.x, drupal-3445211/11.x)
    Author: catch <catch@35733.no-reply.drupal.org>
    Date:   Fri May 3 22:08:05 2024 +0100
    
        Back to dev.
    $ ddev exec phpunit -c core core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php
    PHPUnit 9.6.19 by Sebastian Bergmann and contributors.
    
    Testing Drupal\Tests\Composer\Generator\MetapackageUpdateTest
    F.F                                                                 3 / 3 (100%)
    
    Time: 00:00.026, Memory: 6.00 MB
    
    There were 2 failures:
    
    1) Drupal\Tests\Composer\Generator\MetapackageUpdateTest::testUpdated with data set #0 ('Drupal\Composer\Generator\Bui...uilder', 'composer/Metapackage/CoreRecommended')
    The rebuilt version of composer/Metapackage/CoreRecommended does not match what is in the source tree.
    
    To fix, run:
    
        COMPOSER_ROOT_VERSION=11.0.x-dev composer update --lock
    
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
             "webflo/drupal-core-strict": "*"\n
         },\n
         "require": {\n
    -        "drupal/core": "11.0.x-dev",\n
    +        "drupal/core": "11.x-dev",\n
             "asm89/stack-cors": "~v2.2.0",\n
             "composer/semver": "~3.4.0",\n
             "doctrine/annotations": "~2.0.1",\n
    
    /var/www/html/vendor/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqual.php:95
    /var/www/html/core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php:84
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
    /var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651
    /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:146
    /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:99
    
    2) Drupal\Tests\Composer\Generator\MetapackageUpdateTest::testUpdated with data set #2 ('Drupal\Composer\Generator\Bui...uilder', 'composer/Metapackage/PinnedDe...encies')
    The rebuilt version of composer/Metapackage/PinnedDevDependencies does not match what is in the source tree.
    
    To fix, run:
    
        COMPOSER_ROOT_VERSION=11.0.x-dev composer update --lock
    
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
             "webflo/drupal-core-require-dev": "*"\n
         },\n
         "require": {\n
    -        "drupal/core": "11.0.x-dev",\n
    +        "drupal/core": "11.x-dev",\n
             "behat/mink": "v1.11.0",\n
             "behat/mink-browserkit-driver": "v2.2.0",\n
             "colinodell/psr-testlogger": "v1.3.0",\n
    
    /var/www/html/vendor/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqual.php:95
    /var/www/html/core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php:84
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
    /var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651
    /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:146
    /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:99
    
    FAILURES!
    Tests: 3, Assertions: 3, Failures: 2.
    Failed to execute command phpunit -c core core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php: exit status 1
    

    After checking out the later commit,

    $ git log -1
    commit d7235bfe2f5fb0432aa931d620c09cea2b246e3f (HEAD)
    Author: catch <catch@35733.no-reply.drupal.org>
    Date:   Sat May 4 11:03:00 2024 +0100
    
        Issue #3445224 by catch, Gรกbor Hojtsy: Update composer metapackages
    $ ddev exec phpunit -c core core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php
    PHPUnit 9.6.19 by Sebastian Bergmann and contributors.
    
    Testing Drupal\Tests\Composer\Generator\MetapackageUpdateTest
    ...                                                                 3 / 3 (100%)
    
    Time: 00:00.021, Memory: 6.00 MB
    
    OK (3 tests, 3 assertions)
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States benjifisher Boston area

    P.S. Thanks for linking to ๐Ÿ› Update composer metapackages Active , @tobiasb

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    The only thing I still question is why the failing tests did not show up in automated tests when 8ddf9986e0 was committed.

    That not sure but do we think a follow up should be made to extend test coverage? Will leave open for a bit longer.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States drumm NY, US

    This looks like it is currently affecting packaging doing subtree splitting for 11.x as well:

    13:40:29  > /usr/bin/php7.3 /usr/local/bin/composer --working-dir=/var/lib/subtree-splits/drupal/11.x/0894355a79949464fdfa181c0c89597f24498368/subtree-workdirs/recommended-project -n --update-no-dev require drupal/core-composer-scaffold:11.x-dev drupal/core-project-message:11.x-dev drupal/core-recommended:11.x-dev
    13:40:29  ./composer.json has been updated
    13:40:29  Running composer update drupal/core-composer-scaffold drupal/core-project-message drupal/core-recommended
    13:40:29  Loading composer repositories with package information
    13:40:36  Updating dependencies
    13:40:36  Your requirements could not be resolved to an installable set of packages.
    13:40:36  
    13:40:36    Problem 1
    13:40:36      - Root composer.json requires drupal/core-recommended 11.x-dev -> satisfiable by drupal/core-recommended[11.x-dev].
    13:40:36      - drupal/core-recommended 11.x-dev requires drupal/core 11.0.x-dev -> satisfiable by drupal/core[11.0.x-dev] from composer repo (https://repo.packagist.org) but drupal/core[11.x-dev] from path repo (/var/lib/subtree-splits/drupal/11.x/0894355a79949464fdfa181c0c89597f24498368/subtree-workdirs/core) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
    13:40:36  
    13:40:36  Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
    13:40:36  
    13:40:36  Installation failed, reverting ./composer.json to its original content.
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    I think #15 is the opposite of what was fixed in ๐Ÿ› Update composer metapackages Active ... hmmmm

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States drumm NY, US
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States drumm NY, US

    The subtree split issue is not a symptom of #3445259: Update core subtree splitter to handle major.x & main branches โ†’ . That concerns tagging, but this is happening for branch commits.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States drumm NY, US

    I think https://git.drupalcode.org/project/drupal/-/commit/d7235bfe2f5fb0432aa93... should be reverted for 11.x, and kept in for 11.0.x.

    I can test this on staging if needed. That will be somewhat easier next week when staging has reset to a fresh copy of production

  • Status changed to Fixed 7 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    Pretty sure we should have done this instead of ๐Ÿ› Update composer metapackages Active so I've reverted that commit and going to go ahead here.

    Committed/pushed to 11.x, thanks!

    • catch โ†’ committed 34d2ed5a on 11.x
      Issue #3445211 by benjifisher, tobiasb: Composer tests fail because of...
    • catch โ†’ committed 6e22a9d3 on 11.x
      Revert "Issue #3445211 by benjifisher, tobiasb: Composer tests fail...
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    catch โ†’ changed the visibility of the branch 3445211-fix-drupal-version-constant to active.

  • Pipeline finished with Failed
    7 months ago
    #168503
  • First commit to issue fork.
  • Pipeline finished with Canceled
    7 months ago
    #168518
  • Pipeline finished with Success
    7 months ago
    Total: 587s
    #168523
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch
  • Merge request !8000Change version constant back to 11.0-dev โ†’ (Open) created by catch
  • Pipeline finished with Failed
    7 months ago
    Total: 727s
    #168574
  • Pipeline finished with Success
    7 months ago
    Total: 646s
    #168645
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

    Not entirely sure why this has started failing now, but the root cause is that drupal-11.0-dev.es.po ends up as a local translation which was then failed to be parsed by _install_get_version_info() because there is no patch component in the version number.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

    longwave โ†’ changed the visibility of the branch 3445211-fix-drupal-version-constant to hidden.

    • catch โ†’ committed 6293c8e0 on 11.x
      Issue #3445211 by catch, longwave, benjifisher, drumm, tobiasb: Composer...
  • Status changed to Fixed 7 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    Committed/pushed (from needs review again...) to hopefully get tests back to green. Very nice find and fix for what looked like bizarre test failures, good to know it's just yet another variation of dealing with funny branch names and not anything more tricky.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    Note that the Performance Test is throwing deprecations, even if the setup is such that the test job does not fail. That's because the deprecation handler that replaced Symfony's in PHPUnit 10 is stricter with deprecations thrown by the DebugClassloader. In this case it's the OpenTelemetry classes that are not typehinted.

    PHPUnit 10.5.20 by Sebastian Bergmann and contributors.
    
    Runtime:       PHP 8.3.6
    Configuration: /builds/project/drupal/core/phpunit.xml.dist
    
    DDDDDDDD                                                            8 / 8 (100%)
    
    HTML output was generated, 49 page(s).
    
    Time: 12:00.036, Memory: 186.00 MB
    
    8 tests triggered 8 deprecations:
    
    1) /builds/project/drupal/vendor/symfony/error-handler/DebugClassLoader.php:341
    Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "OpenTelemetry\SDK\Common\Attribute\AttributesBuilder" now to avoid errors or add an explicit @return annotation to suppress this message.
    Triggered by:
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryAuthenticatedPerformanceTest::testFrontPageAuthenticatedWarmCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php:32
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageColdCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php:26
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageCoolCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php:79
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageHotCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php:43
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageColdCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php:26
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageCoolCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php:67
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageHotCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php:43
    * Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageWarmCache
      /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php:85
    2) ....

    In this case if this were a test run via run-tests.sh, it would fail. But here it's run via PHPUnit CLI without the --fail-on-deprecation command line argument, so deprecations are displayed but do not lead to test failure. If desirable, the indirect deprecation can be silenced like in https://git.drupalcode.org/project/drupal/-/blob/11.x/core/.deprecation-...

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    I think this would be worth silencing, but we should probably also open an upstream issue against OpenTelemetry PHP to add the return type hints.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024