Rename data name to ai_automators

Created on 1 October 2024, about 2 months ago

Problem/Motivation

Currently the readable name of the module is AI Automators, but the dataname is ai_automator. This might cause confusion when working with it, so it should be renamed.

Steps to reproduce

Proposed resolution

* Keep the AI Automator module, but remove all functionality and add an update hook that enables the AI Automators module and if possible uninstalls itself.
* Rename the description to explain what is happening.
* Reset the module to be depracated.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

1.0

Component

AI Automators

Created by

πŸ‡©πŸ‡ͺGermany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @marcus_johansson
  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Hi Marcus,

    I encountered a number of issues as a result of this update (some still remain), for others I'm able to provide solutions here for anyone running into this. The main problem was that I could not run database updates anymore. Drush returned:
    [notice] Module ai_automator has an entry in the system.schema key/value storage, but is not installed. More information about this error.

    I then ran the following MySQL command that resolved the issue with running updated.

    DELETE FROM key_value WHERE collection = 'system.schema' AND name = 'ai_automator';

    SELECT * FROM key_value WHERE name = 'ai_automator';

    SELECT * FROM config WHERE name LIKE '%ai_automator%';

    This helped to resolve the issue, but in the site's status report there are a number of errors listed:

    Mismatched entity and/or field definitions
    The following changes were detected in the entity type and field definitions.
    AI Log Type

    The AI Log Type entity type needs to be installed.

    Product

    The commerce_product.ai_automator_status field needs to be uninstalled.

    Content

    The node.ai_automator_status field needs to be uninstalled.

    Taxonomy term

    The taxonomy_term.ai_automator_status field needs to be uninstalled.

    I'm not sure how to address those errors, whether or not I can delete those fields.

    Thanks as always!

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    I just found out that, perhaps because of those MYSQL commands, all of my automators are deleted. Automator is disabled everywhere and the data is gone.

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Hi alfthecat, did you perhaps uninstall the AI Automator manually or did this happen as part of the update of the database?

    Do you have a db backup or a config you can reinstall?

    You can rename every ai_automator.ai_automator.* config file to ai_automators.ai_automator manually and do config import to the new system.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Hi Marcus,

    I could not update the database due to errors caused by the automator update, so I used the MySQL commands I listed above to get around that. I did not uninstall the automator module, myself, it happened as part of the module update I suppose. It's not exactly clear to me how it happened.

    I do have a backup that I'm restoring now, thanks for the guidance on the configuration restore method, I'll try that route.

    I don't know by heart which of the countless fields used automators so having those config files will save my day (and night!) :)

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Just to check if there is a bug here, you did not install the AI Automators module and di not install the AI Automator module and you did run the update script and this happened?

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    I'm just checking if I didn't structurally break something, I see in my modules page a disabled AI Automator (Deprecated) (Deprecated) and the AI Automators module, as per the screenshot. Is that indicative of a bigger problem?

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    No that is perfectly fine, we need to keep the old module there during transition, so you dont get a WSOD. It's just a skeleton module now.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Yes correct, I did not install the automators module, nor did I uninstall the automator module. I just ran updatedb after updating the ai module a few days ago. That turned out to cause issues that blocked me from running updated again, which I tried to do in order to update ECA from 1.x to 2.x, which I attempted again this morning, which is when I discovered the problem and tried to solve it with the commands described.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    OK great. Skeleton modules are great for the upcoming Haloween.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Hi Marcus, quick question, when I try to import a single configuration file though the UI, it fails validation and it lists a long list of reasons, all variations of:

    Configuration core.entity_view_display.node.g_post.default depends on the field.field.node.g_post.ai_automator_status configuration that will not exist after import.

    This also hints at the problem reported in the status report about the automator status field.

    Any tips on how to get around this?

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    If that field does not exist in the ouput config it could be due to this previous bug: https://www.drupal.org/project/ai/issues/3474960 πŸ› Ai Automators doesn't works with Queue/cron Needs review

    You could just try to enable some new Automator Type on the old database dump and Im guessing Alpha7 and the field should show up.

    Sorry about all the problems for you, we are still in the development phase of it and it will be much more stable and reusable then the Interpolator, but there are some changes left to do. Hopefully this was the last real breaking change.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Hi Marcus, what do you mean by automator type? I created a new field on the old database, and I created an automator chain type.

    Still I get the same errors when I export a single automator and try to import it. I'm not sure what the status field is about. I'm going manual now by cleaning up the exported prompts and setting the field config manually. At least I can restore my prompts and know which fields to address :)

    I'm still on the dev release, since the alpha is behind I didn't know it was a good idea to switch to alpha, I decided to just not update the ai module until there is a new alpha release :)

    And totally understand the breaking changes, it's all in flux at the bleeding edge.

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    So if that field is changing, you can fetch any version after that bug fix and just add any field and enable any Automator on it and then you should see the status field show up. And then you can disable the Automator and remove the field. Then that config would show up.

    The status field is something that existed in the Interpolator, but I missed how the logic changed so it never was created in the Automator until that bug fix. Its a data field that has two reasons to exist:

    1. You run the Automator Chains via cronjob, it needs a way of knowing when its finished.
    2. You run the Automator Chains via API, where the API can respond that is processing it and then you can poll against the entity until that field is set to completed.

    For direct saving its pretty useless and while its there for batch jobs as well, usually you will know when they are finished, so pretty useless there as well.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Awesome, thanks very much. It turned out I needed to do this on the updated site, after I created an automator enabled field on all the entity types the import worked. That will save me a lot of time.

    It also cleared up the errors on the status page.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    I restored all my automators, I'm now noticing that google_places no longer fetches any data.

    Is there something I can do to fix that?

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    OK, I figured that one out, somehow the google_places settings were reset so it no longer had a key provided.

    Phew :)

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Hi Marcus, one more issue I'm running into when I try to import a configuration file (unrelated to ai modules):

    Configuration ai_automator_address.google_places_settings depends on the ai_automator_address extension that will not be installed after import.

    Any thoughts on what this can be and how I can fix this?

    Thanks as always.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    Hi Marcus,

    I'm finding a lot of errors in my watchdog log:

    A non-existent config entity name returned by FieldStorageConfigInterface::getBundles(): entity type: node, bundle: g_post, field name: ai_automator_status

    Also, lots of errors referring to fields:
    Field [..]i_automator_status exists but is missing a corresponding field definition and may be misconfigured.

    It turns out that even though there are automator fields on an entity, the AI automator status that is re-created by adding a temporary automator-enabled field as suggested in #18, gets deleted again when I delete that temporary field, unless I re-save another pre-existing automator-enabled field.

    I figured this might be useful to know, maybe the update script needs to re-save the existing fields or something...

  • πŸ‡ΊπŸ‡ΈUnited States shasha821110

    Try to install both AI Automator (Deprecated) (Deprecated) and AI Automators module.
    Got the following error when creating new Chain type:

    TypeError: Drupal\ai_automators\AiAutomatorEntityModifier::__construct(): Argument #2 ($processes) must be of type Drupal\ai_automators\PluginManager\AiAutomatorFieldProcessManager, Drupal\ai_interpolator\PluginManager\AiInterpolatorFieldProcessManager given, called in /code/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 in Drupal\ai_automators\AiAutomatorEntityModifier->__construct() (line 60 of modules/contrib/ai/modules/ai_automators/src/AiAutomatorEntityModifier.php).
    Confused for which submodule should I choose?

    Thanks.

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    @shasha821110 you should use the non-deprecated one. So just the "AI Automators" module.

  • πŸ‡ΊπŸ‡ΈUnited States shasha821110

    Thanks @aalfthecat.
    With that module installed, still saw the error.
    And where I can find the 'Automate Chain Type' from this video: https://www.youtube.com/watch?v=PmChGwzilck
    Appreciate the help.

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

Production build 0.71.5 2024