Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Discovered by @xjm in #2830581-26: Fix ContentModeration workflow type to calculate correct dependencies
Steps to reproduce:
- Install Standard.
- Enable content moderation.
- Add the default workflow to articles.
- Add the workflow to pages.
- Remove the workflow from articles.
- Re-add the workflow to articles.
Produced the diff
diff --git a/workflows.workflow.editorial.yml b/workflows.workflow.editorial.yml
index 8846c55..1713f6c 100644
--- a/workflows.workflow.editorial.yml
+++ b/workflows.workflow.editorial.yml
@@ -3,6 +3,7 @@ langcode: en
status: true
dependencies:
config:
+ - node.type.article
- node.type.page
module:
- content_moderation
@@ -67,4 +68,5 @@ type_settings:
default_revision: true
entity_types:
node:
- - page
+ 1: article
+ 0: page
In #11 @xjm discovered that entity types are not being sorted either.
Proposed resolution
Fix the sorts.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#23 | 16-20-interdiff.txt | 1.84 KB | alexpott |
#20 | 2850601-20.patch | 2.44 KB | alexpott |
#20 | 2850601-test-only-20.patch | 2.39 KB | alexpott |
#20 | 16-20-interdiff.txt | 950 bytes | alexpott |
#16 | 2850601-16.patch | 2.49 KB | alexpott |
Comments
Comment #2
xjmConfirmed that the first two steps are not necessary, so updating the IS.
Comment #3
xjmAnd making full STR from installation.
Comment #4
alexpottWho knows why I added the second use of
natsort()
in core. The important thing is to sort the array consistently - natural sorting is unnecessary.Also hey php why does natsort() behave like asort() and not sort()?
Comment #5
xjmProbably this bug and coverage relies on P coming before A in the alphabet, so let's mention that somehow?
Comment #6
xjmAlso I think the inline comment is a copypaste from the empty array test from the other issue.
Comment #7
alexpott@xjm gonna wait for #2850592: Typos in ContentModertaionWorkflowTypeApiTest to reroll on top of fixing all my other spelling mistakes.
Comment #8
xjmI'd prefer not to postpone a borderline-major sorting bug that causes diffs in config (and that causes diffs even by being fixed) on spelling fixes in a test.
Comment #9
xjmRe: the diffs, we don't need an upgrade path because the module is alpha, but we might have considered it if it were stable to avoid unpredictable fixes at random the next time every affected workflow is resaved. Upgrade paths tend to get more annoying with time.
Comment #11
xjmIt looks like the sorting for the entity type itself has the opposite bug (they are not sorted). Following the STR but replacing articles with basic content blocks:
then
Not sure about the scope but seems related.
Comment #12
xjm#2850592: Typos in ContentModertaionWorkflowTypeApiTest is in now.
Comment #13
xjmNW for #5, #6, and possibly #11.
Comment #14
alexpott@xjm nice spot on the entity type ordering. I think that it makes sense to fix that here. This issue reminds me that I really what to build sorting of config into schema so the implementations don't have to think so hard about it and when and when not to do it.
Comment #15
timmillwoodHow does this cover
removeEntityTypeAndBundle
? Maybe it'd be worth adding a few more bundles in the test, then removing one or two and checking the order again?Comment #16
alexpott@timmillwood nice spot with @covers. I don't think we need to add testing for that method here because the remove method doesn't touch the sorting at all. So we'd be testing for code that's not there and using the remove method is not necessary to reproduce the bug.
Comment #17
timmillwoodok, sounds good.
Comment #18
xjmComment #19
xjmDoes this provide the coverage it says for the entity types? Had to read it twice. I was going to suggest testing the two levels separately, but maybe that's not necessary. At least though let's have a test-only patch that's this test + the original fix only for the bundle keys to prove the coverage for the other bug as well.
sorted sorted. Also looks like it can be rewrapped.
Comment #20
alexpottI've dropped the bit about entity type validation from this test - it is just noise here. And improved the other comments. Back to rtbc as these are comment improvements asked by a committer.
Comment #21
timmillwoodThe interdiff doesn't seem right, but the patch look like it resolves the concerns in #19.
+1 to the RTBC in #20.
Comment #23
alexpottHere's the correct interdiff - thanks for reviewing the patch again @timmillwood
Comment #26
xjmHmm, meh to that. It's still a change that should undergo review. But @timmillwood has +1ed it so it is RTBC in any case.
Also the removal of the bit about validation was what I asked for in #6, so that looks good to me too. Thanks for the test-only patch; I double-checked for the "correct" fail on https://www.drupal.org/pift-ci-job/593625.
Committed to 8.4.x and cherry-picked to 8.3.x, since this is eliminating noisy/confusing config diffs (so improving the data model), and also since it's for an experimental module. Thanks!
Comment #27
xjmComment #28
xjmComment #29
xjm@alexpott and I agreed that this does not need to go in the 8.3.0 release notes/changelog, since it is just a followup to the workflow conversion that happened in 8.3.x only and so was a regression since 8.2.x, but I am mentioning it in the beta release notes since the bug affected the alpha.