Update manager compatibility logic is missing if you're on a -dev release of core

Created on 12 May 2020, over 4 years ago
Updated 20 February 2024, 10 months ago

Problem/Motivation

Found a bug in the functionality introduced at #3096078: Display core compatibility ranges for available module updates β†’ . If your locally installed version of core is a -dev release, none of the code that displays core compatibility for the contribs installed on your site will fire. That's because of this:

core/modules/update/src/ProjectCoreCompatibility.php

  public function setReleaseMessage(array &$project_data) {
    if (empty($this->possibleCoreUpdateVersions)) {
      return;  // Whoops, shouldn't return here just because there are no available updates for core. :(
    }
    ...
  }

possibleCoreUpdateVersions is populated with this logic:

  protected function getPossibleCoreUpdateVersions(array $core_releases) {
    if (!isset($core_releases[$this->existingCoreVersion])) {
      // If we can't determine the existing version of core then we can't
      // calculate the core compatibility of a given release based on core
      // versions after the existing version.
      return [];
    }
    $core_release_versions = array_keys($core_releases);
    $possible_core_update_versions = Semver::satisfiedBy($core_release_versions, '>= ' . $this->existingCoreVersion);
    $possible_core_update_versions = Semver::sort($possible_core_update_versions);
    $possible_core_update_versions = array_filter($possible_core_update_versions, function ($version) {
      return VersionParser::parseStability($version) === 'stable';
    });
    return $possible_core_update_versions;
  }

If you're using the -dev release of the currently stable core (e.g. 8.8.6-dev at the time of this writing), you end up with an empty array. There are no 'stable' releases that satisfy ">= 8.8.6-dev" right now. Only once 8.9.0 and/or 9.0.0 are out will there be anything else in the $core_release_versions list that satisfies that constraint. With this list empty, none of the rest of the plumbing works.

Proposed resolution

TBD. Something like:

If you're on the end of the stable core branch, use the last stable release from that branch for the compatibility messages (all of which should continue to be visible).

Remaining tasks

  1. Decide exactly what to do.
  2. Do it.
  3. Add/update test coverage.
  4. Reviews.
  5. RTBC.
  6. Commit.

User interface changes

TBD.

API changes

Nothing public.

Data model changes

None.

Release notes snippet

TBD.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
UpdateΒ  β†’

Last updated 5 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @tedbow
  • πŸ‡ΊπŸ‡ΈUnited States @dww
Created by

πŸ‡ΊπŸ‡ΈUnited States dww

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    This came up as a random triage target for #bugsmash. Still a bug. Nothing has changed here. The proposed resolution is still what needs to happen. But thanks, triage "bot", for reminding me this bug exists. πŸ˜‚ Tagging to be smashed, and hopefully someone wants to run with it.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    We could also consider this "works as designed", if you're running a -dev version of core you are on your own anyway and there is no guarantee of an update path (we might have reverted things from the specific version you are using, for example).

Production build 0.71.5 2024