Problem/Motivation

AFAICT we only duplicate all of our default container parameter values from default.services.yml to core.services.yml for KernelTestBase tests.

Why not just let KTB use that YML file, just like WTB already does?

This is very confusing. Not in the least because you have to keep those two places in sync. It's also a WTF, because developers won't know how to interpret these seemingly identical things — I know I don't.

Proposed resolution

Make this more sane :)

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

dawehner’s picture

The reason is that default.services.yml is there is to have a place to document values and what you could change them to, similar to settings.php

core.services.yml is there in order to provide default values

berdir’s picture

Yes, default.services.yml isn't ever used.

services.yml is. Which is copied from default.services.yml at installation time. If a new value is added to default.services.yml and not core.services.yml, then your site would explode with an exception until you copy default.services.yml again, figure out what is new, what are changed defaults and what you changed...

Having it in core.services.yml allows us to introduce new parameters without it being an API change.

dawehner’s picture

KTB does not setup a Drupal site, it just setups a kernel + container so core/lib is the only thing it should care about.

<ad>KTBTNG</ad>

wim leers’s picture

Yet:

  protected function prepareSettings() {
    // Prepare installer settings that are not install_drupal() parameters.
    // Copy and prepare an actual settings.php, so as to resemble a regular
    // installation.
    // Not using File API; a potential error must trigger a PHP warning.
    $directory = DRUPAL_ROOT . '/' . $this->siteDirectory;
    copy(DRUPAL_ROOT . '/sites/default/default.settings.php', $directory . '/settings.php');
    copy(DRUPAL_ROOT . '/sites/default/default.services.yml', $directory . '/services.yml');

Also: if I read "default", then I think it's going to be used. It should be named differently then. By the same reasoning, default.settings.php is also never used.

wim leers’s picture

Title: Remove duplication of container parameters between core.services.yml and default.services.yml » Confusing duplication of container parameters in core.services.yml and default.services.yml
dawehner’s picture

Also: if I read "default", then I think it's going to be used.

Well, this is not something new but rather exists since EVER in Drupal. I think changing this now is wrong.

Its though tricky to document anything inside the default... files because they are copied and so would need to be adapted. Sadly we don't have a docs aware yaml en/decoder, so we would have to deal with some from of string manipulation.

Honestly ideally default.services.yml/default.settings.php should be in /sites instead. This could remove a lot of the confusion, I think.

berdir’s picture

Yes, #4 simulates the installer, which copies that file.

It's not used during *runtime*

fabianx’s picture

Theoretically we could just rely on sites/default.services.yml and load that directly before the site specific sites/default/services.yml.

Then the defaults would indeed be taken into account, but current the default file is not defaults, but sample / example values.

The code internally needs to ensure that the defaults are taken into account.

Changing that would have the consequence of no longer e.g. controlling the session.storage.config parameters via PHP configuration, which currently with an empty default.services.yml would be possible.

For now @Wim the magic word is:

"upgrade path"

e.g. you update from beta13 to beta14 and because you don't have 'smart_cache_options' parameter, which is in sites/default/default.services.yml, but not in core/core.services.yml, your site explodes on next cache rebuild as you cannot build the container _until_ you have manually copied the new value from default.services.yml to services.yml ...

effulgentsia’s picture

I propose that we:

  1. Move the documentation of individual container parameters that's currently in default.services.yml into core.services.yml.
  2. Replace default.services.yml with just documentation that says to look at core.services.yml and module *.services.yml files to find stuff that a site maintainer might want to customize, and then whatever the site maintainer wants to customize, it can paste there (where "there" is the /sites/FOO/services.yml that got made during installation from default.services.yml) and modify as desired.
  3. Open a separate issue to move default.settings.php and default.services.yml from /sites/default to somewhere else, such as /core/install, or wherever it would not be confused with the site's actual settings and services or anything else that affects runtime behavior.
Crell’s picture

Disagree with #9. core.services.yml is massive, and contains dozens of services that 98.4% of developers have no reason to touch, ever, much less when picking up D8 for the first time. The values in default.services.yml are "buttons and dials you're supposed to twiddle", which is a good place for the documentation for them. (You can twiddle various other buttons and dials from core.services.yml or other module services.yml files, but the ones that we specifically expect/want you to twiddle should be called out especially.)

Moving the default/example files to elsewhere is fine; I don't much care there as long as we document it.

effulgentsia’s picture

You can twiddle various other buttons and dials from core.services.yml or other module services.yml files, but the ones that we specifically expect/want you to twiddle should be called out especially.

I don't think HEAD's current default.services.yml is making good choices for what it's exposing from core.services.yml vs. what it's not. I don't think renderer.config is a dial that should be twiddled by any more than 1% of sites. twig.config also seems silly to include in the file that is intended for production settings when all of the options have a warning to not use on production; seems like that should all move to development.services.yml. I can see the logic in having factory.keyvalue in the file as a likely dial to want to twiddle, but I think there's an even greater use-case for twiddling $settings['cache'], which is not in default.settings.php, nor is its D7 equivalent in D7's default.settings.php.

So in its current form, I think default.services.yml doesn't make much sense, but improving it to make better choices in what it exposes would also be a fine way to resolve this issue.

dawehner’s picture

renderer.config is a dial that should be twiddled by any more than 1% of sites.

Come on, this is no different AT ALL to default.settings.php. How many sites will need to change the bootstrap config?

Crell’s picture

Nominally anything in core.services.yml can be overridden by the site's services.yml file. Including everything.

Proposal: Things in the default/example file should be those that we expect/anticipate/want, say, 30%+ of sites to be messing with. Things we expect them to do. Put them there, document them there, but still have a default in core.services.yml to ensure there's always a value no matter what. For the 1% case, leave that in core.services.yml and document THERE what it does. The 1% who care can find it there and figure out what to do.

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.

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.

joachim’s picture

Component: base system » documentation

> The reason is that default.services.yml is there is to have a place to document values and what you could change them to, similar to settings.php

> Yes, default.services.yml isn't ever used.

This and the rest of #2 should be addedf to default.services.yml as documentation.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.