Problem/Motivation
Motivation is the problem indeed: it's extremely demotivating when trying to fix a hard issue the testbot refuses to work because of a missing space. There is ample time before a commit to fix a space or a missing "Interface for context" doxygen on ContextInterface because that truly is very important.
In https://www.drupal.org/project/drupal/issues/3178845#comment-13894210
Making "Custom commands failed" actually raise a fail and mark the issue NW would be a Drupal infrastructure followup to this issue, I think.
But that discussion never happened and commit-code-check.sh was added with halt-on-fail: true
Steps to reproduce
Try to contribute to core, lose will to live.
Proposed resolution
Just test my patches, mkay?
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3364512_5.patch | 577 bytes | ghost of drupal past |
| #7 | 3364512_7.patch | 1 KB | ghost of drupal past |
| #11 | 3364512-nr-bot.txt | 1.58 KB | needs-review-queue-bot |
| #22 | 3364512-21.patch | 1.41 KB | smustgrave |
Comments
Comment #2
ghost of drupal pastComment #3
xmacinfoI agree 100%. Don't block innovation over a missing space.
Comment #4
wim leers+1
In practice, almost no patch gets committed without a round of review anyway. So there’s very little risk of coding standards violations to get committed. (It’d fail CI anyway, just not as early.)
I suspect part of the reason is CI cost: save expensive CPU time for patches that could be green. But does this really save time & money? 🤔 Because … just to get to the point of running
phpcstakes ~5 minutes (a lot of Docker activity before then!).phpcsthen takes seconds, sometimes a minute. If we fail at that time, like we do today, the overhead is the overwhelming majority.Worse: this means the only thing a contributor can fix is … coding standards. Because that’s the only information you get. So the current setup often results in netmore CPU time than if
phpcsdidn’t havehalt-on-fail: true!Comment #5
ghost of drupal pastComment #6
lauriiiI'm wondering what does DrupalCI output now when there are coding standard violations? Also how does it report if there are coding standard violations and test failures?
Comment #7
ghost of drupal pastExcellent question, let's try.
Edit: this, alas, means the report does not include failures , you can see in the plain text output https://dispatcher.drupalci.org/job/drupal_patches/185609/consoleText there was one.
So fixing this is not a trivial matter :( :( :(
Comment #8
smustgrave commentedMoving to NW assuming #7 was suppose to fail.
Comment #9
ghost of drupal pastSorry but no, this still needs review by core committers and I suspect the DA as well then we can see what we need to do to DrupalCI to make this fail. Eventually it'll be CNW but that'll be in a different issue queue.
Comment #10
longwaveFrom past conversations with the DA I believe there is no capacity to make changes to DrupalCI to support this or any other feature requests, and instead we should look to implementing it when we switch to GitLab CI.
Comment #11
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #12
nod_And in the meantime we have the needs review queue bot to pick up some of this.
Excluding this issue for the bot, since what we need is discussion, not more bots getting in the way :)
Comment #13
ghost of drupal pastWait a second, wasn't that very useful? This means we could commit the patch as is if we wanted and while the checks won't show the phpstan fail , the bot eventually will. It's not like RTBC patches get in within hours.
Comment #14
longwaveSometimes patches do get in quickly when they are critical, or core committers are working together. I'd really prefer not to have false-positive green test runs on something that has actually failed checks.
Comment #15
smustgrave commentedIs the goal to be able to run tests with phpcs errors?
If that's the case wouldn't the issue still need to have those fixed before it can be marked RTBC. Resulting in needing to run the tests again couldn't that be costly?
Comment #16
nod_The problem with the needs review queue bot is that it's not a reliable service. It runs on a laptop behind the TV of a relative's house and there are a few limitations on what it can do today with regard to selecting patches to tests, running against specific branches, how frequently it runs because we need to use d.o api responsibly, etc. It's all solvable with some time but it's not time I have at the moment.
I do see the value of having the code style gate not being a blocker to running the tests. Overall most of the linting stuff is easy to fix, spacing, permissions, etc. so that would make sense to assume that it'll be easy to fix at any point and now "slow down" patches for that. There are a few eslint rules that are not easy to get rid off if eslint complaints but we could say it's non-blocking only for phpcs stuff and a specific subset of eslint rules.
If we're doing a wishlist it could make sense to not halt test runs on lint failures for NR issues but fail test runs for RTBC issues (since by that point the patches should be in a ready to commit state)
@longwave if core committers are involved and the patch is critical, everything that is non blocking would still be run in the pre-commit hook no?
Comment #17
smustgrave commentedFor me I’m kind of 50/50.
If you’re rock n rolling with an issue and want to test how it’s going you don’t want to be delayed by phpcs issues.
But if we run tests for phpcs issues we still would have to run with them fixed. So double the resources right? Could that be noticeably more costly?
Comment #18
ghost of drupal pastIt won't be double the resources, no, such minutiae can be fixed ongoing. A complex enough patch will need many rounds anyways.
What we have here is: submit patch, schedule a check back in an hour or so just to find the patch was not tested. Often over the lack of absolutely unnecessary doxygen which makes it doubly infuriating. There's already an issue over dropping some of that but it's a long way off before we don't need to add any fluff. https://www.drupal.org/project/coding_standards/issues/3238192#comment-1...
Comment #19
smustgrave commentedSo should this be moved over to the gitlab queue if we aren't going to add here?
Comment #20
longwaveIs there a way of just running the checks after the tests? Then we could keep halt-on-fail, but the tests would fail first?
Comment #21
smustgrave commentedMoved the check to the bottom. Guessing that could matter?
Comment #22
smustgrave commentedI messed up indentation. Lets try again.
Comment #23
xmacinfoStill, should it be?
Comment #24
smustgrave commentedNo then it would show green even though there were phpcs errors I believe.
But #22 shows it ran the tests but still failed. Not sure why it's aborted but that's promising I think?
Comment #25
longwaveThis doesn't appear to have worked due to unintended side effects, see https://dispatcher.drupalci.org/job/drupal_patches/187500/consoleFull
The tests create a bunch of output that is useful for debugging. But running the checks after the tests means that this output is considered as changes to the repo, and so the files are spellchecked/linted/etc. The clues are:
Then a huge number of PHPStan failures, and then it starts checking Nightwatch's CSS output:
Finally this all seems to take too long (it is analysing Bootstrap JS), and times out:
Comment #26
quietone commentedComment #27
catchHadn't seen this issue but have an MR up to run unit tests (but not everything else) if phpcs fails on gitlab. It would be a YAML change to allow unit + kernel but not everything else too.
Comment #28
quietone commentedThanks catch, I intended to relate to that issue but mucked it up.
Comment #29
catch[#https://www.drupal.org/project/drupal/issues/3386076] now runs phpunit and kernel tests if cs/phpstan etc. fails, but blocks functional etc. I think that's a good compromise between fast feedback and wasted test runs on typos for otherwise ready patches, so going to close this as duplicate.