Problem/Motivation
This is inspired by #3391689: Add a performance tests job to gitlab and send data to OpenTelemetry.
This will help #2869792: [meta] Add constraints to all config entity types + #2952037: [meta] Add constraints to all simple configuration reach their goals, to eventually reach #2164373: [META] Untie config validation from form validation — enables validatable Recipes, decoupled admin UIs …:

I’ve already automated the high-level monitoring outside of core, through a scheduled CI pipeline in the config_inspector module, which results in a nightly update of https://project.pages.drupalcode.org/config_inspector/ (raw output for generating that chart is also available, which is interpreted by a script to transform all that into a single .csv file, plus an R script to generate the chart). It’s all powered by drush config:inspector --statistics.
Of course, that chart is kinda hard to discover. Ideally, whenever a config/schema/*.schema.yml file is modified (or a .module file containing a hook_config_schema_info_alter()), I want a new Config validatability CI job in Drupal core’s CI to both visualize + diff, to inform the core contributor of this MR’s impact using:
- a subset of the chart at https://project.pages.drupalcode.org/config_inspector/ to visualizes the impact
- a plain text git diff-like output that shows % decrease/increase, lists specifically which config types/objects are now less/more validatable
This would make the impact of #2002174: Allow vocabularies to be validated via the API, not just during form submissions, #3421849: Add validation constraints to announcements_feed.settings and #3422407: New config schema data type: bytes (the three currently RTBC "config schema + validation" issues, one targeting all config entities of a certain type, one targeting a simple config object, one targeting a single config schema type) much easier to understand.
This would be very helpful for the core contributor DX IMHO.
Steps to reproduce
N/A
Proposed resolution
- When a MR makes NO CHANGES wrt config schema, do not bother running the new job, but allow it to be triggered manually: works ✅
- When a MR makes MORE config validatable, the job must PASS: works ✅

- When a MR makes FEWER config validatable, the job must FAIL: works ✅

- Per feedback from @longwave, this was made resilient against the scenario where either https://github.com/drush-ops/drush or https://www.drupal.org/project/config_inspector does not have a core-compatible release: in that case the CI job is allowed to fail 👍
- Per feedback from @alexpott, this was expanded to not just verify this for the config schema + default config when installing the Standard install profile, but also that of all core modules. When removing a validation constraint from a module not installed by Standard, the new CI job also fails now 👍.
Remaining tasks
TBD
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 3422641-nr-bot.txt | 90 bytes | needs-review-queue-bot |
| #11 | 3422641-nr-bot.txt | 90 bytes | needs-review-queue-bot |
| #3 | Screenshot 2024-02-20 at 2.05.05 PM.png | 403.18 KB | wim leers |
| #3 | Screenshot 2024-02-20 at 1.56.06 PM.png | 470.6 KB | wim leers |
| #3 | Screenshot 2024-02-20 at 1.53.17 PM.png | 171.13 KB | wim leers |
Issue fork drupal-3422641
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
Comment #3
wim leersTo my own surprise, this pretty much worked on the first try 🤯
(Then again, I did already make a superset of all this work in
config_inspectorin #3391990: Automated report on core config validatability, and that was much harder. So all the necessary pieces already existed.)Impact
This would make the impact of #2002174: Allow vocabularies to be validated via the API, not just during form submissions, #3421849: Add validation constraints to announcements_feed.settings and #3422407: New config schema data type: bytes (the three currently RTBC "config schema + validation" issues, one targeting all config entities of a certain type, one targeting a simple config object, one targeting a single config schema type) much easier to understand.
Reviews/likely concerns
I think there are a few obvious things to disagree with here:
drush/drush? I could work around this, although there's no trivial way to install modules from the command line then.drupal/config_inspector? I could move thedrush config:inspect --statisticslogic into Drupal core, but that seems far worse, because it increases the maintenance burden of Drupal core?But … the complexity here is entirely isolated to this single new core CI job. At any point in time can we easily remove this job. In fact, once the linked meta/plan issues are complete, I'd vote to remove this CI job. It's only a tool to help core's velocity and improve both contributor and committer DX. 🤞 So it seems reasonable?
Comment #4
wim leersThis would also help make the Recipes initiative more likely to succeed, because more validatable config leads to more reliable recipes, which should lead to a stronger Recipes ecosystem.
Comment #5
fjgarlin commentedI added some feedback to the MR. All minor, some of them are questions.
Comment #6
wim leersFeedback addressed!
Comment #7
fjgarlin commentedIt looks good from my end. I like that it is self-contained, as you intended from the beginning.
I'd mark it as RTBC but I think issues like bringing "drush" need to be reviewed by a core maintainer to see the feasibility of this (temporary) job, so I'll leave it as Needs Review.
Great work!
Comment #8
longwaveThe one issue I see is that when we switch to
mainor open a new branch for core development, what happens whencomposer require drush/drush drupal/config_inspectorstarts failing because there is no compatible package yet? Given this runs on any change to a .module file then this is likely to make MRs on a new branch fail even if they are nothing to do with config schema.But, perhaps we just deal with that when it happens by altering the job?
Comment #9
wim leersconfig_inspectoris already declaring11.xcompatibility and is explicitly testing daily withOPT_IN_TEST_NEXT_MAJOR.+1 to this.
How about this for a pragmatic balance:
composer require …today exits with code1upon failure — we can append|| exit 99allow_failure:exit_codes(docs) to specifically allow failure only for99, but not for anything elseTada, graceful degradation! 😄
Comment #10
wim leers@longwave Implemented what I proposed in #9 (but more explicitly/clearly) to address your concerns in #8: https://git.drupalcode.org/project/drupal/-/merge_requests/6700/diffs?co...
So now it should not even be necessary anymore to "just deal with it whenever that [Drush not compatible with next major Drupal version] happens".
Comment #11
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #12
wim leersMerged in upstream, addressed feedback from @longwave & @alexpott.
Comment #13
wim leersIssue summary updated to explicitly state the refinements to make this new CI job:
Comment #14
smustgrave commentedNeat!
Am seeing additional modules are being installed
[success] Successfully enabled: action, ban, basic_auth, book, config_translation, content_moderation, content_translation, datetime_range, field_layout, forum, help_topics, inline_form_errors, jsonapi, language, layout_builder, layout_discovery, locale, media, media_library, migrate, migrate_drupal, migrate_drupal_ui, mysql, pgsql, phpass, responsive_image, rest, sdc, serialization, settings_tray, statistics, syslog, telephone, tour, tracker, workflows, workspaces
Seems like a neat feature but would this eventually be a failing check when we reach 100%? Is there a way to have certain things skipped? Example deprecated modules
Comment #15
wim leersHow's that? We'd have to stay at 100%, then there'd be no failure. Status quo is proven to also not trigger test failures — see point 1 in the proposed resolution for an example.
Sure, we can do that. When the need arises. Again: if this ever gets in the way of core development, we can just delete it!
Comment #16
smustgrave commentedIn that case +1 but will leave in review for other eyes. Not sure I can mark it
Comment #17
smustgrave commentedIs there any additional testing I can do to mark this RTBC?
Comment #18
wim leers@smustgrave You can try marking more/fewer things as fully validatable and re-confirm that it all works as expected, like I did for the issue summary 😄
Comment #19
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #20
wim leers👍
Comment #21
smustgrave commentedNot seen that one yet
Comment #22
wim leers#21: This MR cannot cause that. This must be a regression relating to switching to PHP 8.3 for all testing, or a random failure.
Comment #23
wim leersAh, this is in the new CI job! Then obviously it is possible 😅 Though I have no idea what could've caused that… will investigate.
Comment #24
wim leersLooks like this is no longer working because of a core regression: #3425198: Regression: Error installing standard profile with sqlite, circumstances TBD.
Comment #25
wim leersOkay, switching from
drush site-installtocore/scripts/drupal installunblocked this. 😄 (I'd removedrushaltogether, but there's no way to install modules usingcore/scripts/drupaltoday, that's being proposed in #3089277: Provide core CLI commands for the most common features of Drush.)That means this is unblocked! 🥳
Comment #26
smustgrave commentedDon't mind marking if you want to remove that one change in core/config/schema/core.data_types.schema.yml
And question but do you want to lock down the version of config_inspector it pulls or fine with grabbing the latest?
Comment #27
wim leersDone.
Grabbing latest is best. Let
composerfigure out the appropriate version for whichever core version. Because then we won't have to update the.gitlab-ci.ymlto update to a newer version.Comment #28
smustgrave commentedMakes sense!
Comment #30
longwaveI thought that we would need a similar check as per the cspell job where we take one SHA over another in some cases. But as that seems to work here maybe we can simplify that job as well? A task for another issue anyway.
I was also concerned about these steps:
The
composer requiremodifies the following files:If any of these files are different between the two SHAs that are checked out, the second checkout may fail due to conflicts, as proven in this job: https://git.drupalcode.org/project/drupal/-/jobs/1023410
As we don't need Composer after installing Drush and Config Inspector maybe it is safe to use
git checkout -fhere?Comment #31
wim leersGood suggestion! 👍 Implemented: https://git.drupalcode.org/project/drupal/-/merge_requests/6700/diffs?co... → passed ✅
Also updated your fork to verify it actually solves that edge case: https://git.drupalcode.org/project/drupal/-/merge_requests/6974/diffs?co... → passed ✅
Comment #32
longwaveAlright, let's give this a shot. Backported to 10.3.x to keep things in sync, I see no need to go back further with this one.
Committed and pushed 566b7d32e3 to 11.x and b27e31dc01 to 10.3.x. Thanks!
Comment #37
wim leersYAY!
This allowed me to close #3324984: Create test that reports % of config entity types (and config schema types) that is validatable. And … I updated one of the-in-progress config validation issues, and sure enough, it works great: #3422872-10: Add validation constraints to contact.settings 😊 Similarly, I checked a very important/huge scope issue (#3352256: Move code from the experimental SDC module to core), I see that the job is running there (because it modified a
.modulefile), and it's passing. So: it's not disrupting anything shortly after introduction at least. I'll be keeping an eye on this. Feel free to ping me directly if this ever gets in the way.I'm excited about how this will empower #3427641: [meta] Config validation for a more reliable Drupal + reliable Recipes from the start to move faster! 🚀
Comment #38
acbramley commentedThis seems to be causing issues with MRs that are removing config entities
https://git.drupalcode.org/issue/drupal-3432874/-/jobs/1126875
Comment #39
catchRe-opening. Could we potentially count the raw number of validatable and unvalidatable config objects and then the test would need to be updated every time, but if we're removing a validatable config object, it would be easy to keep the test passing.
Comment #40
longwaveOr, should we just mark the job as allow_failure, so it still runs but doesn't block anything?
Comment #41
claudiu.cristeaNot sure I've landed in the right place. I have two different MRs from two different issues. Both are changing or adding schemas. And both are failing in this job. I have no idea what I'm doing wrong or what I should fix. I think the failure deserves a good error message in the job's log. Now is so opaque...
My cases:
Comment #42
rcodinaI'm in the same situation of @claudiu.cristea. I have a MR which modifies image field settings to add a property. How can I pass the test if the MR.json will always be different from HEAD.json?
.gitlab-ci.yml
My case:
#3325551 > https://git.drupalcode.org/issue/drupal-3325551/-/jobs/1209260
Comment #44
acbramley commentedRe #40 catch agreed we should allow failures until the kinks are ironed out https://drupal.slack.com/archives/C1BMUQ9U6/p1711664511341669?thread_ts=...
Created an MR to allow that.
Comment #45
smustgrave commentedHopefully helps the MRs
#42 I rebased and the validations least didn’t stop the MR that time.
Comment #46
alexpottWhatever happens next should be in a new issue.
Committed and pushed 722ab9b218 to 11.x and 539e16021f to 10.3.x. Thanks!
Let's do this and open a follow-up to make this fail again and improve the checking so it doesn't trigger false positives.
Comment #49
acbramley commentedCreated #3437726: Fix issues with Validatable config job