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

[WIP] Command to interactively generate a minimal reproduce case for solver bugs #8100

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

naderman
Copy link
Member

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.

@alcohol
Copy link
Member

alcohol commented Apr 15, 2019

So similar to git-bisect sort of?

@naderman
Copy link
Member Author

Yes that's the idea in a way :-)

)
);

$this->composerDef['repositories']['packagist.org'] = false;
Copy link
Contributor

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);
Copy link
Contributor

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']])) {
Copy link
Contributor

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 and b/replaced, while b/replaced comes from a higher-priority repo ? Is it the same than if they come from the same repo ?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants