AI Automators uninstall leaves ai_automator_status field and related configuration behind
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3578417. --> Reported by: [cadence96](https://www.drupal.org/user/3520894) Related to !1307 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>Uninstalling AI Automators leaves the ai_automator_status field in media entities.<br> <strong>Short Description: </strong>The AI Automators module does not fully clean up configuration on uninstall.<br> <strong>Check-in Date: </strong>03/10/2026<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When enabling the <strong>AI Automators</strong> module and configuring an automator for the <code>field_media_image</code> field in the <code>media:image</code> bundle, the module creates an additional field called <code>ai_automator_status</code>.</p> <p>After uninstalling the module, this field and its configuration remain in the system. As a result:</p> <ul> <li>The field <strong>AI Automator Status</strong> still appears in <em>Manage fields</em> for the media bundle.</li> <li>Configuration related to this field is still present.</li> <li>References to this field remain in entity display configuration.</li> </ul> <p>This means uninstalling the module does not fully clean up the configuration it created.</p> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <ol> <li>Install the <strong>AI Automators</strong> module.</li> <li>Configure an automator for <code>field_media_image</code> on the <code>media:image</code> bundle.</li> <li>Uninstall the <strong>AI Automators</strong> module.</li> <li>Go to <strong>Structure &rarr; Media types &rarr; Image &rarr; Manage fields</strong>.</li> </ol> <p>Result:</p> <ul> <li>The field <code>AI Automator Status</code> (<code>ai_automator_status</code>) is still present.</li> <li>Running <code>drush cex</code> shows configuration such as:</li> </ul> <pre> field.storage.media.ai_automator_status field.field.media.image.ai_automator_status </pre><p>Additionally, references to this field remain in entity display configuration:</p> <pre> core.entity_form_display.media.image.default core.entity_form_display.media.image.media_library core.entity_view_display.media.image.default core.entity_view_display.media.image.media_library </pre><p>This means the field created by AI Automators persists in:</p> <ul> <li>Field storage configuration</li> <li>Field instance configuration</li> <li>Entity form display configuration</li> <li>Entity view display configuration</li> </ul> <p>These configurations were created by the module but are not removed when the module is uninstalled.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>When uninstalling the <strong>AI Automators</strong> module, the uninstall process should remove any fields and configuration it created, including:</p> <ul> <li><code>field.storage.media.ai_automator_status</code></li> <li><code>field.field.media.image.ai_automator_status</code></li> <li>References to this field in entity form display configuration</li> <li>References to this field in entity view display configuration</li> </ul> <p>This would ensure the site returns to a clean state after module removal.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li>Confirm whether the field is intentionally left behind or should be removed during uninstall.</li> <li>If unintended, implement cleanup logic in <code>hook_uninstall()</code>.</li> <li>Ensure related display configuration is also cleaned.</li> <li>Add tests if needed.</li> </ul> <h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3> <p>No UI changes are required. The fix should ensure configuration cleanup during module uninstall.</p> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[x] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code<br> This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p> <p>[ ] AI Generated Code<br> This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p> <p>[ ] Vibe Coded<br> This code was generated by an AI and has only been functionally tested.</p>
issue