Overview

#3478537: Introduce an XB `PageTemplate` config entity added the ComponentTreeMeetRequirements validation constraint. It was designed to also support imposing the absence/presence of Blocks-as-Components, prior to #3475584: Add support for Blocks as Components landing.

And #3475584 has since landed, but due to MR size it was decided to land it an in incomplete state.

This is critical for data integrity, and should be rectified ASAP. It will also help #3479643: Introduce a `Pattern` config entity.

Proposed resolution

  1. Uncomment
                // @todo Remove this in Blocks-as-XB-Components: https://www.drupal.org/project/experience_builder/issues/3475584
                if (str_starts_with($missing_value, 'block.') || str_starts_with($missing_value, 'Drupal\\')) {
                  continue;
                }
    

    in \Drupal\experience_builder\Plugin\Validation\Constraint\ComponentTreeMeetsRequirementsConstraintValidator::validate().

  2. Make tests pass
  3. Expand test coverage — the @todos pointing to issue 3475584 describe what should be tested.

User interface changes

None.

CommentFileSizeAuthor
#17 Screenshot 2024-11-14 at 2.49.16 PM.png322.45 KBwim leers
Command icon 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

wim leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs work

From 108 failures down to 100.

Expect this to move towards green quickly now 🤓

wim leers’s picture

Down to 96.

wim leers’s picture

Title: `ComponentTreeMeetRequirements` constraint validator must be updated now that Blocks-as-Components are supported » `ComponentTreeMeetRequirements` constraint validator must be updated now that Blocks-as-Components are supported + make PageTemplate work!
Assigned: wim leers » Unassigned
Status: Needs work » Needs review

Needs review from @longwave and @f.mazeikis.

Is IMHO RTBC-worthy and mergeable.

If need be, I could split off the make PageTemplate work! bit to a separate issue + MR, but it's a single commit: https://git.drupalcode.org/project/experience_builder/-/merge_requests/3... — although that uses PHP Fibers 😄

wim leers’s picture

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

Damn that last bit 😬

f.mazeikis made their first commit to this issue’s fork.

wim leers’s picture

@f.mazeikis FYI I’m working on !395 as we speak — I assigned it to me 50 mins ago.

Fortunately I made the exact same changes locally, but with an extra comment explaining it 😊

I’m currently investigating why:

  1. config:search.settings appears only in D11, not in D10
  2. X-Drupal-Cache-Max-Age is -1 on D11, but 60 on D10
wim leers’s picture

⚠️ I cannot reproduce #8.2 locally: it passes locally with 60!

But … I've been testing using commit 48b0aea1d573d9e01752f9909ec8cd3a1b7e3378 of the 11.x branch, which dates back to October 2.

I already know what causes max-age: 0, and it's XB that ups this to 60 seconds: it's \Drupal\user\Plugin\Block\UserLoginBlock when rendered by FormBuilder for an authenticated user. Just pushed https://git.drupalcode.org/project/experience_builder/-/merge_requests/3... to make that very explicit in the test coverage.

Intermediary conclusion: something changed since then. I bet this is thanks to #2578855: Form tokens are now rendered lazily, allow forms to opt in to be cacheable — see the change record.

wim leers’s picture

#9's hypothesis is confirmed, although it seems somewhat accidental? 😅 See #2578855-165: Form tokens are now rendered lazily, allow forms to opt in to be cacheable, where I ask @catch about this.

Documented in https://git.drupalcode.org/project/experience_builder/-/merge_requests/3...

wim leers’s picture

Assigned: wim leers » f.mazeikis
Status: Needs work » Needs review
wim leers’s picture

Assigned: f.mazeikis » longwave

Left even more "Dear reviewer, here's helpful info"-style guiding comments on the MR, prefixed with 💁.

MR is now actually green and definitely ready for review.

While I still want @f.mazeikis' +1, I'm assigning to @longwave because he worked on the cacheability aspects of ApiComponentsController in #3484671: Add support for block derivatives, which this is keeping, but #3484671 is largely removing 😬 That's why I'd like this to land first, because it proves much more is possible, before we temporarily remove much of it in #3484671…

wim leers’s picture

Title: `ComponentTreeMeetRequirements` constraint validator must be updated now that Blocks-as-Components are supported + make PageTemplate work! » `ComponentTreeMeetRequirements` constraint validator must be updated now that Blocks-as-Components are supported + make PageTemplate render main content!

Slightly clarifying title.

f.mazeikis’s picture

Reviewed and approved. It seems MR still needs approval from @tedbow or @effulgentsia.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

RTBC+1 - all points noted by Wim in the self-review make sense, some tiny little bugs fixed too!

longwave’s picture

Assigned: longwave » Unassigned
wim leers’s picture

StatusFileSize
new322.45 KB

Approvals across the board, with one exception: technically I still need a +1 from @tedbow or @effulgentsia:

… but that's for one single tiny addition to test coverage: https://git.drupalcode.org/project/experience_builder/-/merge_requests/3... — I'm confident that is not contentious.

So moving ahead and merging.

  • wim leers committed 2e6546b3 on 0.x
    Issue #3485917 by wim leers, f.mazeikis, longwave: `...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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