Fix stale version marker and add a version-consistency CI gate#144
Merged
Conversation
added 3 commits
May 17, 2026 17:56
src/memory/__version__.py declared 2.3.2 while version.txt and pyproject.toml declared 2.4.1, so installs self-reported the wrong version and the release pipeline's version-consistency step failed on every tag-cut since v2.4.0. Bump __version__ to 2.4.1 and add version-history lines for 2.4.0 and 2.4.1. metrics.py carried its own hardcoded "2.3.2" fallback for the Prometheus version Info metric. Point the importlib.metadata fallback at src/memory/__version__.py so the metric cannot drift from the single source of truth. BUG-307
Add scripts/check_version_consistency.py asserting that version.txt, pyproject.toml [project] version, and src/memory/__version__.py __version__ agree. With --tag it also asserts the markers equal the release tag and the latest non-[Unreleased] CHANGELOG heading. The check exits non-zero on mismatch and prints which markers disagree. Wire it into the Test Suite workflow as a version-consistency job that gates pull requests and pushes, and into the ci-success summary, so drift fails a PR instead of staying invisible until tag-cut. Replace release.yml's inline single-marker check with the shared script in --tag mode, and rewrite the validation-comment step to name the specific failing step and surface the version-mismatch detail instead of a generic failure message. BUG-307
Add three coverage gaps in tests/test_check_version_consistency.py: - main()-level CHANGELOG-mismatch case (markers agree with the tag but the latest CHANGELOG heading lags) asserting exit code 1 - _emit_actions_error() annotation path: single-line ::error:: output with embedded newlines collapsed to spaces, and no output outside GitHub Actions - missing-file and missing-key MarkerError paths for read_pyproject_version and read_version_py Test-only change. BUG-307
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
src/memory/__version__.py— the declared single source of truth for the package version — was stale at2.3.2. This caused theRelease Managementworkflow'sCheck version consistencystep to fail on every release since v2.4.0, and made v2.4.0/v2.4.1 installs self-report the wrong version. There are three version markers in the repo (version.txt,pyproject.toml,src/memory/__version__.py) with no procedure or gate keeping them in sync, so they drifted independently.Changes
src/memory/__version__.py— corrected__version__to2.4.1(matchingversion.txtandpyproject.toml); added version-history lines for 2.4.0 and 2.4.1.src/memory/metrics.py— replaced a hardcoded"2.3.2"fallback (used whenimportlib.metadatacannot resolve package metadata) with an import of__version__, so the fallback tracks the SSOT instead of drifting.scripts/check_version_consistency.py(new) — asserts all three version markers agree. In--tagmode it also asserts they equal the release tag and the latestCHANGELOG.mdversion heading. Distinct exit codes for agreement / mismatch / unreadable marker; emits GitHub Actions error annotations..github/workflows/test.yml— newversion-consistencyjob running on every push and pull request, wired into theci-successgate so marker drift fails a required check before merge..github/workflows/release.yml— the release-time version check now uses the shared script; the validation-result comment names the specific failing step and surfaces the mismatch detail instead of a generic message.tests/test_check_version_consistency.py(new) — 22 tests covering marker readers, agreement and mismatch cases, tag mode, CHANGELOG-heading checks, exit codes, and the annotation path.CHANGELOG.md—[Unreleased]entry.Verification
black,ruff,isortclean.