farmOS icon indicating copy to clipboard operation
farmOS copied to clipboard

Orphaned quantities from create_quantity migrate plugin when validation fails

Open mstenta opened this issue 7 months ago • 3 comments

I discovered a bug while working on a custom CSV importer (following the guide at https://farmos.org/development/module/csv/) using the create_quantity plugin provided by the quantity module in farmOS: https://github.com/farmOS/farmOS/blob/17b792aca77fe757e7f7b18a95f8e5aedae1e192/modules/core/quantity/src/Plugin/migrate/process/CreateQuantity.php

When validate: true is used in the migration's destination config, and an imported entity's validation fails, the quantity entity is still created, resulting in orphaned quantity entities.

I don't think this is really create_quantity's fault. The same would be true of entity's created by the migrate_plus module's entity_generate plugin I believe. It's the nature of how those plugins work. It's also possible to end up with orphaned taxonomy terms, for example, if you use entity_generate to create a term and validation fails. But at least with terms you can go in manually and clean them up in the UI.

There is no way to clean up orphaned quantities in farmOS.

mstenta avatar Jan 16 '24 20:01 mstenta