-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[WIP] Command to interactively generate a minimal reproduce case for solver bugs #8100
base: main
Are you sure you want to change the base?
Conversation
So similar to git-bisect sort of? |
Yes that's the idea in a way :-) |
) | ||
); | ||
|
||
$this->composerDef['repositories']['packagist.org'] = false; |
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 should probably be this->composerDef['repositories'] = array('packagist.org' => false);
actually, to remove any existing custom repository too.
Also, this might be an issue in case the global composer config contains some repository definitions.
); | ||
|
||
$this->composerDef['repositories']['packagist.org'] = false; | ||
$this->json->write($this->composerDef); |
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.
As we override the composer.json of the project, we should probably start with a warning that this command should be run only when that's fine for you (dedicated folder that will be dropped after that, or folder using a VCS to allow reverting changes after that).
} | ||
|
||
private function addRepositoryToJson(array $versionData) { | ||
if (!isset($this->composerDef['repositories'][$versionData['name']])) { |
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.
As the order of repositories is important (the same package provided in multiple repositories will be selected from the highest-priority one, with a slightly different behavior between 1.x and 2.x IIRC), should we generate one repository per package or one repository per original repo ?
The current approach (one repository per package name) has 2 drawbacks IMO:
- we loose the repo priority in case multiple original repositories provide the package name
- we introduce new repo priority, which might have an impact when a package replaces another one (what happens if you require
a/replacer
andb/replaced
, whileb/replaced
comes from a higher-priority repo ? Is it the same than if they come from the same repo ?)
Pretty rough, helps as-is, but before we actually ship this to anyone needs to be cleaned up a lot. The idea is that this first moves all data into composer.json directly to remove all reliance on network. It then attempts to reduce the data step by step and keeps checking if the bug in question can still be reproduced. For now it does that by asking interactively, so you can run a composer command and manually check. Ideally this would actually take an executable string as an argument which would exit 0 or non-zero depending on whether the bug is there to automate the process.