[BUG] `salt.version.SaltStackVersion.current_release()` returns previous release, not upcoming release, on master checkout
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
When developing a new feature for Salt on a recent checkout of the master branch, I expect salt.version.SaltStackVersion.current_release() to return the version of Salt that is in development (the upcoming release). Instead, it returns a historic, already released version. At the very least, it should return a version that is greater than or equal to salt.version.__saltstack_version__.
This matters for salt.utils.versions.warn_until(): If SaltStackVersion.current_release() always matches a past release instead of the upcoming release, then the act of creating a new Git tag can change Salt's behavior in severe ways (warnings turned into errors). Due to the lateness in the development cycle of the behavior change, it is unlikely to be thoroughly tested before the new release is published.
This also matters when developing a feature that is gated by Salt version; see https://github.com/saltstack/salt/pull/62932#issuecomment-1292723656 for a specific example.
Steps to Reproduce the behavior
>>> import salt.version
>>> import salt.utils.versions
>>> salt.version__saltstack_version__
<SaltStackVersion name='Phosphorus' major=3005 minor=1 noc=922 sha=g93f871df58>
>>> salt.version.SaltStackVersion.current_release()
<SaltStackVersion name='Phosphorus' major=3005>
>>> salt.utils.versions.warn_until((3006, 0), "testing")
<stdin>:1: DeprecationWarning: testing
Expected behavior
>>> import salt.version
>>> import salt.utils.versions
>>> salt.version__saltstack_version__
<SaltStackVersion name='Phosphorus' major=3005 minor=1 noc=922 sha=g93f871df58>
>>> salt.version.SaltStackVersion.current_release()
<SaltStackVersion major=3006>
>>> salt.utils.versions.warn_until((3006, 0), "testing")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "salt/utils/versions.py", line 144, in warn_until
raise RuntimeError(
RuntimeError: The warning triggered on filename '<stdin>', line number 1, is supposed to be shown until version 3006.0 is released. Current version is now 3006.0. Please remove the warning.
Additional context
Interestingly, current_release() initially returns the upcoming release:
It is forcibly changed to return the previous release later on:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/version.py, especially the current_release() logic referenced around lines 199-205 and 649-654. Reproduce the issue with the Python examples in the report and trace why the master checkout is forced to the previous release. Done means current_release() reports the upcoming version and warn_until() no longer treats the warning as active at that version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100