Problem/Motivation

Following #3135247: Composer's "prefer-stable" setting cannot be relied on to produce a stable release and #3179061: Further discuss use of "prefer-stable" and "minimum-stability" in core, we still don't quite have the right tools to make pre-release milestones of our Composer templates behave correctly.

Steps to reproduce

  1. composer create-project drupal/recommended-project:9.1.0-alpha1 d9composer
  2. cd d9composer
  3. composer update

Expected result: Nothing happens, because everything's up to date.
Actual result: Site is downgraded to 9.0.7.

Proposed resolution

Set the each branch's minimun to correspond to the branch itself. Branches may be backwards compatible with old APIs, but they also introduce new APIs, and Drupal database update functionality certainly does not support downgrading sites. The fix is as simple as:

    "require": {
        "composer/installers": "^1.9",
        "drupal/core-composer-scaffold": "^9.1",
        "drupal/core-project-message": "^9.1",
        "drupal/core-recommended": "^9.1"
    },

Remaining tasks

User interface changes

N/A

API changes

Default specify minimum versions corresponding to the core minor version

Data model changes

N/A

Release notes snippet

Drupal core packages now explicitly depend on the current minor branch (for example, ^9.1 instead of ^9, in order to make composer behaviour with pre-releases more predictable.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm created an issue. See original summary.

xjm’s picture

catch’s picture

Status: Needs review » Reviewed & tested by the community

Good plan.

xjm’s picture

Issue summary: View changes

  • catch committed 64db819 on 9.2.x
    Issue #3182959 by xjm: Prevent pre-release milestones from downgrading...

  • catch committed 4e20065 on 9.1.x
    Issue #3182959 by xjm: Prevent pre-release milestones from downgrading...
catch’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 9.2.x and 9.1.x, thanks! Attempted a release notes snippet.

Mixologic’s picture

Nice one.

xjm’s picture

Issue tags: +Needs change record

We probably want a CR here too.

xjm’s picture

Status: Fixed » Needs work
Issue tags: +Needs followup

Oops, we also have a followup to (at least) add this to the branching instructions, and if possible to the branching script.

xjm’s picture

Title: Prevent pre-release milestones from downgrading to earlier releases. » [followup] Prevent pre-release milestones from downgrading to earlier releases.
xjm’s picture

Status: Needs work » Fixed

I updated the branching script: https://github.com/xjm/drupal_core_release/commit/109e84fe6bf6c98cf334e3...

The handbook docs already had instructions to do this for major versions, so I just generalized them to apply to minor versions as well: https://www.drupal.org/node/2699919/revisions/view/12108029/12147727

xjm’s picture

xjm’s picture

Title: [followup] Prevent pre-release milestones from downgrading to earlier releases. » Prevent pre-release milestones from downgrading to earlier releases.

Status: Fixed » Closed (fixed)

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