fix: auto-sync .bumpversion.cfg on version bump - #36
Merged
Conversation
Root-cause fix for the recurring version drift. The publish pipeline bumps `_version.py` via scripts/bump_version.py, which only ever wrote that one file, while the "Commit version bump" step staged only `_version.py` too. `.bumpversion.cfg` was therefore never advanced by CI, so it fell behind on every release and check_version_consistency.py (and the pre-commit hook) failed on a clean tree. Two-part fix so the two versions stay consistent going forward: - bump_version.py: add sync_bumpversion_cfg(), called after write_version(), which rewrites the cfg's `current_version` line in place (tolerates the file being absent; honours --dry-run). _version.py stays the source of truth. - python-publish.yml: the commit step now also `git add .bumpversion.cfg`, so the sync is committed to git, not just left on the runner's disk. Also corrects the current drift (cfg 1.0.19 -> 1.1.10) and updates CLAUDE.md, which previously documented the drift as an accepted quirk. Note: .github/workflows/ is CODEOWNERS-protected, so this PR needs @amitray007 review on the workflow change. New tests in tests/test_bump_version.py cover the bump arithmetic and the sync (updates only current_version, tolerates a missing file, raises on a malformed cfg, idempotent, and leaves both files on the same version). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Test Coverage ReportOverall: 100% (1680/1680 statements covered) Coverage by file
Updated by PR Tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root-cause fix for the recurring version drift between
.bumpversion.cfgandetsy_python/_version.py.Why it kept drifting: the publish pipeline bumps the version with
scripts/bump_version.py, which only ever wrote_version.py— and the "Commit version bump" step staged only_version.pytoo..bumpversion.cfg(read by thebump2versiontool, which CI doesn't run) was never advanced, so it fell behind on every release andcheck_version_consistency.py/ the pre-commit hook failed on a clean tree.Fix (two parts, so they stay in sync going forward):
bump_version.py— newsync_bumpversion_cfg(), called afterwrite_version(), rewrites the cfg'scurrent_versionline in place. Tolerates the file being absent, honours--dry-run._version.pystays the single source of truth.python-publish.yml— the commit step now alsogit add .bumpversion.cfg, so the sync lands in git, not just on the runner's disk.Also corrects the current drift (
1.0.19→1.1.10) and updatesCLAUDE.md, which previously documented the drift as an accepted quirk..github/workflows/is CODEOWNERS-protected (requires@amitray007). This PR touchespython-publish.yml, so it needs your review to merge — that's expected.Test plan
New
tests/test_bump_version.pycovers the bump arithmetic and the sync (updates onlycurrent_version, tolerates a missing file, raises on a malformed cfg, idempotent, both files end on the same version).Relationship to #35
Independent of PR #35 (the #34 spec-drift fix); this is build-tooling only, branched separately off
master.🤖 Generated with Claude Code