From 6d733aec623dab1699f232c41cd11bf21f0269af Mon Sep 17 00:00:00 2001 From: Spencer Qian Date: Fri, 4 Sep 2026 16:26:51 -0700 Subject: [PATCH] fix: sync _version.py to 0.15.4, and guard the pair MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `#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. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01SFP9xPKwk2S1Qjmk5krx6h --- src/sonilo/_version.py | 2 +- tests/test_client_identity.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/sonilo/_version.py b/src/sonilo/_version.py index 8066fa2..8782a8b 100644 --- a/src/sonilo/_version.py +++ b/src/sonilo/_version.py @@ -1 +1 @@ -__version__ = "0.15.3" +__version__ = "0.15.4" diff --git a/tests/test_client_identity.py b/tests/test_client_identity.py index 5ff7757..011ff1a 100644 --- a/tests/test_client_identity.py +++ b/tests/test_client_identity.py @@ -80,3 +80,25 @@ async def test_async_defaults_to_sdk_python(): headers = route.calls.last.request.headers assert headers["x-sonilo-client"] == "sdk-python" assert headers["x-sonilo-client-version"] == __version__ + + +def test_version_module_matches_pyproject(): + """`__version__` ships as the x-sonilo-client-version header, so a release + whose _version.py lagged pyproject.toml would have every client on that + version identify itself as the previous one. + + Nothing caught that before: the other version tests compare the header to + `__version__`, which stays self-consistent however stale it is. 0.15.4 went + out with _version.py still on 0.15.3 for exactly that reason.""" + import re + from pathlib import Path + + from sonilo._version import __version__ + + # Read the line, not tomllib: this package supports 3.9 and tomllib is + # 3.11+, so parsing properly would make the guard skip on exactly the + # oldest interpreter CI runs. + pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml" + text = pyproject.read_text(encoding="utf-8") + declared = re.search(r'(?m)^version = "([^"]+)"', text).group(1) + assert __version__ == declared