Problem/Motivation

  • #1977498: Add version tracking for configuration schema and data list some (but probably not all) of the problems with changing a config schema once other modules have come to rely on a particular state/version of it.
  • Fixing that issue (in the sense of adding config schema version tracking into core's APIs) has been postponed to 8.1 or later.
  • That means core will need to be very careful about any config structure changes it needs to make between 8.0.0 and whenever that issue is fixed.
  • But what about contrib? Can a contrib module make changes during its alpha or beta releases, like Drupal core has done many times during its alphas and betas? Can a contrib module make changes between its 8.x-1.x and 8.x-2.x versions? If it does make such changes, what does it need to do and/or what do other modules that provide default config for it, implement potential overrides for it (such as via Domain module), etc. need to do?

Proposed resolution

Discuss. Figure out. Document.

Remaining tasks

See above.

User interface changes

API changes

Data model changes

Comments

catch’s picture

Issue tags: +D8 upgrade path
Gábor Hojtsy’s picture

But what about contrib? Can a contrib module make changes during its alpha or beta releases, like Drupal core has done many times during its alphas and betas? Can a contrib module make changes between its 8.x-1.x and 8.x-2.x versions? If it does make such changes, what does it need to do and/or what do other modules that provide default config for it, implement potential overrides for it (such as via Domain module), etc. need to do?

As per our discussions given that #1977498: Add version tracking for configuration schema and data is not resolved, core and contrib alike should only make additive changes to schema, it should not make backwards incompatible changes in any way whatsoever. Eg. if a views plugin need to make backwards incompatible changes to their settings, they need to modify their plugin_id and add schema under the new plugin_id from then on. If a module needs to change its modulename.settings file in a backwards incompatible compatible way, it will need to change the config name to something else, eg. modulename.configuration or something else. Adding keys and stopping the use of some keys is fine, so if a views plugin needs to use now new keys for its settings and abandon old ones, that is fine too.

This is my understanding basically.

alexpott’s picture

I think we should add documentation once #2521776: Update documentation for hook_update_N() for Drupal 8 lands.

jhodgdon’s picture

It would be good to wait for that one please. :)

effulgentsia’s picture

core and contrib alike should only make additive changes to schema, it should not make backwards incompatible changes in any way whatsoever

I don't think that's a realistic requirement to impose on contrib modules during their pre-alpha and alpha versions, and maybe not even during their beta versions.

Gábor Hojtsy’s picture

@effulgentsia: we both decided to make config schema static, so we can parse it without the presence of the runtime which generated it and to not version schema or config. That means that if we have a copy of schema X and a copy of config Y that should be valid according to schema X, they need to match regardless of what "version" of config Y is that schema for. We only have the keys no versions to contextualize them.

catch’s picture

Does it come down to:

Can a contrib module make changes during its alpha or beta releases, like Drupal core has done many times during its alphas and betas?

Yes with the caveat that sites/modules with a dependency on that module may break if the change is not backwards compatible with existing config.

Can a contrib module make changes between its 8.x-1.x and 8.x-2.x versions?

Only backwards compatible changes.

alexpott’s picture

Now that #2521776: Update documentation for hook_update_N() for Drupal 8 has landed I also think this issue should perhaps give examples of how to do hook_update_N() config changes.

jhodgdon’s picture

That sounds like a good idea.

So we have several places that some of the documentation for this issue can go:

a) There's a new "Update API" topic on api.drupal.org:
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module....

b) It's kind of an abbreviated version of the d.o documentation:
https://www.drupal.org/developing/api/8/update
which has several child pages and gives several examples.

c) Then there's the documentation for hook_update_N() itself:
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module....
(and some other update-related hooks and classes that are listed on the Update API api.d.o topic page). This page has a function body with a couple of simple examples.

So can we get an actionable list of what we actually need to document that's missing, and where the docs for each should go (some of which in more than one place I'd imagine -- everything should get onto the d.o docs, and most should go somewhere in the API docs as well I would think)? So far I think it is a bit nebulous.

And regarding the discussion from the past few comments... It seems like both Core and Contrib can make config changes that are not backwards compatible *if they supply an update function* that converts the config, right? There would still possibly be problems if another module was depending on the config structure, but that is always the case for any kind of API or data model change. I don't see how config is much different from that... It seems like if a module makes an API or data model change of any sort, and something's depending on it being the way it was, that's going to break. So if they go from the 8.x-1.x to 8.x-2.x version they can make those changes (with update functions) to allow dependent modules time to catch up to be compatible with the new way of doing things.

Right?

Anyway, so far I'm not seeing anything new in this issue that needs documenting that is not in the existing docs, but let's discuss!

catch’s picture

It seems like both Core and Contrib can make config changes that are not backwards compatible *if they supply an update function* that converts the config, right?

Not quite, exported config will also break. For default config in a module or install profile, we can say that's 'code' and the same as another API change.

However we also export config for deployment, and there are situations that could break too - i.e. export config from staging, update contrib module on both staging and production, try to import config to production - it'd break because the config was exported before the update ran.

The other thing that can break is that config overrides also get stored, and we have no way to update the overrides to point to the new schema. So for example, renaming a config key that was being tweaked per-domain the overrides would just get lost, same with translations.

jhodgdon’s picture

OK, then what do we want to say, that you can never make these changes, or that if you do, you'd better put something in your release notes?

Gábor Hojtsy’s picture

It seems like both Core and Contrib can make config changes that are not backwards compatible *if they supply an update function* that converts the config, right?

One more point that @catch did not mention, we did not version neither schema nor config, and we designed them so schema is used to parse config independent of the runtime site (eg. on localize.drupal.org). Due to the combination of these, if there is not a 1-1 relationship between config and schema (ie. there are incompatible schemas for the same config), we could not tell which one to use (due to lack of versioning). This was deemed acceptable because people are supposed to only make backwards incompatible changes and they can just make up new config keys and plugin IDs if they need/want for backwards incompatible changes.

Gábor Hojtsy’s picture

OK, then what do we want to say, that you can never make these changes, or that if you do, you'd better put something in your release notes?

The release notes will not help with static code analysis incompatibility.

jhodgdon’s picture

No, plus no one ever reads release notes.

So, I have no idea what we would to say here. I mean, contrib maintainers hopefully know in general that changing their API or data model can be problematic if any other module depends on their module, which they have little control over. I don't know that we need to make a bigger deal out of documenting this for Config than for any other API or data model changes -- the issues are pretty much the same.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Updating tag.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.