This issue proposes a new guideline for contributed projects, not Drupal core.

Problem/Motivation

The Managing branches and releases docs covering semantic versioning in contributed projects should be reviewed and revised in order to realign Drupal's definition of PATCH-level releases with official SemVer guidance.

The current guidance states that adding support for a new Drupal core major version is done in a PATCH-level release. The practical implications of this conflict with SemVer:

MINOR version when you add functionality in a backward compatible manner
PATCH version when you make backward compatible bug fixes

This is because the drupal.org guidance implicitly asserts that adding forward compatibility is a "bug fix," even though it could easily be argued to "add functionality" instead and therefore merit a MINOR release.

If forward compatibility refactoring is instead defined as a minor-level change, no new friction would be introduced when it comes to reconciling module versions with new Drupal majors in Composer.

Background

In Issue #3357742 guidelines for semantic versioning in contributed projects were drafted which introduce rules for how specific release versions should relate to Drupal core compatibility.

The issue referenced a blog post which made the following claim:

Patch versions

Adding support for new Drupal core majors! Technically it's a bug fix, when you use add backward compatibility (which you should be!)

The blog offered no source or specific argument for why adding support for a new Drupal core major version is "technically a bug fix" that belongs in a patch release rather than a new feature that would belong in a minor release.

At the time the guidelines were being considered, automated Drupal 11 compatibility issues were getting filed en masse, and Drupal 10 compatibility work was fresh in mind. For the most part, modules did not require much in the way of code updates in order to become Drupal 10 or 11 compatible.

Drupal 12 compatibility fixes, however, are proving to be more complex than what came before. Procedural hooks need to be migrated to object-oriented hooks. You need to register a new service for these hooks and annotate LegacyHooks for D11+. These fixes are intended to be backward compatible and non-breaking, which means they certainly do not belong in a major release, but whether they should be in a patch or minor release still needs further discussion and consensus.

The original motivation behind drafting the new guidance focused on restricting modules from dropping EOL Drupal majors in a patch release, or neglecting a backward-compatibility bridge when dropping support for a supported Drupal major. The decision to define forward-compatibility as a patch-level change did not appear to be specifically discussed.

Refer to latest discussions in #3357742 for additional arguments.

Proposed resolution

Update the guidance to redefine forward-compatibility refactoring as a minor-level change. Implementing forward compatibility in a way that does not require substantial code updates may be patch-level instead, especially if a necessary refactor was already implemented in a previous minor version release.

Also update the guidance to reiterate and reinforce the requirement for a module to support two major Drupal versions and specifically state how that is to be done when a module decides to drop support in a major release.

Proposed revisions; changes are emphasized:

Major version

  • Dropping compatibility for a currently supported version of Drupal core
    • Support may only be dropped in the stable release of a new major module version if a previous module major already provides forward compatibility.
    • Support for the previous module major must continue until either the new major provides backward compatibility or until the dropped Drupal version is End-of-Life.
  • remaining two bullets remain unchanged

Minor version

  • Dropping compatibility with an unsupported version of Drupal core
  • Refactoring module code to support a new Drupal major while retaining backward compatibility for all previously supported versions
    • The minor release may formally begin support for the new Drupal major concurrently, or defer formal support to a future patch release.

Patch version

  • Adding compatibility with Introducing formal support for a new Drupal core major version while maintaining backward compatibility for all previously supported versions
    • Only when module code otherwise remains substantially unchanged, such as when refactoring was already done in a previous minor release. Forward compatibility refactoring requires a new minor version instead.
  • Removing a vestigial backward compatibility layer for a Drupal major whose module support had already been dropped in a previous major or minor release.

Remaining tasks

Discuss the proposal and come to a consensus.

Should the guidance actually change, promulgate the new standard.

Comments

caesius created an issue. See original summary.

caesius’s picture

Issue summary: View changes

If needed, I can provide specific examples where an attempt to implement Drupal 12 compatibility fixes inadvertently resulted in a broken patch release for a module on Drupal 10, but I don't believe that "modules sometimes accidentally ship broken" is critical to the larger point of asking "what actually constitutes a 'bug fix'?"

caesius’s picture

Issue summary: View changes
caesius’s picture

Issue summary: View changes
caesius’s picture

Issue summary: View changes
caesius’s picture

Issue summary: View changes
caesius’s picture

Issue summary: View changes
caesius’s picture

Issue summary: View changes
caesius’s picture

Status: Active » Needs review
caesius’s picture

Regarding the forward-compatibility bugfix vs. new feature distinction, I could see an argument for considering it a "bugfix" if the forward compatibility is added for a version of Drupal that has actually been released.

Drupal 12 isn't even out yet, so categorizing noncompatibility with D12 as a "bug" makes no sense.

berdir’s picture

I'm not sure why this or the referenced issue are core issues. I don't really think that core decides how contrib modules should use semver, that's more a drupal.org policy/documentation issue.

I'm not sure I understand entirely what problem this attempts to fix but I also wasn't involved in the previous issue.

One important thing to keep in mind is that for legacy versioning, which many modules are still using is that every release is a minor release, there are no patch releases.

A second thing is that drupal.org processes make minor releases somewhat tedious, because every minor release on projects with semver is it's own release series, which it's own supported status and as a maintainer, you have either end up with many supported minor versions (and then being required to do security releases for all of them) or dropping support early, which will result in update.module going red on all sites which still use previous minor releases. I fully agree that in practice, the majority of patch releases of contrib projects should be minor, not patch, only a relatively small part of those are specifically related to core compatibility changes, but I think the way to achieve that isn't guidelines/rules, but making it easier to do that and it will happen automatically. There's an infrastructure issue about that somewhere.

And last, a technically...

> use LegacyHook for D10 backward compatibility

LegacyHook is not for Drupal 10. Drupal 10 doesn't know anything about that. It's to tell Drupal *11* that these legacy hooks have been converted and must be ignored.

caesius’s picture

Issue summary: View changes
caesius’s picture

Thanks for the correction, updated.

I filed this to core because that's where the referenced issue lived; if there's a better place for this issue then feel free to move it, however at some point the referenced issue moved from the deprecated "Drupal core ideas" project, so maybe drupal.org guidance doesn't really have a place for issues to live anymore?

The referenced issue and blog post tries to fix a different problem (contrib modules dropping support in the same major that they introduce forward compatibility) -- but in the process introduces a new problem where drupal.org's definition of a "patch" release differs from SemVer.

If you believe that contrib modules releasing new versions as "patches" rather than properly as "minor" releases is a widespread problem that goes well beyond just forward compatibility refactoring, then I'm certainly inclined to agree, but I was trying to keep this issue scoped to a demonstrable deviation in d.o guidance from SemVer rather than generally paint contrib as inconsistent with minor vs patch versioning.

Regarding update.module going red when support is dropped, our company solves that by ensuring that it's not enabled on production environments. Content managers should not be seeing that banner anyway so that could also be a permissions issue.

If you find that issue you mentioned then feel free to add it as a related issue, then we can see where there's overlap.

ghost of drupal past’s picture

Support may only be dropped...

Support for the previous module major must continue

Where can I send the invoice for these things? Must??

caesius’s picture

The linked doc says the following:

Therefore, contributed projects should also support more than one major core version.

You should already be supporting 2 core versions in your module, and if you drop a supported version in a major release then you should continue to support the previous major, otherwise every D10 site that uses your module will get an "unsupported project" warning (as berdir mentioned).

I realize I changed "should" to "must" but I don't believe that a brand-new stable module release necessarily needs to support the previous major, especially late in its lifecycle. However if a stable version of your module is already in use on the previous Drupal core version then you really shouldn't be free to drop support for it, especially if your module receives security coverage.

If you have trouble offering support for both Drupal versions then you can certainly open your project up to receive volunteer support from additional co-maintainers.

caesius’s picture

It looks like the security release policy doesn't actually state that a module needs to maintain support for a Drupal core major version throughout its lifecycle. Therefore, a module that opts into security coverage could release a new major version for Drupal 11 only and drop the previous major version, leaving Drupal 10 sites with that module in an unsupported state with no way to resolve it other than updating to D11 prior to D10 EOL.

Maybe that's made explicit in some other doc, but the linked guidance also using "should" seems to imply that supporting both Drupal 10 and 11 is a suggestion, not a requirement, even when opted into security coverage.