Config inspection should wipe relevant caches to always get up-to-date results

Created on 19 May 2023, about 1 year ago
Updated 23 May 2023, about 1 year ago

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

β†’ #2

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ“Œ Task
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Wim Leers
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Patch Failed to Apply
  • πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡«πŸ‡·France andypost
    +++ 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()

  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    @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?

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    3 pass
  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

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

  • πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    #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.

  • πŸ‡«πŸ‡·France andypost

    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

  • πŸ‡«πŸ‡·France andypost

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

  • πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    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! πŸ€“

  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    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.

  • Assigned to Wim Leers
  • Status changed to Needs work about 1 year ago
  • πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    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!

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    3 pass
  • πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Done.

  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    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...
  • Status changed to Fixed about 1 year ago
  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    Thanks both!

  • πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Yay! πŸ₯³

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

Production build 0.69.0 2024