Skip to content

Use an actually invalid version for test#6536

Merged
jeffwidman merged 1 commit intomainfrom
use-actual-invalid-version-for-test
Jan 29, 2023
Merged

Use an actually invalid version for test#6536
jeffwidman merged 1 commit intomainfrom
use-actual-invalid-version-for-test

Conversation

@jeffwidman
Copy link
Copy Markdown
Member

The previous string "^3.0|4.1.x-dev as 3.0.0" isn't actually an invalid version... because 4.1.x-dev can technically be an exact version number.

However, this passed unit tests just fine due to an upstream bug in composer which was fixed in composer/composer#11086 / composer/composer@8618f00. So when we upgrade to a newer version of composer that includes this fix, the test will start failing.

On composer 2.4.1, the version string "^3.0|4.1.x-dev as 3.0.0" throws:

{"error":"Invalid version string \"^3.0|4.1.x-dev\" in \"^3.0|4.1.x-dev as 3.0.0\", the alias source must be an exact version, if it is a branch name you should prefix it with dev-"}

Compare with 2.5.1, where it parses that as a valid version string, and then fails because we're currently running php 7.4:

{"error":"Your requirements could not be resolved to an installable set of packages.\n  Problem 1\n    - monolog\/monolog dev-main requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.\n    - monolog\/monolog 3.x-dev is an alias of monolog\/monolog dev-main and thus requires it to be installed too.\n    - Root composer.json requires monolog\/monolog ^3.0|4.1.x-dev as 3.0.0 -> satisfiable by monolog\/monolog[3.0.0-RC1, ..., 3.x-dev (alias of dev-main)].\n"}

I double-checked with the upstream composer team in composer/composer#11282 and they confirmed our test fixture is incorrect.

The previous string `"^3.0|4.1.x-dev as 3.0.0"` isn't actually an invalid version... because `4.1.x-dev` can technically be an exact version number.

However, this passed unit tests just fine due to an upstream bug in `composer` which was fixed in composer/composer#11086 / composer/composer@8618f00. So when we upgrade to a newer version of `composer` that includes this fix, the test will start failing.

On composer `2.4.1`, the version string `"^3.0|4.1.x-dev as 3.0.0"` throws:
```
{"error":"Invalid version string \"^3.0|4.1.x-dev\" in \"^3.0|4.1.x-dev as 3.0.0\", the alias source must be an exact version, if it is a branch name you should prefix it with dev-"}
```
Compare with `2.5.1`, where it parses that as a valid version string, and then fails because we're currently running `php` `7.4`:
```
{"error":"Your requirements could not be resolved to an installable set of packages.\n  Problem 1\n    - monolog\/monolog dev-main requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.\n    - monolog\/monolog 3.x-dev is an alias of monolog\/monolog dev-main and thus requires it to be installed too.\n    - Root composer.json requires monolog\/monolog ^3.0|4.1.x-dev as 3.0.0 -> satisfiable by monolog\/monolog[3.0.0-RC1, ..., 3.x-dev (alias of dev-main)].\n"}
```

I double-checked with the upstream `composer` team in composer/composer#11282 and they [confirmed this behavior](composer/composer#11282 (comment)).
@jeffwidman jeffwidman requested a review from a team as a code owner January 29, 2023 07:07
@jeffwidman
Copy link
Copy Markdown
Member Author

I broke this out separate from #6385 because while that uncovered this issue, it's not tied-together... we should be fixing this regardless... ie, if we run into any unexpected issues with that composer bump and have to revert, we don't want to revert this.

@jeffwidman jeffwidman changed the title Use a guaranteed invalid version for test Use an actually invalid version for test Jan 29, 2023
@jeffwidman jeffwidman merged commit 7bf5e7f into main Jan 29, 2023
@jeffwidman jeffwidman deleted the use-actual-invalid-version-for-test branch January 29, 2023 19:12
alcere pushed a commit that referenced this pull request Feb 20, 2023
The previous string `"^3.0|4.1.x-dev as 3.0.0"` isn't actually an invalid version... because `4.1.x-dev` can technically be an exact version number.

However, this passed unit tests just fine due to an upstream bug in `composer` which was fixed in composer/composer#11086 / composer/composer@8618f00. So when we upgrade to a newer version of `composer` that includes this fix, the test will start failing.

On composer `2.4.1`, the version string `"^3.0|4.1.x-dev as 3.0.0"` throws:
```
{"error":"Invalid version string \"^3.0|4.1.x-dev\" in \"^3.0|4.1.x-dev as 3.0.0\", the alias source must be an exact version, if it is a branch name you should prefix it with dev-"}
```
Compare with `2.5.1`, where it parses that as a valid version string, and then fails because we're currently running `php` `7.4`:
```
{"error":"Your requirements could not be resolved to an installable set of packages.\n  Problem 1\n    - monolog\/monolog dev-main requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.\n    - monolog\/monolog 3.x-dev is an alias of monolog\/monolog dev-main and thus requires it to be installed too.\n    - Root composer.json requires monolog\/monolog ^3.0|4.1.x-dev as 3.0.0 -> satisfiable by monolog\/monolog[3.0.0-RC1, ..., 3.x-dev (alias of dev-main)].\n"}
```

I double-checked with the upstream `composer` team in composer/composer#11282 and they [confirmed this behavior](composer/composer#11282 (comment)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants