Problem/Motivation

When one is working on validation constraints and/or config schema in general, repeatedly running drush config:inspect SHOULD be possible.

But today it's not: it yields the same results every time, until a drush cr or equivalent happens.

Steps to reproduce

Proposed resolution

Rather than wiping all caches, just wipe typed_config_definitions and validation_constraint_plugins in the discovery cache.

Remaining tasks

Patch.#2

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Active » Needs review
StatusFileSize
new2.69 KB
wim leers’s picture

Issue summary: View changes
andypost’s picture

+++ b/src/Commands/InspectorCommands.php
@@ -107,6 +118,12 @@ class InspectorCommands extends DrushCommands {
+    // Always inspect an up-to-date configuration schema.
+    $this->discoveryCache->deleteMultiple([
+      'typed_config_definitions',
+      'validation_constraint_plugins',
+    ]);

maybe drush can decorate the service with memoryCache and always skip this keys on get()

gábor hojtsy’s picture

@andypost: I think its fine if we remove them from cache here, its a developer tool after all, so its more likely that you are tweaking the schema anyway, so it may be helpful in itself that it removes the schema cahes for the respective items?

gábor hojtsy’s picture

StatusFileSize
new2.45 KB

Rerolled the patch against the current codebase. Does this only affect Drush?

wim leers’s picture

#5: my thoughts exactly.

Does this only affect Drush?

Yes.

People using the Config Inspector UI would then indeed still get potentially stale information. But people may be using Config Inspector just to explore the values in their configuration. That's less likely in the Drush command.

So I figured that it would be potentially disruptive to do it also in the UI.

But … happy to change that. I have no strong opinion.

andypost’s picture

btw Drush using own kernel additionally to core's one, but I totally agree that current delete is nice workaround without extra complexity

For UI part we can add a description or even hook_help for route with description pointing to performance settings page where caches can be cleared

andypost’s picture

It can be just a description for the checkbox (show only errors) at the top of list

wim leers’s picture

That sounds reasonable to me. Note that we could even show when the config schema was constructed & cached, based on the created column for the relevant row in the cache_discovery table! 🤓

gábor hojtsy’s picture

Hm is cache clearing a concern on the UI because it would do too much clearing or be detrimental to performance of the tool? I would prefer consistency in how the two interfaces to the module work, otherwise you would get different results on the UI and in Drush, that could quickly get confusing.

wim leers’s picture

Assigned: Unassigned » wim leers
Status: Needs review » Needs work

Hm is cache clearing a concern on the UI because it would do too much clearing

This.

or be detrimental to performance of the tool

Not this. Config Inspector itself still does the same exact amount of work either way.

I would prefer consistency in how the two interfaces to the module work, otherwise you would get different results on the UI and in Drush, that could quickly get confusing.

WFM!

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs work » Needs review
StatusFileSize
new4.44 KB
new1.87 KB

Done.

gábor hojtsy’s picture

Title: drush config:inspect should wipe relevant caches to always get up-to-date results » Config inspection should wipe relevant caches to always get up-to-date results
Status: Needs review » Reviewed & tested by the community

Retitle for the more general solution arrived at.

  • e4e5d76e committed on 2.1.x
    Issue #3361559 by Wim Leers, Gábor Hojtsy, andypost: Config inspection...
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks both!

wim leers’s picture

Yay! 🥳

Status: Fixed » Closed (fixed)

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