Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 304
fix: properly bump versions between prereleases#799
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
codecovbot commented Jul 27, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@## master #799 +/- ## ========================================== - Coverage 97.33% 96.59% -0.75% ========================================== Files 42 55 +13 Lines 2104 2379 +275 ========================================== + Hits 2048 2298 +250 - Misses 56 81 +25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Lee-W commented Jul 29, 2023
This might not be the behavior we want. May I know why you want commitizen to behave this way? |
woile commented Jul 30, 2023
Could you update this list with more samples from this PR? https://github.com/commitizen-tools/commitizen/blob/master/tests/test_version_scheme_pep440.py @Lee-W the discussion in #688 talks about this change (if I understand correctly) |
jenstroeger commented Aug 2, 2023
Lee-W commented Aug 7, 2023
Sounds good 👍 |
Lee-W commented Aug 7, 2023
@eduardocardoso Could you please rebase from the main branch? I'll take a deeper look this or next week. Thanks! |
rgarrigue commented Oct 24, 2023
Hi. We'd be quite interested in this fix. Is it possible to push it forward if @eduardocardoso can't ? |
jenstroeger commented Oct 26, 2023
@rgarrigue I talked with Eduardo and he’s busy; I can take a look at this next week? |
rgarrigue commented Oct 27, 2023
Would be cool, thanks ! |
WarKaa commented Oct 31, 2023
+1 Is it scheduled for release soon? |
jenstroeger commented Oct 31, 2023
@WarKaa I’ll noodle on the PR tomorrow… |
c68a231 to 8522b8cComparejenstroeger commented Nov 3, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Did you take a look at the discussion in issue #688, and are you ok with the approach?
I rebased the PR on today’s main branch (commit e9647c7).
You mean you’d like me to add a few more scenarios/examples to one of the lists of test cases? Things left to do:
|
woile commented Nov 3, 2023
Yes, to model all the new behavior on this pr 👍🏻 |
jenstroeger commented Nov 6, 2023
@Lee-W@woile I noticed this test case:
which I think isn’t right: if the current version is Similarly here:
where I expected Unfortunately, I didn’t find details on this problem over at the discussions for semver or conventional commits, so we can either raise that discussion or improvise. Intuitively, though, I think the above tests should be “fixed”? |
woile commented Nov 6, 2023
My understanding is that a release candidate can still receive patches and fixes until it's ready, even breaking changes. That's why you'd go from For example, the popular bootstrap does something like this. see releases ![]() Same for axum (a popular rust web framework), see releases |
jenstroeger commented Nov 6, 2023
Neither of them uses conventional commits and actually computes the next release string from a given tag and commit range. Both kinda make things up manually.
Let’s look at this from another angle: we have a final release version Now suppose we want to publish a release candidate with every commit. Thus, we should see the following: So with every release candidate we need to take into account the history since the last final release (which is what this PR actually does here). Which also means that the above test
is somewhat meaningless because we don’t know the history since the last final release version. |
woile commented Nov 6, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Both use semver
If you are in Help me understand, and let’s look at this from another angle again. As a user, I want to start releasing candidates for my next major version:
Could you list the versions until we make stable |
woile commented Nov 6, 2023
![]() btw this is docusaurus using semver and cc |
noirbizarre commented Nov 6, 2023
Note: Cf.
It doesn't mean that is use case doesn't need to be discussed, but that you can already customize it (while we need to agree on how this PR and behavior should be handled). It initially wasn't meant to, but this is the beauty of making things extensible: you don't know what will come from the community with those extensions. Here's a perfect illustration. |
noirbizarre commented Nov 6, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I did and I even linked the answer in my previous response, there 👇🏼
As I said, I have no issue with your workflow, I have an issue with making it the nominal behavior. Same as I would have an issue with making the "prevent feature commit on pre-release" the nominal behavior. Both are something which are tied to teams' usage and expectations. |
noirbizarre left a comment
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.
After review, I am OK with it (except for a few nitpicky naming suggestions 👇🏼), tests are passing, no changes for existings 👍🏼
commitizen/version_schemes.py Outdated
| current_semver=".".join(str(part) forpartinrelease) | ||
| ifbase==current_semver: |
noirbizarreNov 7, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
To keep the same naming convention (and try to contain semver wording to the version scheme implementation)
| current_semver=".".join(str(part) forpartinrelease) | |
| ifbase==current_semver: | |
| current_base=".".join(str(part) forpartinrelease) | |
| ifbase==current_base: |
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.
Commit 9da9302.
| commit_args.append("--no-verify") | ||
| return" ".join(commit_args) | ||
| deffind_previous_final_version( |
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.
Good API addition 👍🏼
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.
We should probably rename the function to find_base_version() because “base version” seems to be the term used in other places.
commitizen/commands/bump.py Outdated
| semver=last_final.increment_base( | ||
| increment=increment, force_bump=True | ||
| ) | ||
| ifsemver!=current_version.base_version: |
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.
To keep the same naming convention (and try to contain semver wording to the version scheme implementation)
| semver=last_final.increment_base( | |
| increment=increment, force_bump=True | |
| ) | |
| ifsemver!=current_version.base_version: | |
| base=last_final.increment_base( | |
| increment=increment, force_bump=True | |
| ) | |
| ifbase!=current_version.base_version: |
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.
Commit 9da9302.
woile commented Nov 8, 2023
Hey @jenstroeger don't take it wrong, but I still have trouble understanding your comment on this particular case, why should it be removed? what is wrong with it?
I follow the logic of your other examples, but they are always for non-breaking changes. And you said this test case is irrelevant. But this test case, would be for a breaking change, how would the logic be? If my understanding is correct, from any given version This is how I think about the problem graph LR; a[1.9.0]-->d[major: 2.0.0rc0] a[1.9.0]-->c[minor: 1.10.0rc0] a[1.9.0]-->b[patch: 1.9.1rc0] d --> e[major: 2.0.0rc1] c --> e c --> f[minor: 1.10.0rc1] b --> e b --> g[patch: 1.9.1rc1] b --> f e --> f1[2.0.0] f --> f1 f --> f2[1.10.0] g --> f1 g --> f2 g --> f3[1.9.1] And from Apologies again for my struggle 😅 🙏🏻 |
jenstroeger commented Nov 12, 2023
Hi @woile — no worries, it’s great we have these discussions to clarify how
Looking at your graph, I think I see what you’re saying: if my current pre-release tag is
That makes sense 👍🏼 With that in mind, the test case
tells us that between the last final release and this pre-release there was one commit (because the
Also, I think it makes a lot of sense to keep the pre-release increment counting up every time, for example if I’m at |
woile commented Nov 13, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
jenstroeger commented Nov 13, 2023
jenstroeger commented Nov 14, 2023
I added a bunch of tests and had to refactor some code: There’s one more open issue with the following tests: (("3.1.4", None, "alpha", 0, None), "3.1.4a0"), # No pump, just adding the pre-release suffix. (("3.1.4a0", "PATCH", "alpha", 0, None), "3.1.4a1"), # UNEXPECTED! (("3.1.4a0", "MINOR", "alpha", 0, None), "3.2.0a0"), (("3.1.4a0", "MAJOR", "alpha", 0, None), "4.0.0a0"),These tests pass. So here we have a final version I can push my changes for discussion, if it helps? |
9da9302 to b16bcbeComparejenstroeger commented Nov 27, 2023
@woile@noirbizarre sorry for the delay: I didn’t receive an email notification for the 👍🏼 on the message. Anyway, I pushed my local updates which contain:
Please do take a close look at the code and the current behavior, and let me know what you think. At this point, I believe that pre-release bumping must take into account the last base version and not just the current tag. |
woile commented Nov 27, 2023
Regarding #800 I think you can pull it in this one as well |
jenstroeger commented Nov 27, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Yes I agree. I need to check, but also we should make sure that final published versions contain the full changelog since the last final published version — not just the changelog since the last tag (which can be any one of the pre-releases). But we still need to discuss this particular case which misses a patch bump: (("3.1.4", None, "alpha", 0, None), "3.1.4a0"), # No pump, just adding the pre-release suffix. (("3.1.4a0", "PATCH", "alpha", 0, None), "3.1.4a1"), # UNEXPECTED! |
noirbizarre commented Dec 4, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Good to me, agreed on base version precedence over the tag (can't be otherwise if we want to be able to collapse pre-release on the stable release). For the (("3.1.4a0", "PATCH", "alpha", 0, None), "3.1.5a0"),But I don't have a strong opinion on this because to me this call is an edge case. I consider IRL this case needs to be safeguarded by a process decided projects maintainers: either you are in a stabilization phase where you increment a prerelease number, either you have published the stable version and you are doing a patch. |
b16bcbe to 7b4596aComparejenstroeger commented Dec 11, 2023
I rebased the PR, merged the changes from #800, and updated the documentation. To address the following unexpected behavior: (("3.1.4", None, "alpha", 0, None), "3.1.4a0"), # No pump, just adding the pre-release suffix. (("3.1.4a0", "PATCH", "alpha", 0, None), "3.1.4a1"), # UNEXPECTED!I think we can’t uphold the assumption that a bump is always context free. Instead, a bump needs to take into account the previous history back to the most recent final release. (@woile that changes our previous conversation in this comment.) I’ll have to check. |
woile commented Dec 25, 2023
I'll take a last look after holidays and merge |
jenstroeger commented Jan 8, 2024
No worries. Only point for discussion would be the unexpected behavior mentioned above. |
chadrik commented Jan 30, 2024
This looks great. Would love to see this merged soon! |


Description
Properly bump version numbers between prereleases respecting the commit messages bump levels.
Checklist
./scripts/formatand./scripts/testlocally to ensure this change passes linter check and testExpected behavior
Bump command should bump the version number according to the commit messages since the last final version when bumping between prereleases.
Steps to Test This Pull Request
start at version 0.1.0
0.1.1a00.2.0a0instead of0.1.1a1Additional context
#688