In order to add an enforced dependency we duplicate information in the dependencies key.

core/modules/book/config/install/node.type.book.yml

 dependencies:
  module:
    - book
   enforced:
     module:
       - book

Removing this duplication make config dependencies cleaner and easier to understand. Also separating the concerns of calculating and get the list of dependencies makes the API simpler to change and maintain.

This is made worse by the fact that we don't recalculate dependencies during install - see #2520526: Calculate configuration entity dependencies on install

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott’s picture

Status: Active » Needs review
FileSize
49.39 KB
alexpott’s picture

Issue summary: View changes
FileSize
50.1 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 2: 2520540-2.patch, failed testing.

The last submitted patch, 2: 2520540-2.patch, failed testing.

Berdir’s picture

As discussed, it would be great if we could check the return value in the one call to calculateDependencies() that really counts and throw a helpful exception about what changed and what you need to update. Then fixing it will be easy, not too worried about that.

I counted around 5 modules/project that this breaks that I'm using.

Wim Leers’s picture

Issue tags: +rc target
alexpott’s picture

Issue tags: -rc target +rc deadline
Wim Leers’s picture

As discussed, it would be great if we could check the return value in the one call to calculateDependencies() that really counts and throw a helpful exception about what changed and what you need to update.

AFAICT once this is done, this is RTBC.

alexpott’s picture

Status: Needs work » Needs review
FileSize
1.04 KB
49.28 KB

Actually it is possible to do this in a way that does not even break BC at the point that really matters :)

alexpott’s picture

Status: Needs review » Needs work

Needs an upgrade path.

alexpott’s picture

Here's an upgrade path and a test for it.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php
@@ -415,6 +416,12 @@ public function testUpdatedSite() {
+    // Ensure that the Book module's node type does not have duplicated enforced
+    // dependencies.
+    // @see system_post_update_fix_enforced_dependencies()
+    $book_node_type = NodeType::load('book');
+    $this->assertEqual(['enforced' => ['module' => ['book']]], $book_node_type->get('dependencies'));

Book module being tested in a System module test… smells fishy. But apparently this is pre-existing.

(This really belongs in Standard AFAICT.)

alexpott’s picture

@Wim Leers that is testing the update function provided the system module so I think it is acceptable.

The last submitted patch, 11: 2520540-11.test-only.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 11: 2520540-11.patch, failed testing.

The last submitted patch, 9: 2520540-9.patch, failed testing.

alexpott’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
713 bytes
93.08 KB

Wow that test sucks.

alexpott’s picture

Interdiff is correct just rerolled against the wrong thing.

The last submitted patch, 17: 2520540-16.patch, failed testing.

Wim Leers’s picture

Wow that test sucks.

+1, been bit by that too :P

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed 6e0225e on 8.0.x
    Issue #2520540 by alexpott: Enforced configuration dependencies shouldn'...
yched’s picture

That test is super painful indeed :-/
(and #2578249: Some e_r fields get the wrong Selection handler, that has to do the same, will need a reroll :-p)

The last submitted patch, 11: 2520540-11.test-only.patch, failed testing.

The last submitted patch, 11: 2520540-11.patch, failed testing.

Status: Fixed » Needs work

The last submitted patch, 18: 2520540-18.patch, failed testing.

alexpott’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.