-
Notifications
You must be signed in to change notification settings - Fork 824
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
FIX use composer runtime api #11157
FIX use composer runtime api #11157
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts:
- Test failures :(
- We should look to remove the code that manually parses
composer.lock
. We already implicitly requirecomposer-runtime-api: ^2
(viasilverstripe/vendor-plugin
), so we know that the runtime API will be available - We should explicitly require
composer-runtime-api
incomposer.json
- It’d be worth testing the performance overhead of the runtime API (it looks like it’ll be very minimal) and seeing if we can remove our caching. There’s nothing inherently brittle about the caching we have in place, but less code to maintain is less code to maintain 😄
seems harder than expected, i only did some quick tests on my local project and it seemed to work at first glance but obviously the return values are not the ones expected in the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly an echo of KingLozzer's review:
This will at a very minimum need the broken tests updated match the new functionality. We don't need as much test coverage with the composer runtime API since we can trust it to give us the correct versions, but we do need some (non-failing) test coverage.
I agree that we should aim to remove the composer.lock
related functionality. Please:
- deprecate the
getComposerLock()
method - add
composer-runtime-api
as an explicit dependency (we can do this in minor releases, which this should be targetting) - Remove the
if (class_exists(\Composer\InstalledVersions::class)) {
conditional statement since this will always evaluate as true, and remove the code that won't be reached
Please target the 5
branch and add a changelog entry for this change.
Also please don't tick boxes in the checkbox that aren't correct. i.e. "CI is green" was ticked but CI is very obviously not green 😅 |
The current tests are basically feeding in dummy composer.lock files (or content, haven't actually looked at them this is from memory), which obviously won't affect the composer runtime API. |
Co-authored-by: Guy Sartorelli <[email protected]>
Co-authored-by: Guy Sartorelli <[email protected]>
Co-authored-by: Guy Sartorelli <[email protected]>
Co-authored-by: Guy Sartorelli <[email protected]>
yes, that's exactly why it fails |
from what i see, it prevents loading the installed.php file which is a 2k line array. Not sure what is faster, instantiating a cache interface then get/set value from it or read a 2k array that is going to be opcached anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are passing and works well locally. Just needs a changelog entry, but that's obviously a separate PR to silverstripe/developer-docs
@kinglozzer do you want any further changes? I agree that removing the caching would be ideal but it's also not really a problem if it stays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change, otherwise good to go I think. Thanks @lekoala
i've also deleted the fixtures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic, thank you!
Please don't forget to open a PR to silverstripe/developer-docs to add a quick note to the 5.2.0 changelog.
Description
VersionProvider has to store in cache the composer lock file when it could simply use the composer runtime api to get the same information
Also fixes return types for array, fix irrelevant ?? checks (that are done on false, they only apply to null values)
Issues
#11134
Pull request checklist