Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Result cache not used because the metadata do not match" reported on every CI build. #4542

Closed
bfoosness opened this issue Feb 16, 2021 · 7 comments

Comments

@bfoosness
Copy link

Bug report

phpstan/phpstan-src@f11c0f0 (originally discussed on #4495 (comment)) means that changes to /vendor/composer/installed.php can now invalidate the result cache.

Running composer install after HEAD has changed causes this file to be regenerated even when composer.lock has not changed because HEAD's SHA-1 hash is written to /vendor/composer/installed.php:

<?php return array (
  'root' =>
  array (
    'pretty_version' => 'dev-master',
    'version' => 'dev-master',
    'aliases' =>
    array (
    ),
    'reference' => 'b7dc13834d2087ddf8aec8b792b9fcc36880940f', // <----- HEAD's SHA-1
    'name' => '__root__',
),

This is particularly evident in a CI build process where composer.install is being run every time. In practice, we are seeing every build report "Result cache not used because the metadata do not match" even though our Composer dependencies (composer.lock) are not changing. Is there a workaround for this issue? Or an alternate solution to solve the original issue that doesn't so aggressively invalidate the cache?

Thank you in advance, and thank you for creating this wonderful tool!

@mergeable
Copy link

mergeable bot commented Feb 16, 2021

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@bfoosness
Copy link
Author

To add to this, the referenced change was released in 0.12.72 and downgrading to 0.12.71 fixes the issue as expected.

@ondrejmirtes
Copy link
Member

Fixed, thank you! phpstan/phpstan-src@6367eb6

@bfoosness
Copy link
Author

Thank you, @ondrejmirtes. I should have mentioned that the SHA-1 hash is also stored at $installed['versions']['__root__'] in vendor/composer/installed.php. Once that's added, this solution works out nicely. Thanks again!

@ondrejmirtes
Copy link
Member

Fixed in master, thanks.

@bfoosness
Copy link
Author

I confirmed that updating to master solved this issue for us. Thank you!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants