Config import error when adding automator to base fields
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3561131. -->
Reported by: [nwoodland](https://www.drupal.org/user/2819229)
Related to !1032
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>When the AI Automator module is used in conjunction with another module that provides field configs that extend <code>FieldConfigBase</code> (and support AI Automators), then the configs that the AI Automator module produces contains incorrect dependencies. For example, adding AI Automators to base fields with the Base Field Override UI module leads to broken config upon config export.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ol>
<li>Enable the Base Field Override UI module and tab to the override UI for the "page" content type: /admin/structure/types/manage/page/fields/base-field-override</li>
<li>Add a Base Field Override to the "Published" field and save</li>
<li>Edit the "Published" field override and configure the new "Enable AI Automator" section and save</li>
<li>Export config</li>
<li>Through the UI, delete the the base field override config</li>
<li>Import config. You will get this error:</li>
</ol>
<blockquote><p>In ConfigImporter.php line 823:</p>
<p> There were errors validating the config synchronization.<br>
Configuration <em class="placeholder">ai_automators.ai_automator.node.page.status.default</em>
> depends on the <em class="placeholder">field.field.node.page.status</em> configuration that<br>
will not exist after import. </p></blockquote>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>The issue is that the <code>AiAutomator::calculateDependencies</code> method hardwires a config string that matches what <code>FieldConfig</code> currently outputs. This breaks with other fields types that extend <code>FieldConfigBase</code>, and is potentially fragile (e.g. if <code>FieldConfig</code> ever changed their config name format). A better approach would be to get the config name dynamically by calling <code>getConfigDependencyName() </code>on the config object.</p>
issue