Problem/Motivation

Spin off of #3515706: [CI] Switch the default test environment to PHP 8.4 and MySQL 8.4 .

Proposed resolution

Separate running PHPStan job on PHP 8.4 in this issue.

In the process, make PHPStan execute from the base project directory (that varies per run) instead of the fixed /build directory.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#36 3525031-nr-bot.txt1.35 KBneeds-review-queue-bot

Issue fork drupal-3525031

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Status: Active » Needs work

Updating the baseline seems ineffective.

andypost made their first commit to this issue’s fork.

mondrake’s picture

This is weird. It looks like CI is stashing the .phpstan-baseline.php file away, and using it instead of the one in the MR (see https://git.drupalcode.org/project/drupal/-/merge_requests/12150/diffs?c... that is emptying the MR's version of the file, still old report appears)

mondrake’s picture

Tried running locally, no errors.

mondrake’s picture

From some debugging, I'm inclined to think that somehow the composer steps are overwriting the MR content - just at the beginning of the job the bait file I placed is present, once we get to run PHPStan it's no longer there

mondrake’s picture

Priority: Normal » Critical
Status: Needs work » Needs review

The culprit is composer run-script drupal-phpunit-upgrade-check: that script leads to the baseline file from the MR being overwritten by the one in HEAD.

That is clearly visible here https://git.drupalcode.org/issue/drupal-3525031/-/jobs/5291184 where I made debug addition to report the datetime of the .phpstan-baseline.php file at various points of the script execution: the file is the MR's one until the execution of that script, and the HEAD one just afterwards.

At closer inspection, found that the the PHPUnit jobs work fine. There, the composer jobs are run on the GitLab project directory. So the problem is with moving the codebase to the /build directory BEFORE summoning composer.

Made changes so that the composer stuff is executed in the before_script section of the job and before moving the codebase to the /build directory, this now seems ok.

Bumping to critical because regardless of this issue, the buggy behaviour is in HEAD right now.

mondrake changed the visibility of the branch 3525031-cirun-phpstan-job-fix to hidden.

mondrake’s picture

Issue summary: View changes
andypost’s picture

Status: Needs review » Reviewed & tested by the community

RTBC as it's green, curious if other jobs also has broken order of dealing with codebase

from slack

...a problem with the sequence of the steps: composer was getting called after the codebase had been already moved to /build

that for some reason makes the update script override core with the HEAD version

that does not occur if you call composer on the gitlab project directory, as the phpunit jobs do

mondrake’s picture

mondrake’s picture

mondrake’s picture

Assigned: Unassigned » mondrake
Status: Reviewed & tested by the community » Needs work

Lint cache warming will not work proper with this, the cache would be taken from the wrong place. I think it's better go straight ahead and do what #3525143: [CI] Run PHPStan job in the GitLab project directory instead of /build would do. Doing it here so we can keep the status and history.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review
mondrake’s picture

Added comments across the entire script.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Lets do it, feedback for comments seems to be addressed.

mondrake’s picture

Issue summary: View changes

Updated IS because the problem is not an override of the code, but from where the job executes.

mondrake’s picture

Priority: Critical » Major

.. and it's not Critical. Maybe Major since we're in the middle of the river crossing from default PHP 8.3 to default PHP 8.4 for GitLab jobs.

mondrake’s picture

Status: Reviewed & tested by the community » Postponed
Related issues: +#3497431: Deprecate TestDiscovery test file scanning, use PHPUnit API instead
mondrake’s picture

Status: Postponed » Reviewed & tested by the community

Blocker is in. Rebased.

  • catch committed 1de2d93b on 11.2.x
    Issue #3525031 by mondrake, andypost: [CI] Run PHPStan job on PHP 8.4
    
    (...
catch’s picture

Version: 11.x-dev » 11.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 11.2.x, thanks!

mondrake’s picture

Status: Fixed » Reviewed & tested by the community

Seems wasn't pushed to 11.x

  • catch committed 0062329f on 11.x
    Issue #3525031 by mondrake, andypost: [CI] Run PHPStan job on PHP 8.4
    
catch’s picture

Status: Reviewed & tested by the community » Fixed

Needed to fetch locally..

catch’s picture

Status: Fixed » Active
Issue tags: +Needs followup

I think this broke PHP artifact caching, see the "Result cache not used" line on https://git.drupalcode.org/issue/drupal-3532871/-/jobs/5705047 - could we open a follow-up to run phpstan inside the build directory again?

mondrake’s picture

Can we try and make it work with latest approach instead of reverting to run on /build/?

This issue is enabling #3532407: [pp-upstream][CI] Stop post editing re-generated PHPStan baseline that would be a pity to lose.

mondrake’s picture

So the problem here is Relative path in ResultCache?

catch’s picture

@mondrake yes that's exactly the one - similar problems with cspell et al caches too.

mondrake’s picture

Drats! Tried having a look at the phpstan cache, definitely worse to try and manipulate that than keeping manipulating the baseline. So for the moment there's no alternative to running on /build/.

mondrake’s picture

Status: Active » Needs review

MR!12534 restores running the job from /build/; not sure about cache warming as I think it needs to be committed to verify

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.35 KB

The 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 necessarily 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.

mondrake’s picture

Status: Needs work » Needs review
Issue tags: -Needs followup
catch’s picture

not sure about cache warming as I think it needs to be committed to verify

Yes this is unfortunately true, it's very hard to test without a commit especially the build directory stuff. However as long as the main phpstan job is working fine the consequences of not fixing caching are that caching still doesn't work so fine to try it and check post-commit (which what I said I'd do in https://www.drupal.org/project/drupal/issues/3525031#mr12150-note518482 then forgot until 3/4 weeks later...)

larowlan’s picture

mondrake’s picture

Issue tags: +PHPUnit 11
smustgrave’s picture

Status: Needs review » Needs work

Appears to have some pipeline issues, should it be postponed on #3530453: Remove deprecated use of Assert::isType() seems to be addressing some of the same right?

mondrake’s picture

Status: Needs work » Needs review

Sorry I can't understand #40 - tests are green and the comment seems not related to this issue. Can you elaborate please?

smustgrave’s picture

My mistake think I had another MR open for 8.4 that wasn't this, sorry for the noise.

mondrake’s picture

Status: Needs review » Fixed

Discussed this issue status in Slack, https://drupal.slack.com/archives/C079NQPQUEN/p1752837466231169

Return this to Fixed as it was before reopening. PHPStan is already running on PHP 8.4 as part of separate issue, so I will file a separate issue for the follow-up currently open.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.