Skip to content

Fix stale version marker and add a version-consistency CI gate#144

Merged
Hidden-History merged 3 commits into
mainfrom
feature/v2.4.2-release-pipeline-hygiene
May 18, 2026
Merged

Fix stale version marker and add a version-consistency CI gate#144
Hidden-History merged 3 commits into
mainfrom
feature/v2.4.2-release-pipeline-hygiene

Conversation

@Hidden-History
Copy link
Copy Markdown
Owner

Summary

src/memory/__version__.py — the declared single source of truth for the package version — was stale at 2.3.2. This caused the Release Management workflow's Check version consistency step 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__ to 2.4.1 (matching version.txt and pyproject.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 when importlib.metadata cannot 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 --tag mode it also asserts they equal the release tag and the latest CHANGELOG.md version heading. Distinct exit codes for agreement / mismatch / unreadable marker; emits GitHub Actions error annotations.
  • .github/workflows/test.yml — new version-consistency job running on every push and pull request, wired into the ci-success gate 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

  • 22/22 new tests pass; existing version/metrics tests pass; no regressions in the unit suite.
  • Negative test: diverging a marker locally makes the check exit non-zero and name the disagreeing markers.
  • black, ruff, isort clean.

WB Solutions 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
@Hidden-History Hidden-History merged commit aa938cd into main May 18, 2026
18 checks passed
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