Problem/Motivation
Split from #3265424: Move migrate related aggregator tests to the module in preparation of removal in d10.
The block migration hardcodes various blocks provided by core modules, including ones like aggregator that are going to be moved to contrib.
Once the modules are gone, what happens to this?
Steps to reproduce
Proposed resolution
1. Do we have a way for contrib modules to migrate block config? If so could we move the block migration to the modules?
2. Can we leave the block support in core, and just move any relevant test coverage to contrib?
Or... something else?
The patch in #4 implements option 2 by adding some error checking in a new Block destination import() method.
Remaining tasks
Agree that this will not break anything and provide an upgrade path for aggregator in contrib.
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 3265483-17.patch | 6.87 KB | quietone |
| #17 | interdiff-12-17.txt | 550 bytes | quietone |
Comments
Comment #2
quietone commentedI've been testing with d6_block.yml. When aggregator is not installed the migration fails when saving the entity with a SchemaIncompleteException. Presumably, the same will happen with forum, although I have not tested that. (Not having drush is inconvenient). So, I thought I would put a wrapper around the import in a \Drupal\block\Plugin\migrate\destination\EntityBlock to catch that exception and rethrow it as a MigrateException. I did that and the migration will continue, it just creates another broken block, in this case one for aggregator. I have updated \Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTest and added a similar test to aggregator.
Other things I thought about,
1) Preventing the import of aggregator blocks in the destination. The source data has the module that provides the block so maybe that could work. That would require more code and only prevent the creation of a broken block. Is it worth is?
2) Change the block migration to skip aggregator blocks and create a new block migration in aggregator. There is more that one way to achieve that but singling out aggregator is not the way to go. It would be saying that the block migration will only migrate blocks for modules in core.
In other words, this is implementing #2 in the proposed resolution.
Comment #4
quietone commentedSilly me, I didn't return a value from the import() method.
Comment #6
quietone commentedAnd again.
Comment #7
catchOK so if you have a Drupal 6/7 site with aggregator, and you do a non-custom migration to Drupal 8/9, then if you don't have aggregator module installed, you'll get this broken block. Presumably before that happens, it'll inform you to install the module anyway? If so I think that's OK.
If not, then your idea of catching the exception so we don't migrate the block sounds good.
Comment #8
quietone commentedYes, if you are using the UI, /upgrade, and Aggregator is not installed on the destination, then Aggregator is listed in the 'will not be upgraded' section of the Review page.
Comment #9
danflanagan8I see aggregator getting installed as part of
Drupal\Tests\block\Kernel\Migrate\d6|d7\MigrateBlockContentTranslationTestShould that get removed? Or should there be a @todo to remove it?
That's the only thing I saw that looked like a problem. I had a few other comments/questions though that may or may not be valuable.
1. I'm wondering if you have any clever ideas about how asserting the messages will scale as more modules (forum, maybe book) get moved to contrib? Will we just update the count, add assertions, and update indexes as needed?
2. The new test in aggregator is very similar to
Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTestobviously. Why does it not extend that test? Is it because it's unwise to extend a test that isn't marked as aTestBase? Is it because it just doesn't really matter and we just need to move this issue along?I'm setting back to NW because I think those @todos need to be added to the
MigrateBlockContentTranslationTestclasses. The comment/questions don't necessarily need action. But I like to try to steal knowledge when I can. Thanks!Comment #10
quietone commented@danflanagan8, thanks!
I think I intended to come back to the BlockTranslation and then it completely slipped my mind. Aggregator can be removed from the translation test because it is a user block that has the translations to test.
1. From memory only a few migrations check the migrate messages. Yes, I just did a grep and found only 8 migration Kernel tests that do this so we will just deal with them one at a time, as needed.
2. It does not extend the core test because so it is independent of the core fixtures. That will avoid changes in the future, if, and when, the core fixtures change. Ideally, there would be new d6 and d7 test fixtures in aggregator that contained only the things that needed to be tested for aggregator. But making a fixture is time consuming and we already have ones that can be used, plus changing the fixtures most likely means changing the tests. And all that for no extra test coverage.
Comment #11
danflanagan8@quietone, thanks for the thought answers to my questions. I really appreciate it.
aggregatoralso gets enabled in the d7 version ofMigrateBlockContentTranslationTest. So unfortunately I have to throw this back to NW. But then we should be good!Comment #12
quietone commentedI am sorry for taking up your time one my silly mistakes, I am just having an 'off' day, presumably because I woke with a bit of cold.
Crossing my fingers!
Comment #13
daffie commentedIn #3265424: Move migrate related aggregator tests to the module in preparation of removal in d10 we are adding this class to the aggregate module. Can we add a @todo to change to using that one.
Can we remove this code from the test
modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php? To me, it is a bit silly to keep it. Now we are only half removing it.Comment #14
danflanagan8@daffie, Regarding 13.2, it looks to me like leaving the (modified) assertions about the aggregator block is reasonable. The assertion checks that the aggregator block, which is still very much a part of the fixture, is broken as expected after migration.
Comment #15
catchYeah I think it's OK to keep the assertion for the migrated (but broken) block. We might want to open a follow-up for the second part of #3265483-7: Handle block migration for modules moved to contrib (i.e. skip the migration entirely) to evaluate whether that's a better option, but then we'd want to have an assertion that no block is migrated so it'd still be a modification to the existing test coverage rather than removing it.
Comment #16
quietone commentedComment #17
quietone commented@daffie, thanks for reviewing,
13.1. Should be fixed in this patch.
13.2. That assertion is the only place in a Kernel test that the migration of the aggregator feed block is tested and it should remain.
in a rush...
Comment #18
catchOne more, this is going to conflict with #3260592: Change Bartik-specific tests to Olivero (or appropriate alternative) in preparation for making Olivero the default. That might be OK, but could we use Olivero here already given it's stable?
Comment #19
daffie commentedBoth my points have been addressed.
The change for comment #18 is going to be fixed in #3260592: Change Bartik-specific tests to Olivero (or appropriate alternative) in preparation for making Olivero the default.
For me it is RTBC.
Comment #20
quietone commented#18, Even though I don't know much about the block migration that feels like too big a change. There are 10 migration Kernel tests with the word 'bartik'. I did try it, and after the migration there are 25 blocks instead of 14 and the aggregator feed block is in the 'content' region and not 'sidebar_second'. Based on that, I think considering the impact on Migrate when the default destination theme changes should be it's own issue.
@daffie, thanks for the link - I'll make an issue for migrate as a child of that one, and the RTBC.
Comment #23
catchOpened #3267309: Decide whether to completely skip the migration of blocks from missing modules as the follow-up, in writing it up I still don't have a strong opinion so fine with the solution here.
@quietone let's leave the bartik -> olivero conversion to that issue then.
Committed 9a877cf and pushed to 10.0.x, cherry-picked to 9.4.x. Thanks!