- Status changed to Needs review
over 1 year ago 9:01pm 7 June 2023 - last update
over 1 year ago Custom Commands Failed - 🇺🇸United States mikelutz Michigan, USA
Changed the wording to use isPipelineStopped(), added a new interface to avoid adding to the process plugin interface.
- Status changed to Needs work
over 1 year ago 9:10pm 7 June 2023 - 🇺🇸United States danflanagan8 St. Louis, US
This looks really neat, @mikelutz!
Setting back to NW for the custom commands failure, just in case you didn't see that. I know you're working on lots of issues today. :)
- Status changed to Needs review
over 1 year ago 9:50pm 7 June 2023 - last update
over 1 year ago 29,436 pass - 🇺🇸United States danflanagan8 St. Louis, US
Really cool stuff, @mikelutz.
Regarding test coverage, obviously you've made explicit updates to the skip_on_empty test to test changes made to the skip_on_empty plugin. Then I would argue there's some implicit test coverage for the changes in MigrateExecutable in that I see about a half dozen uses of skip_on_empty with method
process
in various migration yamls and those are presumably covered by tests.However, I'd like to see a test case where the pipeline is stopped but the return value is not null. Maybe we could add a process plugin called
stop_pipeline
with a property that could be passed as true or false and then add a couple simple tests that leverage so we can test cases where the pipeline value is stopped at a value other than null. Maybe that plugin would be defined in a test module. I see one plugin that's in a test module (test_skip_row_process). Or maybe it goes in the migrate module "just because". I'd probably find a valid use for it when combined with (you guessed it!) Migrate Conditions. :)Anyway, great work. I'm interested in hearing your thoughts on expanding test coverage. Cheers!
- last update
over 1 year ago 29,438 pass - 🇺🇸United States mikelutz Michigan, USA
Agree explicit pipeline tests are needed here, I don't think we need a whole dummy plugin, I think prophecies will do just fine.
- last update
over 1 year ago 29,439 pass - 🇺🇸United States mikelutz Michigan, USA
Added another explicit test of the methods in ProcessPluginBase, and updated the change record.
- Status changed to Needs work
over 1 year ago 5:20pm 8 June 2023 - 🇺🇸United States danflanagan8 St. Louis, US
This work is so nice. I applied the patch to a D10 site and did some manual testing with it.
First, I played with skip_on_empty to try to stumble upon any regressions. In particular I wondered if there was any change in behavior for the case where I pass an array to skip_on_empty where one of the array items is empty. The behavior was the same before and after the patch. (The array is returned with the empty items converted to nulls.)
Second, I created a new plugin that uses the new stop pipeline feature. The code looks like this (it's a natural thing to add to Migrate Conditions):
/** * @MigrateProcessPlugin( * id = "stop_on_condition", * handle_multiples = TRUE * ) */ class StopOnCondition extends ProcessPluginWithConditionBase { public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if ($this->condition->evaluate($value, $row)) { $this->stopPipeline(); } return $value; } }
It does exactly what I wanted it to do. Very cool!
Regarding the code itself...
I think the test coverage here is spot on. My only tentative suggestion would be to use
getMockForAbstractClass()
inDrupal\Tests\migrate\Unit\process\ProcessPluginBaseTest
instead of defining the new class in there. But that's just a matter of taste. It doesn't really matter to me.I also looked in migrate_tools, which declares its own MigrateExecutable, and confirmed that the
processPipeline
is not being overridden there. I was worried about the possibility of a knock-on effect there, but it looks like we're safe.Regarding the CR, skip_on_empty is not mentioned directly. I think we should say that it no longer throws a MigrateSkipProcessException. Or should that be its own CR?
I'm ready to RTBC this except for the nit with the CR.
- Status changed to Needs review
over 1 year ago 6:38pm 8 June 2023 - 🇺🇸United States mikelutz Michigan, USA
I considered using mocks there, but I also need reflection to access the protected method, and when I added it all up, just putting an empty concrete class there for testing seemed easiest.
I'm not sure we need a CR for something not throwing an exception anymore, but I don't mind adding it as a footnote to the existing CR. I've updated the CR with that note.
- Status changed to RTBC
over 1 year ago 7:04pm 8 June 2023 - 🇺🇸United States danflanagan8 St. Louis, US
All sounds good to me. Thanks for the awesome work here, @mikelutz.
- Status changed to Needs work
over 1 year ago 7:18pm 8 June 2023 - 🇺🇸United States mikelutz Michigan, USA
There's one more bug here I realized. The plugins are kept from row to row, so the member isn't going to be reset on each row. I need to fix that or skip on empty will behave strangely.
- Status changed to Needs review
over 1 year ago 7:49pm 8 June 2023 - last update
over 1 year ago 29,440 pass - 🇺🇸United States mikelutz Michigan, USA
This is slightly more complicated, but a much better DX than expecting the developer to reset the stoppage at the beginning of the transform method. I'm also not super excited with the way it behaves on multiple when the plugin doesn't handle multiples, but it matched what the exception did, and I don't want to change that or we won't be able to replace the exception with this in the follow-ups, and it would change how skip on empty works now, so I think it's okay. It's better than what we have with the exception anyway.
- 🇺🇸United States danflanagan8 St. Louis, US
Good catch, @mikelutz. I only tested with a single row, so I did not encounter the bug with my custom process plugin. D'oh!
- 🇺🇸United States mikelutz Michigan, USA
Yeah, your custom process would have been broken, which I noticed. I debated leaving it so you are responsible for resetting it yourself, but it was going to lead to way too many issues coming up in slack, so better to have the system clear it between runs, I think.
- Status changed to RTBC
over 1 year ago 9:06pm 8 June 2023 - 🇺🇸United States danflanagan8 St. Louis, US
I went back and tested my custom process plugin against the patch in #36 with more than one row of data and confirmed that the
stopPipeline
value got stuck.Then I applied the patch in #42 and the value no longer got stuck. I agree that this is better DX and will make for better SX (Slack Experience). Thanks!
I'm also not super excited with the way it behaves on multiple when the plugin doesn't handle multiples, but it matched what the exception did...and it would change how skip on empty works now, so I think it's okay.
I agree. And I want to re-iterate that this was one of the possible regressions I considered during manual testing and found that skip_on_empty behaves the same way with an array before and after the patches in #36 and #42.
I'll throw this back to RTBC (though I must say I'm always a bit shy/embarrassed when I've already done it once). Cheers!
- last update
over 1 year ago 29,441 pass - last update
over 1 year ago 29,447 pass - last update
over 1 year ago 29,452 pass - last update
over 1 year ago 29,490 pass - last update
over 1 year ago 29,503 pass - last update
over 1 year ago 29,509 pass - last update
over 1 year ago 29,540 pass - last update
over 1 year ago 29,557 pass - last update
over 1 year ago 29,563 pass - Status changed to Needs review
over 1 year ago 4:12am 28 June 2023 - last update
over 1 year ago 29,563 pass - 🇳🇿New Zealand quietone
I started to review the code and was finding quite a few places that I thought needed doc changes. Instead of pushing back to NW I have decided to make them myself. Setting back to NR.
- 🇳🇿New Zealand quietone
I did some work on the CR. But I think it still needs attention, particularly the part beginning , 'For process plugins extending'.
- 🇬🇧United Kingdom joachim
What happens with the SubProcess plugin? Which pipeline is stopped -- the inner one or the main one? That should be documented somewhere.
- 🇺🇸United States mikelutz Michigan, USA
The inner one, same as throwing a migrate skip process exception in a subprocess does now.
@quietone is right, the CR needs an update to that section I made changes to that section since I lost updated the change record. I'll try to fix it today, I can add a note about subprocess.
- Status changed to Needs work
over 1 year ago 2:15pm 5 July 2023 - 🇺🇸United States smustgrave
For the CR updates.
Didn't review as this may be one of those migration tickets that require the experts. But can help test where I can.
- 🇺🇸United States danflanagan8 St. Louis, US
I like all of @quietone's updates in #46. Thanks!
But after twice RTBC-ing this, I'm wondering if we might want to expand the MigrateExecutable test just a wee bit. What would you think, @mikelutz, about adding a test method to
MigrateExecutableTest
that processes more than one row? Essentially adding a third test that putstestStopPipeline
andtestContinuePipeline
into a single test. I tried to put something together but was struggling with MethodProphecy. I wanted to usewillReturnOnConsecutiveCalls()
but that apparently doesn't exist with prophecies.Maybe you don't think that's even necessary. But coming back with fresh(ish) eyes it looks like maybe we aren't sufficiently testing the change you made in #42 where we delegate resetting the plugin between rows to the migrate executable.
What do you think?
- Status changed to Needs review
over 1 year ago 3:08pm 13 July 2023 - last update
over 1 year ago 29,815 pass - 🇺🇸United States mikelutz Michigan, USA
I've updated the change record to reflect the new code.
As far as tests, I've added a ->shouldBeCalled() to the resetStop calls in the existing tests. But I don't think we need to do anything further for testing. The existing executable tests prove that resetStop() is called (now). They prove that the result of isPipelineStopped correctly determines whether to continue processing or not. They also prove that process plugins that don't implement the new interface will work. The process plugin base tests prove that resetStop correctly affects the return value of isPipelineStopped in our implementation. So we've proven that multiple calls to a stoppable plugin will correctly reset between rows already, and additional tests will just increase test run times and decrease maintainability as there would be no way for the test you propose to fail without one of the existing tests also failing, so I don't believe we should add an additional test. Adding the ->shouldBeCalled() to the resetStop prophecy is a good call, as otherwise we wouldn't be proving that the executable is resetting the stop prior to running a transform. So I think that bit is necessary to make the test coverage complete.
- Status changed to RTBC
over 1 year ago 1:38am 23 July 2023 - 🇺🇸United States smustgrave
Verified all the tests fail as expected
testStopPipeline
Expected :'first_plugin' Actual :'final_plugin'
testContinuePipeline
Some predictions failed: Double\MigrateProcessInterface\StopPipelineInterface\P1: No calls have been made that match: Double\MigrateProcessInterface\StopPipelineInterface\P1->resetStop() but expected at least one.
testMultipleTransforms
Drupal\migrate\MigrateSkipProcessException
CR makes sense to me. Feel good marking this.
31:27 27:21 Running- last update
over 1 year ago 29,883 pass - 🇺🇸United States danflanagan8 St. Louis, US
Thanks, @mikelutz and @smustgrave. I apologize for not responding after @mikelutz's very persuasive comment in #52. I give a +1 for the RTBC.
I got the sense that @benjifisher wanted to review this too. I'll ping him in the #migrate channel and alert him that it's back to RTBC. Cheers!
- 🇺🇸United States mikelutz Michigan, USA
Benji was looking at 📌 Allow process plugins to flag a row to be skipped Needs review which does a similar thing for MigrateSkipRowException that this issue does for MigrateSkipProcessException, although he hasn't gotten to it, and I'm happy for anybody to review that issue that would like to, it's been stuck for a bit waiting on reviews.
- last update
over 1 year ago 29,888 pass - last update
over 1 year ago 29,891 pass - last update
over 1 year ago 29,912 pass - last update
over 1 year ago 29,950 pass - last update
over 1 year ago 29,950 pass - last update
over 1 year ago 29,957 pass - last update
over 1 year ago 29,957 pass - last update
over 1 year ago 29,962 pass - last update
over 1 year ago 29,962 pass - last update
over 1 year ago 29,963 pass - last update
over 1 year ago 29,965 pass - last update
over 1 year ago 30,051 pass - last update
over 1 year ago 30,055 pass - last update
over 1 year ago 30,053 pass, 1 fail The last submitted patch, 52: 3245997-52.drupal.Allow-process-plugins-to-stop-further-processing-on-a-pipeline.patch, failed testing. View results →
- last update
over 1 year ago 30,060 pass - last update
over 1 year ago 30,062 pass - last update
over 1 year ago 30,064 pass - last update
over 1 year ago 30,064 pass - last update
over 1 year ago 30,104 pass - last update
over 1 year ago 30,139 pass - last update
over 1 year ago 30,139 pass 32:15 28:55 Running- last update
over 1 year ago 30,150 pass - last update
over 1 year ago 30,150 pass - last update
over 1 year ago 30,152 pass - last update
over 1 year ago 30,158 pass - last update
over 1 year ago 30,165 pass - last update
over 1 year ago 30,165 pass - last update
over 1 year ago 30,172 pass - last update
over 1 year ago 30,172 pass - last update
over 1 year ago 30,209 pass - last update
about 1 year ago 30,367 pass - last update
about 1 year ago 30,369 pass - last update
about 1 year ago 30,364 pass - last update
about 1 year ago 30,366 pass - last update
about 1 year ago 30,383 pass - last update
about 1 year ago 30,381 pass - last update
about 1 year ago 30,386 pass - last update
about 1 year ago 30,396 pass - last update
about 1 year ago 30,401 pass - last update
about 1 year ago 30,397 pass, 2 fail The last submitted patch, 52: 3245997-52.drupal.Allow-process-plugins-to-stop-further-processing-on-a-pipeline.patch, failed testing. View results →
40:51 18:05 Running- last update
about 1 year ago 30,446 pass - last update
about 1 year ago 30,468 pass - last update
about 1 year ago 30,487 pass - last update
about 1 year ago 30,489 pass - last update
about 1 year ago 30,490 pass - last update
about 1 year ago 30,492 pass - last update
about 1 year ago 30,515 pass - Status changed to Needs work
about 1 year ago 11:58pm 10 November 2023 The Needs Review Queue Bot → tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request → . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
- Merge request !5348Allow process plugins to stop further processing on a pipeline → (Closed) created by mikelutz
- Status changed to Needs review
about 1 year ago 2:01pm 11 November 2023 - Status changed to RTBC
about 1 year ago 2:07pm 11 November 2023 - 🇺🇸United States mikelutz Michigan, USA
Compared the MR generated patch to the original patch, no changes other than a couple line numbers. Restoring RTBC pending passing tests.
- Status changed to Needs review
12 months ago 12:25pm 11 January 2024 - 🇬🇧United Kingdom longwave UK
> They also prove that process plugins that don't implement the new interface will work.
Are there any of these? Is there not a 1:1 relationship between MigrateProcessInterface and ProcessPluginBase?
As per BC policy
we reserve the ability to add methods to these interfaces in minor releases to support new features
and therefore not sure we need the new interface or checks at all, we can just add to both MigrateProcessInterface and ProcessPluginBase and anyone doing anything non standard (ie. implementing the interface but not using the base class) has to add the method themselves?
And if so, should we make
resetStop()
a more genericreset()
method that is guaranteed to be called before each iteration around the plugin executable loop, in case we need to extend this in the future, or if a plugin somehow wants to reset other state? - 🇺🇸United States mikelutz Michigan, USA
Everybody saw it, Longwave said I could change the interface!
Seriously, that is my preference, I've just gotten pushback in the past when following the BC promise to the letter when there is an alternative that goes above and beyond, hence the new interface. It does seem like lately we moving away from going above and beyond the BC promise when doing so involves adding extra unnecessary code and interfaces, so I'm all for it.
- 🇺🇸United States mikelutz Michigan, USA
MR updated and passing. Ready for review.
- Status changed to RTBC
12 months ago 3:07pm 12 January 2024 - 🇺🇸United States danflanagan8 St. Louis, US
I'm almost as happy as @mikelutz that @longwave suggested changing the interface. :)
Changes look good. Throwing back to RTBC.
- Status changed to Fixed
12 months ago 5:57pm 12 January 2024 -
longwave →
committed fed12777 on 11.x
Issue #3245997 by mikelutz, martin_klima, quietone, danflanagan8,...
-
longwave →
committed fed12777 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.
- 🇺🇸United States danflanagan8 St. Louis, US
Now that D10.3.0 is out, I've released version 2.2.0 of Migrate Conditions → featuring the stop_on_condition process plugin → pasted into #37.