-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Composer versioning uses stability modifiers incorrectly #24993
Comments
Since stability flag is not a valid version but a constraint should I investigate moving this to be handled at composer manager instead? |
I suspect all changes need to be in composer versioning. For example versioning is what determines if a value is a version or a range, or whether a version satisfies a range, etc. |
If you fix and add to the unit tests for composer versioning then you might find that the rest simply works |
@rarkins I see in tests Would it be acceptable for me to declare tests as follows describe('Only stable|RC|beta|alpha|dev are valid as stability flag', () => {
it.each`
version | expected
${'~1.2.3@dev'} | ${true}
${'~1.2.3@dev1'} | ${false}
${'~1.2.3@alpha'} | ${true}
${'~1.2.3@alpha1'} | ${false}
${'~1.2.3@beta'} | ${true}
${'~1.2.3@beta1'} | ${false}
${'~1.2.3@rc'} | ${true}
${'~1.2.3@rc1'} | ${false}
${'~1.2.3@stable'} | ${true}
${'~1.2.3@stable1'} | ${false}
${'~1.2.3@'} | ${false}
${'~1.2.3@patch'} | ${false}
${'~1.2.3@p'} | ${false}
${'~1.2.3-beta@rc'} | ${true}
${'~1.2.3-rc1@beta'} | ${true}
${'~1.2.3@RC'} | ${true}
${'~1.2.3@BETA'} | ${true}
`('isValid("$version") === $expected', ({ version, expected }) => {
const res = !!semver.isValid(version);
expect(res).toBe(expected);
});
}); Or should I just fold those into existing test with no extra description? |
You are definitely welcome to improve the amount of documentation for such tests through describe! |
Should I handle stability flags and normalization for version variations supported by composer as separate PRs? |
Up to you. Generally smaller is better, if it pesky take too much time |
Digging through Composer source I discovered that I was wrong but in a weirder way. Stability flags are processed for a root package dependencies. At this level stability flags are applied to repositories - composer analog for datasource - to filter out stabilities lower than minimum stability. This is before remaining versions are passed through constraint matching.
When stability flag or several are present then the lowest flag is used as minimum stability for that package. Root-only option minimum-stability has no effect for that package. Stability flags also affect parsed constraints but in inconsistent manner. See composer/semver#154
There is a strange effect that I would need to confirm with composer maintainers as intentional: Some of this affects renovate and some of it does not. Now I need to figure what is relevant here. |
Discussed in #24989
Originally posted by Xerkus October 3, 2023
How are you running Renovate?
Mend Renovate hosted app on github.com
If you're self-hosting Renovate, tell us what version of Renovate you run.
No response
If you're self-hosting Renovate, select which platform you are using.
None
Was this something which used to work for you, and then stopped?
I am trying to get this working for the first time
Describe the problem
Renovate incorrectly assumes stability flags to be equal to stability suffixes in the version, eg
1.2.3@RC1
to be equal to1.2.3-rc1
Part of version normalization:
renovate/lib/modules/versioning/composer/index.ts
Lines 46 to 62 in 6f4c389
And as seen in tests:
renovate/lib/modules/versioning/composer/index.spec.ts
Lines 28 to 38 in 0da50b5
There are three things wrong here:
1.2.3@RC
is a range, equivalent to>=1.2.3-rc <1.2.4
. Tag datasource with tag1.2.3@RC
will likely produce invalid result if I read the renovate code right.stable
, composer entirely disregards stability flag. Constraint1.2.3-alpha@RC
is equivalent to1.2.3@alpha
stable
,RC
,alpha
,beta
ordev
with no numerical suffixes allowed.1.2.3@RC1
is invalid and composer won't parse it.I discovered this while looking for other non-canonical formats that are supported by composer but not renovate. Eg
1.2.3RC1
or1.2.3a1
. I would like to provide implementation for same version normalization as used by composer and fix this bug as well.No reproduction needed:
Relevant debug logs
No response
Have you created a minimal reproduction repository?
I have explained in the description why a minimal reproduction is impossible
The text was updated successfully, but these errors were encountered: