Problem/Motivation

NodeTypeForm allows you to change the label of the title field. There is no test for this functionality, but in Group I copied the code almost verbatim and I did write a test for this. Now this test started failing as of Drupal 11.3.0

See test here: https://git.drupalcode.org/project/group/-/blob/4.0.x/tests/src/Function...

See failure here: https://git.drupalcode.org/project/group/-/jobs/7381790/viewer#L304, that failure does not occur on other core branches.

If I change the test to add $this->entityFieldManager->clearCachedFieldDefinitions();, it goes green again. After some digging I found that the entity field manager's caches are now warm when the test starts running, meaning the changes we make on submit in NodeTypeForm are not recognized by the test unless we use RefreshVariablesTrait or manualy flush caches: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/node/...

Steps to reproduce

View test in MRs and see that it didn't use to break and now it does. This because of warm caches at test start.

Proposed resolution

  • Figure out what changed to always make these caches warm
  • Add a test for NodeTypeForm to demonstrate the behavior

Remaining tasks

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

Release notes snippet

Issue fork drupal-3559201

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kristiaanvandeneynde created an issue. See original summary.

kristiaanvandeneynde’s picture

Title: Entit field manager cache is no longer cleared when a base field is updated » Entity field manager cache is no longer cleared when a base field is updated
Issue summary: View changes
kristiaanvandeneynde’s picture

I just realized there may be something that now loads the entity field definitions on any page, thus warming the cache, and then our request to the form will not affect the cache on the test instance. That's what we have RefreshVariablesTrait for.

So now the question is, if that's the case, what made us load the field definitions on any request?

kristiaanvandeneynde’s picture

We can probably also fix the test by visiting the node form before and after changing the label field and seeing if that went through. But the fact that, from 11.2.x to 11.3.x, suddenly the entity field manager's caches are warm on any given test run concerns me.

kristiaanvandeneynde’s picture

Title: Entity field manager cache is no longer cleared when a base field is updated » Entity field manager cache seems to get warmed on any request
kristiaanvandeneynde’s picture

Issue summary: View changes
kristiaanvandeneynde’s picture

quietone’s picture

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

Just updating version.

kristiaanvandeneynde’s picture

Status: Active » Closed (works as designed)

This looks intentional after verification through git bisect. It did catch me off guard, though, that's for sure :)

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.