Mark layout_builder.settings fully validatable

Created on 7 March 2024, 10 months ago
Updated 24 June 2024, 6 months ago

Problem/Motivation

πŸ› Reduce the number of field blocks created for entities (possibly to zero) Fixed just landed and added a new layout_builder.settings config. It contains a single key-value pair. And that's a boolean. So … it needs no validation, it just needs to be marked as fully validatable πŸ₯³

(Note: if ✨ Add a "Validatable config" tests job to GitLab CI to help core evolve towards 100% validatability Fixed had landed, then that CI job would've automatically detected that we're getting a lower ratio of validatable config.)

Steps to reproduce

N/A

Proposed resolution

Just mark it as fully validatable πŸ₯³

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

πŸ“Œ Task
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated 4 days ago

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

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

Merge Requests

Comments & Activities

  • Issue created by @wim leers
  • Status changed to Needs review 10 months ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Pipeline finished with Failed
    10 months ago
    Total: 463s
    #113959
  • Status changed to Needs work 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Seemed to cause a test failure

    1)
        Drupal\Tests\layout_builder\Functional\SettingsFormTest::testSettingsForm
        Behat\Mink\Exception\ResponseTextException: The text "The configuration
        options have been saved" was not found anywhere in the text of the current
        page.
        
        /builds/issue/drupal-3426429/vendor/behat/mink/src/WebAssert.php:907
        /builds/issue/drupal-3426429/vendor/behat/mink/src/WebAssert.php:293
        /builds/issue/drupal-3426429/core/tests/Drupal/Tests/WebAssert.php:956
        /builds/issue/drupal-3426429/core/modules/layout_builder/tests/src/Functional/SettingsFormTest.php:43
        /builds/issue/drupal-3426429/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Fixed. The root cause is a bug that exists for many default simple config files in core. We're fixing them one-by-one (see 🌱 [meta] Add constraints to all simple configuration Active ).

  • Status changed to Needs review 10 months ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Ah this helps in a few modules.

  • Pipeline finished with Success
    10 months ago
    Total: 486s
    #113979
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Does this mean all config needs a landcode?

    Does it need to be set in the form?

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Does this mean all config needs a landcode?

    Yes. As dictated by config schema:

    config_object:
      type: mapping
      mapping:
        _core:
          # This only exists for merging configuration; it's not required.
          requiredKey: false
          type: _core_config_info
        langcode:
          type: langcode
    

    β€” core.data_types.schema.yml.

    The only reasons it hasn't been noticed before: 1) we're not validating our config, 2) our existing basic config schema checking logic at \Drupal\Core\Config\Schema\SchemaCheckTrait::checkConfigSchema() adds a langcode if it's missing 🫣

  • Status changed to RTBC 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    I actually didn't know that and you just answered my slack question.

    Change looks good. Since this feature is on only in 11.x and 10.3.x that hasn't released yet double we need an update hook to add the langcode key.

  • Status changed to Needs review 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    I don't think that langcode should be added here. There's nothing translatable - it's meaningless.

    I think we should make langcode optional and only require it if there is translatable config in the configuration. Interestingly if the default language is something other then 'en' then the locale module (I think) will end adding langcode (or changing) to every config file. Complex issue.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    That makes sense, curious what the solution will be as the missing langcode seems to be the #1 error across multiple config from config inspector.

  • Assigned to alexpott
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Quoting @alexpott from Drupal Slack:

    FWIW this is going to lead to something great
    Maybe…
    Because the real rule around langcode is it is required when the config has translatable data in it.
    And maybe we can write a constraint for that

    πŸ’―

    Pushed a PoC commit that implements exactly that, and even trigggers a deprecation error when langcode is inappropriately present! πŸ€“ Looks like that alone could be hugely disruptive though, so probably wise to accept langcode even when it is not strictly necessary.

    If you step through it, you'll notice that for e.g. system.site it does say it's translatable, but for system.mail it says it's not. Which is correct.

    Will extract this into a new issue, but would appreciate a +1 for overall direction πŸ˜‡

  • Pipeline finished with Failed
    10 months ago
    Total: 493s
    #115059
  • Issue was unassigned.
  • Status changed to Postponed 10 months ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    @alexpott reacted enthusiastically to my PoC commit from #13.

    Extracted as promised: πŸ› Require `langcode: …` only for simple config that contains translatable values Active .

    This issue is now blocked on that one.

  • πŸ‡³πŸ‡ΏNew Zealand danielveza Brisbane, AU

    Flagging that layout_builder.settings will be removed as part of πŸ“Œ Replace "Expose all fields as blocks to Layout Builder" configuration with feature flag Active if that gets approved, so we may be able to close this one if that goes through :)

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Oh, nice! Thanks :)

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Status changed to Needs review 6 months ago
  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    Issues this was postponed on are complete.

  • Status changed to Needs work 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    MR has failures and is unmergable

  • Status changed to Closed: outdated 6 months ago
  • πŸ‡³πŸ‡ΏNew Zealand danielveza Brisbane, AU

    layout_builder.settings was removed in πŸ“Œ Replace "Expose all fields as blocks to Layout Builder" configuration with feature flag Active . As far as I understand this is no longer required, so I'm closing this. Please feel free to reopen if I've made a mistake with that.

    Thanks!

Production build 0.71.5 2024