Since 10th November 2017 automated daily testing for Scheduler at core 8.5 fails with a deprecation message:
\Drupal\Core\Routing\Enhancer\RouteEnhancerInterface is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, you should use \Drupal\Core\Routing\EnhancerInterface. See https://www.drupal.org/node/2894934
See https://www.drupal.org/pift-ci-job/807329
The failures are all within Schedulers 'Rules Integration' tests and the deprecated code is actually in the Rules module.
Interestingly, the message says "deprecated in Drupal 8.4.0" but it is actually 8.5 in which the message and test failure occurs - it runs OK at 8.4. This has now ben fixed in #2926412: Follow-up for #2883680: deprecation message indicates the wrong deprecation introduction version
Note: This issue was originally raised in the Scheduler issue queue, but was moved to Rules in comment #3
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | legacy.patch | 11.35 KB | tr |
Comments
Comment #2
jonathan1055 commentedThe change record is https://www.drupal.org/node/2894934
The issue is #2883680: Force all route filters and route enhancers to be non-lazy
Comment #3
jonathan1055 commentedThe tests which fail are actually all in the Rules integration:
It is not a fault in the Scheduler code. but in Rules src/Routing/RulesUiRouteEnhancer.php which uses the deprecated code.
Moving this issue to the Rules queue where I will work on a fix - and to add a test so that Rules itself will find the fault in its own code ;-)
Comment #4
jonathan1055 commentedIn my Travis build, the Rules code does fail at 8.5 which is good. It is just that we have not seen any Rules patches tested at 8.5 since the commit of #2870194: Ensure that process-isolated tests can use Symfony's PHPunit bridge to catch usages of deprecated code on 9th November. Daily Rules testing is only at 8.4 currently.
To check this, here is a dummy patch which alters no code. It should fail tests at 8.5 but run OK at 8.4
Comment #5
jonathan1055 commentedAs expected the current code fails at 8.5 but passes at 8.4
Here is the fix to use the new
EnhancerInterfaceclass. I am expecting this patch to pass at 8.5 but fail at 8.4Comment #6
jonathan1055 commentedAs expected, when fixing the tests to pass at 8.5 they fail at 8.4 and 8.3
When #2923267: Allow test classes to specify skipped deprecations too lands, we will be able to leave the existing deprecated code in place, add a @todo referencing this issue and list the deprecation message to be skipped in the 20 test classes that fail.
An alternative would be to try to create a
\Drupal\Core\Routing\EnhancerInterfaceclass in 8.4 and 8.3 which would use the new class but allow the same interface. Then code could be fixed and we would not have to carry forward 'technical debt' to fix in the future.Comment #7
jonathan1055 commentedThe core patch for 8.4 and 8.3 is simple and allows the fixed Rules code to pass at 8.5, 8.4 and 8.3. I have posted a patch on #2883680-112: Force all route filters and route enhancers to be non-lazy but that issue is closed so I am not certain how much visibility it will get.
Comment #8
tr commentedThis not only affects Rules, but affects all modules which have a dependency on Rules. Most of my tests now fail because of this, even though those tests don't involve Rules - if you a have the dependency on Rules in your .info.yml the tests fail.
Bumping to Major because of this.
Comment #9
jonathan1055 commentedGiven that the new classes have not been committed to core 8.4 and 8.3 (and there is no movement or response to my patch in #112 of #2883680-112: Force all route filters and route enhancers to be non-lazy in the meantime we should be able to make the Rules tests pass by adding
@group legacyto the tests. I will make a patch for this and see how it goes.Comment #10
jonathan1055 commentedHere's a patch which add
@group legacyto 16 kernel test files and 4 functional test files. Each file has:This should allow the tests to pass at core 8.5, 8.4 and 8.3
Comment #11
jonathan1055 commentedGood, as expected Rules tests pass at 8.5, 8.4 and 8.3 with this patch. Travis build results are https://travis-ci.org/jonathan1055/rules/builds/304651753 and I will create a pull-request
I've raised #2924899: Backport \Routing\EnhancerInterface to core 8.4 to discuss the problem of how Rules can remove the deprecated code without creating a new code branch and separating 8.5 development from 8.4/8.3 (which is too big a burden just to get tests to pass)
Comment #12
tr commentedI have applied the patch and tested it locally, and it works to eliminate the deprecated failures in PHPUnit tests, both for the Rules codebase and for my own code which depends on Rules. Thanks you.
Critical, because this problem causes testing failures for ALL projects which depend upon Rules. Flag is the latest victim - just declaring a test_dependency on Rules in flag.info.yml has caused Flag branch testing to start failing with Drupal 8.5.x. Flag has almost as many D8 users as Rules does ...
I realize this is a problem caused entirely by Core declaring that newly @deprecated functions should immediately cause test failures for contrib, but as it has brought to a screeching halt all development in the Rules ecosystem, it's something we have to deal with now - it can't be postponed until Core changes its policy.
Curiously, Core is excluded from generating these failures on its own code, so while Core is riddled with @deprecated usage it manages to avoid all consequences of this ill-considered decision.
Comment #13
jonathan1055 commentedThanks for testing TR. I will make a Pull Request for the change later today. Hopefully @fago will be able to commit this soon, but I know he does not have much time to spend on Rules.
There is some good discussion from #56 on #2607260-56: [meta] Core deprecation message introduction, contrib testing etc. where deprecation failures should be shown as a artifact of the test results and not make them fail. I think that solution is ideal.
Comment #14
jonathan1055 commentedI have created a PR for this change: https://github.com/fago/rules/pull/497
Comment #15
jonathan1055 commentedNote, the patch in #10 and PR 497 are only the first step to fixing this. When committed (hopefully soon), the issue should remain open (and postponed) until 8.5 is released and 8.6.x-dev is available. Then we no longer need to test against 8.4 and can replace the deprecated code by using the patch in #5.
Comment #17
fagoThanks, I committed the patch from #10. Let's set this to needs work then, so we can address the legacy issues.
Comment #18
fagoSo we need to go through the 8.5 fails and fix the deprecation warnings there.
Comment #19
fagohttps://travis-ci.org/fago/rules works thanks to the legacy tag, when we remove those the deprecation warnings come up again.
Comment #20
jonathan1055 commentedIn #18 fago said:
My patch in #5 does this, and fixes the rules code, but it can only be committed for 8.5+
Our tests should be run at development (8.6) pre-release (8.5) and stable (8.4) so at the moment we cannot fix the Rules code because the new
EnhancerInterfaceis not available in core 8.4. We have to support the current stable release which is 8.4Setting this to postponed, and when the stable release is 8.5 and we no longer need to support 8.4 we use the patch in #5 and also revert the
@group legacychanges from patch #10/commit #16.Hope that's OK with you?
Jonathan
Comment #21
idebr commented8.5 is the current stable version, so this issue is no longer postponed.
The patch in this issue should also remove the
@group legacyannotation from the tests that was added before.Comment #22
tr commented@idebr: Can you supply a new patch?
Comment #23
jonathan1055 commentedJust for interest here is the same patch as from #5. I don't have the means at the moment to test this locally so it might not even apply any more.
Comment #25
tr commentedApparently the changes proposed in #5 (and #23) have already been committed as part of #2951263: With Rules enabled, page_manager pages return a 404 after core 8.5 update.
So I believe the only thing left, now that 8.5 is the 'stable' release, is to remove the
@group legacyannotation. Patch attached.Comment #26
jonathan1055 commentedThanks for spotting that. Yes, the commit is https://cgit.drupalcode.org/rules/commit/?id=d67f785 which does pretty much the same as patch #5
Setting back to 'normal' now that this is only removing the
@group legacycode. RTBC I think?Comment #27
jonathan1055 commentedThe tests at D8.5.5 were green, but they are not showing now. Sorry I changed to RTBC too early.
Comment #28
jonathan1055 commentedThe test fails are unrelated. Pass at 8.5 but fail at 8.6 and 8.7. We've had 2 test fails daily from 21 March 2018 up to 13 July. Then we've had 8 test fails daily since then. I cannot see any issue raised yet to deal with these test failures.
Comment #29
jonathan1055 commentedRaised #2989050: 'No reaction rule' message uses singular form in 8.5 but plural form in 8.6 for the test failures. I don't currently have the means to test code locally (unfortunately) so I can't investigate these errors and provide patches. But at least the issue exists now.
Comment #30
jonathan1055 commentedAlso added #2989417: Argument 1 passed to \EntityContext::fromEntity() must implement EntityInterface for the other test failures.
Removing the
@group legacyis RTBC as the failures above are unrelated. Thanks TR.Comment #32
tr commentedCommitted #25.
Comment #34
kristen polPer a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.
Comment #35
tr commentedComment #36
jonathan1055 commentedAdding to parent