Problem/Motivation

Drupal\Tests\Composer\Generator\BuilderTest fails on the new 12.0.x branch:

https://git.drupalcode.org/project/drupal/-/jobs/12408941

     ✘ Builder with data set 0
       ┐
       ├ Failed asserting that two arrays are equal.
       ┊ ---·Expected
       ┊ +++·Actual
       ┊ @@ @@
       ┊      'conflict' => [...]
       ┊      'extra' => Array (
       ┊          'branch-alias' => Array (
       ┊ -············'dev-main'·=>·'12.x-dev'
       ┊ +············'dev-main'·=>·'12.0.x-dev'
       ┊          )
       ┊      )
       ┊  )
       │
       │ /builds/core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php:81
       ┴

This is because Composer::drupalVersionBranch() returns the wrong thing now we opened 12.0.x.

Steps to reproduce

Proposed resolution

Either: remove the branch aliases from 12.0.x (they only need to be in main anyway) with the downside that we have to do this again when we open 13.0.x from main

Or: fix BuilderTest and related code so it sets the branch alias correctly in all cases

I lean towards the latter as it will be less work and less remembering how to fix it when we run into this again in two years time with the former solution.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3625553

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

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review

This was out of sync across all branches. This should solve it so all branches stay up to date. Before we open 13.0.x, we will change VERSION to 13.x-dev and the branch-alias to 13.x and the test will continue to pass. When we then branch 13.0.x, the test will still continue to pass.

amitgoyal’s picture

Status: Needs review » Reviewed & tested by the community

All 4 branch MRs pass locally (BuilderTest 3/3, PHPCS clean on changed source files).

CI is green on main/12.0.x/11.x. The 11.4.x pipeline shows a failure in default_admin's AdminNodeTest, but this is a pre-existing unrelated flake, not caused by this patch: the same failure reproduces on unmodified 11.4.x nightly pipelines (e.g. #973787, #974396) unrelated to the branch-alias/BuilderTest changes here.

godotislate’s picture

Test failure on 11.4.x comes from #3618586: default_admin loses the footer group on forms that set #tree, silently unpublishing entities on save. I think we can just fix that by adding #[IgnoreDeprecations] to Drupal\Tests\default_admin\Functional\AdminNodeTest. Will comment in that issue.

longwave’s picture

Title: Fix BuilderTest on 12.0.x » Use MAJOR.x-dev for generated dev-main aliases so release branches don't break BuilderTest

Hopefully the title makes sense.

The metapackage builders now always generate the dev-main branch alias as MAJOR.x-dev (for example 12.x-dev), instead of the minor branch such as 12.0.x-dev. On main, this alias is what lets Composer treat the branch as 12.x-dev. Without it, constraints such as drupal/core: 12.x-dev could not resolve to main. On release branches the alias has no effect, because Composer applies a dev-main alias only to the main branch. Generating the same value everywhere means that cutting a new release branch no longer changes the metapackages or breaks BuilderTest.

Technically we don't need to backport this to 11.x or 11.4.x but to me it makes sense to put everything in sync once and be done.

  • godotislate committed 943691da on main
    fix: #3625553 Use MAJOR.x-dev for generated dev-main aliases so release...

  • godotislate committed 4a5a3267 on 12.0.x
    fix: #3625553 Use MAJOR.x-dev for generated dev-main aliases so release...

  • godotislate committed c1a5b77f on 11.x
    fix: #3625553 Use MAJOR.x-dev for generated dev-main aliases so release...

  • godotislate committed 39ad57a7 on 11.4.x
    fix: #3625553 Use MAJOR.x-dev for generated dev-main aliases so release...
godotislate’s picture

Version: 12.0.x-dev » 11.4.x-dev
Status: Reviewed & tested by the community » Fixed

I observed something similar opening the 11.4.x branch.

This should hopefully resolve this going forward for minors and for majors as long as we remember to increment the version before creating the new major branch.

Committed to main, 12.0.x, 11.x, and 11.4.x.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.