Problem/Motivation

The recent extra work caused by the flurry of security releases in relation to the pinned values of core-recommended.

In some cases the dependency released the fix on a new minor which the users of core-recommended could not update to because of the existing pinned values. See #3600889: Remove some minor constraints from core-recommended for more details on that.

Steps to reproduce

Proposed resolution

Create a separate release process for core-recommended so that the constraints can be adjusted, if needed, when a dependency makes security release.

Remaining tasks

Add the tooling
Review
Commit

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

quietone created an issue. See original summary.

catch’s picture

From #3600889: Remove some minor constraints from core-recommended there are two parts to this:

1. We'll need to set up a release process that separately tags releases of drupal/core-recommended - this would only happen when a dependency tags a security release that is also a new minor release not covered by existing constraints.

2. We need to figure out what to do with version numbers, since we can assume that core-recommended will have every release of core + additional releases for dependency security releases.

There were two ideas for version numbering:

1. Have core-recommended increment the patch number beyond drupal/core, then when we do a core release, skip any intervening numbers so that they match.

e.g.

11.4.0 - core + core-recommended
11.4.1 - core-recommended
11.4.2 - core + core-recommended

2. Use a four digit release number:

11.4.0 - core + core-recommended

11.4.0.0 - core-recommended

11.4.1 - core + core-recommended

@godotislate pointed out that semver doesn't support four digit release numbers. Composer does for bc https://github.com/composer/composer/discussions/11456, but not officially https://getcomposer.org/doc/04-schema.md#version

However, both semver and composer support patch suffixes.

So we might be able to do:

11.4.0 - core + core-recommended

11.4.0-p1 - core-recommended

11.4.1 - core + core-recommended

As long as -p1 is recognised as > 11.4.0 (so that it gets updated to), that seems OK, and would identify it clearly as a 'bonus' core-recommended release.

quietone’s picture

I am not seeing on semver.org that patch suffixes are supported. For semver patch is just a numeric identifier, <patch> ::= <numeric identifier>

catch’s picture

You're right. It allows pre-release (1.0.0-beta1) and build metadata (1.0.0+foo) but not additional -p1.

However if composer officially supports what we want to do, I'd be happy to deviate from semver, because a lot of the problems we'd running into are that semver does not and never has resolved the problems it purports to solve.

drumm’s picture

There’s a possibility this ends in core-recommended ends up as a separate project instead of a subtree split. As long as it’s a subtree split, the same Git tags go everywhere regardless.

A release branch could be made from the last tag, commit only to core-recommended and increment version numbers, to make a release with only substantive changes in core-recommended. Same process as a security release containing only the security fixes. All other subtree splits get new tags, with no substantive changes.

Any tricks with semver features are the same as a regular patch version increment. Either there’s a subtree split and they all get all the tags, or they are independent projects that can have independent version numbers. I don’t think semver has a problem with skipping version numbers, so the rest could skip ahead to stay in sync with a core-recommended that’s gotten ahead.

Packagist.org now has immutable tags https://blog.packagist.com/an-update-on-composer-packagist-supply-chain-...

Stable version immutability on Packagist.org: Tagged versions can no longer be silently rewritten by re-tagging in git repositories.

So I believe any re-tagging would not be possible, regardless of release nodes. The subtree splits are processed and pushed on git push.

benjifisher’s picture

Are we saying that an extra version component after the patch version is OK? If it works, I prefer that to skipping patch versions in the main project. It makes sense to me that drupal/core-recommended:11.4.0.0 is related to drupal/core:11.4.0. And I am sure I have seen other projects use 4-part version strings.

One comment from https://github.com/composer/composer/discussions/11456:

Given that PHP's version_compare does not properly handle version strings with different number of segments, ...

I am not sure what that means. I did a little test with drush php:

Psy Shell v0.12.24 (PHP 8.5.5 — cli) by Justin Hileman
New PHP manual is available (latest: 3.1.1). Update with `doc --update-manual`
Drush Site-Install (Drupal 12.0-dev)
> version_compare ('11.4.0', '11.4.1')

= -1

> version_compare ('11.4.0', '11.4.0.1')

= -1

> version_compare ('11.4.0', '11.4.0.0')

= -1
benjifisher’s picture

@drumm:

Currently, composer.json in drupal/core-recommended is generated by a composer script from composer.lock in the main project. If we move drupal/core-recommended to a separate project, can we still have a process where a script in the main project pushes an update and a new tag to that separate project?

drumm’s picture

can we still have a process where a script in the main project pushes an update and a new tag to that separate project?

Sure, a new CI job can be set up by core’s .gitlab-ci.yml to do this, and be set up with secrets with access to push to the separate project. This is essentially how Drupal CMS monorepo does pushes to its projects.

I don’t think this is something we would want to try setting up in core’s custom subtree splitter, with my current understanding of the problem.

benjifisher’s picture

@drumm:

In that case, I vote for a separate project, updated by a CI job.

We already have

        "post-update-cmd": [
            "Drupal\\Composer\\Composer::generateMetapackages",
            "Drupal\\Composer\\Composer::generateComponentPackages"
        ],

where the two scripts are defined in composer/Composer.php. I am not sure how these fit into the CI pipeline, but drupal/core-recommended is one of the metapackages handled by generateMetapackages().

Perhaps we can add a third post-update-cmd script that checks for changes to composer/Metapackage/CoreRecommended/composer.json and pushes a commit to the appropriate branch on the separate project. Then some automation in that project can create the tag.

catch’s picture

Status: Active » Closed (outdated)

We fixed the immediate issue in #3600889: Remove some minor constraints from core-recommended and are monitoring how that goes. I think it's unlikely we'd try this now so marking outdated.

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.

xjm’s picture