Skip to content

Commit 829ad11

Browse files
fix: sync _version.py to 0.15.4, and guard the pair (#39)
`#38` bumped `pyproject.toml` to 0.15.4 but left `src/sonilo/_version.py` on 0.15.3. `__version__` ships as the `x-sonilo-client-version` header, so a 0.15.4 release would have had every client on it identify itself as 0.15.3. Nothing caught it: the existing version tests compare the header to `__version__`, which stays self-consistent however stale it is, and no test compared either to pyproject. The release commits have always bumped both by hand (a41a37c, 2c78bd8), which works right up until someone bumps only one. Adds the missing comparison so the next one-sided bump fails in CI instead of on PyPI. sonilo-cli is unaffected — its own version and its `sonilo>=0.15.0,<0.16` pin both still hold. Claude-Session: https://claude.ai/code/session_01SFP9xPKwk2S1Qjmk5krx6h Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d31bd03 commit 829ad11

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎src/sonilo/_version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.15.3"
1+
__version__ = "0.15.4"

‎tests/test_client_identity.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,25 @@ async def test_async_defaults_to_sdk_python():
8080
headers = route.calls.last.request.headers
8181
assert headers["x-sonilo-client"] == "sdk-python"
8282
assert headers["x-sonilo-client-version"] == __version__
83+
84+
85+
def test_version_module_matches_pyproject():
86+
"""`__version__` ships as the x-sonilo-client-version header, so a release
87+
whose _version.py lagged pyproject.toml would have every client on that
88+
version identify itself as the previous one.
89+
90+
Nothing caught that before: the other version tests compare the header to
91+
`__version__`, which stays self-consistent however stale it is. 0.15.4 went
92+
out with _version.py still on 0.15.3 for exactly that reason."""
93+
import re
94+
from pathlib import Path
95+
96+
from sonilo._version import __version__
97+
98+
# Read the line, not tomllib: this package supports 3.9 and tomllib is
99+
# 3.11+, so parsing properly would make the guard skip on exactly the
100+
# oldest interpreter CI runs.
101+
pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
102+
text = pyproject.read_text(encoding="utf-8")
103+
declared = re.search(r'(?m)^version = "([^"]+)"', text).group(1)
104+
assert __version__ == declared

0 commit comments

Comments
 (0)