Problem/Motivation
All of the process plugins in Migrate Conditions are set to handle_multiples in the annotation.
This is so that the developer has the "widest view" possible of the pipeline value. If the pipeline value is a scaler, this doesn't affect anything. If the pipeline value is an array, one can easily evaluate conditions on the whole array (like contains or empty) or use the "Logical conditions" (and and or) or the "Array-handling conditions" (all_elements and has_element) to drill down into the source array as needed.
I think that's all fine.
However, the process plugins all rely on the base class declaration of the multiple() method, which determines how the NEXT process plugin will interpret the structure of the pipeline value. This means multiple is always set to FALSE.
This is probably not the best way to do things.
Proposed resolution
evaluate_condition: This always returns a boolean, so this one does not need to change, as multiple should always return false.filter_on_condition: This should always return TRUE for multiple. We always have an array in and we always have an array out.skip_on_condition: This should set multiple to TRUE if the input is an array and FALSE if the input is a scalar. That's what would happen if the skip wasn't there, so we should maintain that, right?first_meeting_condition: This should set multiple to TRUE if the output is an array and FALSE if the output is a scalar. That would make it more like a fancy get, which I think is what we want.if_condition: Hmmm....
Remaining tasks
Decide if this is ok, especially since I was stupid and made a beta release already.
User interface changes
API changes
multiple handling will be better
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | migrate-conditions--multiples--3293151--5.patch | 28.48 KB | danflanagan8 |
| #5 | migrate-conditions--multiples--3293151--5-FAIL.patch | 22.59 KB | danflanagan8 |
| #2 | migrate_conditions-multiple-3293151-2.patch | 5.29 KB | danflanagan8 |
Comments
Comment #2
danflanagan8Here's a patch with my proposed changes. It doesn't cause any tests to fail, which makes me more comfortable with the possibility of committing this to a beta. This doesn't change any intended (i.e. tested) behaviors.
Comment #3
codebymikey commentedI'm not sure what the potential side effects would be for existing migrations making use of these plugins.
I think an easy way to keep the old behaviour without any side effects on the 1.x release would be to let the developer specify what the expected cardinality is with an optional
multipleconfiguration property - see migmag and migrate_devel.Either that or we could save this for a major release or determine if a minor release is sufficient by updating the tests to include behaviour when other (single/multiple) process plugins are also used with it, and the expected behaviour when working with simple nested array value sources like:
I personally don't make use of these plugins with other process plugins, so I don't think this should affect me, however I do think backwards incompatible changes should typically result in a major release.
One thing to note though is that if we do go the
multipleconfiguration route, then it'll probably have to stay in as an API even if the default cardinality changes in a future release.Comment #4
danflanagan8Thanks for chiming in, @codebymikey! It's really helpful to get some community input here.
I think you're correct that our two options are:
1. Do this is a major release
2. Add a
multipleconfiguration option like migmagI'm leaning toward #1, but I'm in no rush. I'll sleep on it for awhile.
Comment #5
danflanagan8Here's a patch that adds a number of test cases intended to elucidate the current behavior with multiples and the proposed behavior with multiples. The second patch is the test patch with the proposed changes from #2 added.
Comment #7
danflanagan8I ended up deciding to add a 2.0.x branch where this work will go. Thanks for the input, @codebymikey!
Comment #8
danflanagan8