Overview

Received a report that after renaming some components and pushing them to the site via CLI resulted in a folder operations not completing. Some console output was shared and I'll include some highlights:

 PATCH https://174207-c06b95bd-28da-4faf-add8-41ec7f499b82.cms.acquia.site/canvas/api/v0/config/folder/0457e657-54f5-4b9a-8344-5ec6958a37f3 422 (Unprocessable Content)
lte @ index.js?v=1.3.3:433
index.js?v=1.3.3:2553 RTK Query error: 
{status: '422', errors: {…}, message: "The 'canvas.component.js.media-feature-grid' config does not exist."}

Proposed resolution

When a "rename" occurs, it's actually a delete + create. A folder that contains the now-deleted component is never made aware of this deletion. If an operation is performed on the folder, it will fail the ConfigExists constraint if any item in the folder does not exist.

This suggests we should, on component deletion, also remove it from any folder it might be in.

User interface changes

Issue fork canvas-3591130

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

bnjmnm created an issue. See original summary.

bnjmnm’s picture

Assigned: bnjmnm » Unassigned
Issue summary: View changes
Status: Active » Needs review

CI isn't accurate at the moment due to some ripple effect of a recent core / Twig security update so it's possible there are some issues that CI would otherwise expose that I'm not yet aware of. However, given that it's a pretty simple change, I'm setting to NR anyway and once CI fully runs I'll clean up anything it catches.

Full fix and test-only branches provided.

wim leers’s picture

Title: Deleted components can still be referenced by folders » Deleted (code) components can still be referenced by folders: dependency handling is missing
Component: … to be triaged » Config management
Priority: Normal » Major
Status: Needs review » Needs work
Issue tags: +data integrity, +missing config dependencies, +Needs update path
Related issues: +#3539729: Implement Folder config entity

🤯 Woah! What a find!

We support Folders of any config entity type. But AFAICT because Folder today just inherits ConfigEntityBase::preDelete() + ConfigEntityBase::onDependencyRemoval(), any dependency that gets deleted should actually in principle result in the Folder itself getting deleted?

And that's not happening because … Folder doesn't compute dependencies right now 😬 This is a big oversight in the MR/issue that introduced Folders. https://git.drupalcode.org/project/experience_builder/-/merge_requests/1429

bnjmnm’s picture

Status: Needs work » Needs review

Thx @wim leers, was not aware of the dependency handling capabilities, but makes sense to have it as the alternative could get unwieldy.