microsoft / microsoft/typespec
[Bug]: bumpVersionsForPrerelease() rolls back instead of forward, if a commit is reverted
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Describe the bug
If a commit to a package is rolled back, the package will fail to publish, and the next change to the spec will also fail to publish, due to how the version numbers are calculated.
One "fix" could be that we need to be disciplined to **never** revert the changelogs under `.chronus/changes`. If you need to `git revert` a previous commit, you'll still need to **add** a new changelog, and leave the previous changelog present. Perhaps some team members already knew this, but I did not.
### Reproduction
1. Add a commit to change a package (with a changelog under `.chronus/changes`)
2. The dev version of the package should be incremented (from say `1.0.0-dev.1` to `1.0.0-dev.2`), and the package should be published
3. Revert the commit in step #1
Expected: Dev version of the package should be incremented again, and the package should be published
Actual: Since the log under `.chronus/changes` was also reverted, the dev version was rolled back to `1.0.0-dev.1`, and the package could not be published since it already exists.
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Contributor guide
Assessment
This issue has not been assessed yet.