Handle change of cardinality (fewer/more values allowed): upgrade component instances with more values than cardinality allows by dropping those values (acceptable data loss)
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3587024. --> Reported by: [isholgueras](https://www.drupal.org/user/733162) Related to !1124 !1121 !991 >>> <h2>Problem</h2> <p>When a multivalue prop already has content exceeding a limit that is subsequently set (or tightened), the component throws a hard rendering exception instead of handling the violation gracefully. <del>This breaks page rendering entirely for any page containing that component instance.</del> The page still renders, but any component instance with a populated <code>type: array</code> prop that has its cardinality decreased will break:<br> <img src="https://www.drupal.org/files/issues/2026-05-19/Screenshot%202026-05-19%20at%201.46.06%E2%80%AFPM.png"></p> <h3>Error</h3> <p><code>Drupal\Core\Render\Component\Exception</code> occurred during rendering of component in Page Home (3), field components:<br> <code>[canvas:price_card/features] There must be a maximum of 3 items in the array, 4 found.</code></p> <p><strong>@lauriii confirmed that this is fine and expected because this is indeed a backwards compatibility break.</strong> The entire page still renders just fine; only the broken instances need to be updated to have their excess values thrown away (aka intentional data loss).</p> <p>Editing the component tree will trigger the <code>component_instance_updater</code> infra that <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3463996" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3463996</a></span> introduced.</p> <p>(The content author is not <em>yet</em> informed of this, that's for <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3574257" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3574257</a></span>.)</p> <h2>Steps to Reproduce</h2> <p>- Create a code component with a multivalue prop (no limit or higher limit).<br> - Add content with 4 or more values to a page using that component.<br> - Remove component.<br> - Update the component definition to set a maximum of 3 values on that prop.<br> - Load any page containing the affected component instance.</p> <h3>Expected Behavior</h3> <p><del>The component should render gracefully by truncating excess values.</del><br> <u>When editing its containing component tree</u>, the component instance should be automatically updated by A) truncating excess values, B) updating the version the component instance points to.</p> <p>This should work for instances of both SDCs and code components.</p> <p>This explicit action is reasonable when there's an explicit backwards compatibility break. It's what #3463996 was designed to help overcome :)</p> <h3>Actual Behavior</h3> <p>fatal rendering exception is thrown, preventing the component from rendering.</p> > Related issue: [Issue #3513035](https://www.drupal.org/node/3513035) > Related issue: [Issue #3463996](https://www.drupal.org/node/3463996)
issue