From 3e3deb85e3536af586562d8b3c614ec8007dd20d Mon Sep 17 00:00:00 2001 From: FlintWave Date: Wed, 10 Jun 2026 18:40:20 -0700 Subject: [PATCH] fix(release): sync Briefcase version with version.py and guard it The 26.06.06 release shipped installers still labelled 26.6.5 because the [tool.briefcase] version in pyproject.toml is mirrored separately from src/searchmob_desktop/version.py and was not bumped with it, so Briefcase built the packages at the previous version and Linux package managers would not treat them as an upgrade. Bump the Briefcase version to 26.06.06 to match, and add tests/test_version_consistency.py, which fails the build whenever the two version strings drift, so this cannot silently recur. Co-Authored-By: Claude Opus 4.8 (1M context) --- pyproject.toml | 5 +++-- tests/test_version_consistency.py | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/test_version_consistency.py diff --git a/pyproject.toml b/pyproject.toml index 2ab5295..68d81aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -104,11 +104,12 @@ follow_imports = "skip" # # Version is mirrored here (rather than read dynamically) because Briefcase resolves PEP621 # `dynamic = ["version"]` by running the PEP517 build backend in an isolated env, which is wasteful -# in CI. Bump both this string and src/searchmob_desktop/version.py together at release time. +# in CI. Bump both this string and src/searchmob_desktop/version.py together at release time; +# `tests/test_version_consistency.py` fails the build if they ever drift apart. [tool.briefcase] project_name = "SearchMob Desktop" bundle = "com.flintwave" -version = "26.06.05" +version = "26.06.06" url = "https://github.com/FlintWave/SearchMob-Desktop" author = "FlintWave" author_email = "flintwave@tuta.com" diff --git a/tests/test_version_consistency.py b/tests/test_version_consistency.py new file mode 100644 index 0000000..7f5868e --- /dev/null +++ b/tests/test_version_consistency.py @@ -0,0 +1,27 @@ +"""The app version lives in two places that MUST agree: `src/searchmob_desktop/version.py` (the +single source of truth, read by hatchling and the in-app update check) and the `[tool.briefcase]` +`version` in `pyproject.toml` (mirrored there because Briefcase resolves a PEP 621 dynamic version +by running the build backend in an isolated env, which is wasteful in CI). + +If they drift, the installers Briefcase builds carry a different version than the app reports, so a +release can ship packages labelled with the previous version and Linux package managers refuse the +upgrade. This test fails the build when that happens, so the two can never silently diverge again. +""" + +from __future__ import annotations + +import tomllib +from pathlib import Path + +from searchmob_desktop.version import __version__ + +_PYPROJECT = Path(__file__).resolve().parent.parent / "pyproject.toml" + + +def test_briefcase_version_matches_version_py() -> None: + data = tomllib.loads(_PYPROJECT.read_text(encoding="utf-8")) + briefcase_version = data["tool"]["briefcase"]["version"] + assert briefcase_version == __version__, ( + f"pyproject [tool.briefcase] version {briefcase_version!r} != " + f"version.py {__version__!r}; bump both together at release time." + )