Skip to content

Fix --version drift; release 0.5.2 - #87

Merged
bmxcode merged 1 commit into
mainfrom
fix-version-drift
Sep 5, 2026
Merged

bmxcode merged 1 commit into
mainfrom
fix-version-drift

Conversation

@bmxcode

@bmxcode bmxcode commented Sep 5, 2026

Copy link
Copy Markdown
Owner

What this fixes

The published 0.5.1 prints 0.5.0 for samplerdisc --version. The install test against PyPI caught it.

Root cause

The version had two sources of truth: pyproject.toml and a hardcoded __version__ = "0.5.0" literal in src/samplerdisc/__init__.py. uv version --bump moves only the former, so the runtime string was left behind. 0.5.0 was self-consistent by luck; the first bump exposed the split.

It went unnoticed because the guards were weak in matching ways: the release workflow's tag-vs-version guard checks pyproject (not the runtime value), CI's entrypoint step ran samplerdisc --version without asserting what it printed, and the unit test pinned the literal "0.5.0" — a literal mirroring a literal, which passed while both sat still.

The fix — one source of truth

  • __version__ is now read from the installed distribution's metadata (importlib.metadata.version("samplerdisc")), with a 0.0.0+unknown fallback for an uninstalled source tree. It cannot drift from the packaged version because it is the packaged version.
  • CI now asserts it: the install-time step compares samplerdisc --version against uv version --short and fails on a mismatch — this exact bug would now break the build.
  • The unit test now asserts the invariant, not a literal: __version__ == importlib.metadata.version("samplerdisc").

Verified locally

ruff check / ruff format --check clean, full pytest green (real-disc tests skip as designed), and the entrypoint check mimicked locally reports 0.5.2 on both sides.

Consequence

0.5.1 can't be re-uploaded, so this ships as 0.5.2. The package contents were otherwise identical to 0.5.1 — only the self-reported version was wrong — so upgrading is the fix for anyone who installed 0.5.1.

After merge

git tag v0.5.2 && git push origin v0.5.2 cuts the release through the same Trusted Publishing workflow.

🤖 Generated with Claude Code

0.5.1 shipped an entrypoint that printed 0.5.0. The version lived in two
places — pyproject.toml and a hardcoded __version__ literal — and the bump
moved only the first. Derive __version__ from the installed distribution's
metadata so there is a single source of truth that cannot drift.

Enforce it: the CI install-time check now asserts the entrypoint's reported
version equals the packaged version rather than only that it runs, and the
unit test asserts __version__ equals importlib.metadata.version("samplerdisc")
instead of pinning a literal (the literal-mirrors-literal test is what masked
the drift). Bump to 0.5.2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bmxcode
bmxcode merged commit cc7b8f4 into main Sep 5, 2026
2 checks passed
@bmxcode
bmxcode deleted the fix-version-drift branch September 5, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant