fix: single source of truth for version — closes #37#77
Merged
Conversation
Establishes scripts/utils.py:CODELENS_VERSION as the single source of truth for the CodeLens version. All other version mentions now match this constant or are stripped entirely. Issue #37 reported 4 different version values across 6 files: pyproject.toml=7.2.0, skill.json=7.2.0, utils.py=8.0.0, README.md=v8.2, SKILL.md=v8.1, SKILL-QUICK.md=v8.2, CHANGELOG.md=[8.2.0] Unreleased. This PR synchronizes everyone to 8.2.0 (the value CHANGELOG.md already advertises as the unreleased version) and adds a CI guard test so future drift fails CI immediately. Changes (6 existing files + 1 new test file): - scripts/utils.py:393 — CODELENS_VERSION "8.0.0" -> "8.2.0" (this is the canonical source going forward) - pyproject.toml:7 — version "7.2.0" -> "8.2.0" (PyPI / packaging metadata) - skill.json:3 — version "7.2.0" -> "8.2.0" (MCP / AI-host manifest) - README.md:1 — strip "v8.2" from H1 heading (# CodeLens — AI-Native Code Intelligence) - SKILL.md:12 — strip "v8.1" from H1 heading (# CodeLens) - SKILL-QUICK.md:1 — strip "v8.2" from H1 heading (# CodeLens — Quick Reference) - tests/test_version_consistency.py (NEW) — 3 tests: test_pyproject_version_matches_utils test_skill_json_version_matches_utils test_no_version_in_doc_headings Why dynamic versioning was NOT used: pyproject.toml supports dynamic = ["version"] with attr-based lookup, but the simpler hardcoded approach was chosen per task brief (JSON cannot be dynamic anyway, and keeping pyproject hardcoded matches the skill.json pattern). The CI guard test makes the hardcoded values safe. Doc headings: the live version is now queried via `codelens --version` (returns 8.2.0). README/SKILL/SKILL-QUICK no longer embed version literals in their H1, eliminating the third source of truth that caused the original drift. CHANGELOG.md intentionally NOT touched — its `[8.2.0] — Unreleased` section was already correct and is the target value everyone else was bumped to match. Verification: - python3 -c "from utils import CODELENS_VERSION; print(CODELENS_VERSION)" outputs 8.2.0 - pytest tests/test_version_consistency.py -v 3 passed - Full test suite (excluding slow test_integration.py): baseline (pre-PR): 40 failed, 668 passed, 14 skipped with this PR: 37 failed, 671 passed, 14 skipped (3 net new passes = the 3 new consistency tests; no regressions) Findings (out of scope, not fixed): - tests/test_vuln_staleness.py::TestScanVulnerabilitiesCacheInfo::test_vulnerable_app_has_stale_cache_info fails pre-PR too — it's a date-based staleness test (VULN_DB last-updated 2025-02-28, now 485 days old); the test expects is_stale=True but the engine returns False. Pre-existing. - 36 other pre-existing failures in test_architecture, test_compact_format, test_graph_incremental, test_graph_model, test_hybrid_type_resolver — all fail identically pre-PR and post-PR. None touch version metadata. Closes #37.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Owner
Author
Review - APPROVEReviewed full diff (7 files, +175/-6). Clean, focused, matches issue #37 spec exactly. Strengths
Minor observation (non-blocking)
VerdictMerging. CI guard test ensures future drift is caught immediately. Reviewed by BOS (orchestrate-workers skill) - diff read in full before approval. |
|
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.



What changed
Establishes
scripts/utils.py:CODELENS_VERSIONas the single source of truth for the CodeLens version. All other version mentions now match this constant or are stripped entirely.Issue #37 reported 4 different version values across 6 files (pyproject.toml=7.2.0, skill.json=7.2.0, utils.py=8.0.0, README.md=v8.2, SKILL.md=v8.1, SKILL-QUICK.md=v8.2) while
CHANGELOG.mdalready advertised[8.2.0] Unreleased. This PR synchronizes everyone to8.2.0and adds a CI guard test so future drift fails CI immediately.Why
The drift had four concrete impacts (per issue #37):
initializeresponse'sserverInfo.versionreads fromutils.CODELENS_VERSION = "8.0.0", but the actual feature set (compact format, graph-schema, git-aware, architecture, hybrid-type-resolver) is8.2.0-level. Clients that gate behavior on version mis-route.pip install codelens(if it ever ships to PyPI) would report7.2.0while the code is at8.2.0.[8.2.0] — Unreleasedadvertises features that the version constants didn't acknowledge.Files touched
scripts/utils.py:393CODELENS_VERSION = "8.0.0"→"8.2.0"(canonical source going forward)pyproject.toml:7version = "7.2.0"→"8.2.0"skill.json:3"version": "7.2.0"→"8.2.0"README.md:1# CodeLens v8.2 — AI-Native Code Intelligence→# CodeLens — AI-Native Code IntelligenceSKILL.md:12# CodeLens v8.1→# CodeLensSKILL-QUICK.md:1# CodeLens v8.2 — Quick Reference→# CodeLens — Quick Referencetests/test_version_consistency.pyDesign decisions
pyproject.tomlversion:pyproject.tomlsupportsdynamic = ["version"]withattr = "utils.CODELENS_VERSION", but the simpler hardcoded approach was chosen per the task brief — JSON (skill.json) cannot be dynamic anyway, so keepingpyproject.tomlhardcoded matches theskill.jsonpattern and gives a uniform "edit one constant + grep-bump two mirrors" workflow. The CI guard test makes the hardcoded values safe.codelens --version(returns8.2.0). README/SKILL/SKILL-QUICK no longer embed version literals in their H1, eliminating the third source of truth that caused the original drift. Templating markdown at build time was considered and rejected as over-engineering for a 3-file doc set.[8.2.0] — Unreleasedsection was already correct and is the target value everyone else was bumped to match.Verification
DoD check #9 — runtime version constant
$ python3 -c "from utils import CODELENS_VERSION; print(CODELENS_VERSION)" 8.2.0DoD check #8 —
pytest tests/test_version_consistency.py -vNegative verification — tests fail when drift is reintroduced
I verified the tests actually catch drift by temporarily reverting each file to its old value and re-running:
After restoration, all 3 tests pass cleanly.
Full test suite (excluding slow
tests/test_integration.py)main)Net delta: +3 passed (the 3 new consistency tests), 0 regressions. Every test that failed pre-PR fails identically post-PR — none of the pre-existing failures are caused by these changes.
Test portability
tests/test_version_consistency.pyworks on Python 3.8+ (the floor declared inpyproject.toml). It usestomllibwhen available (3.11+) and falls back to a regex on theversion = "..."line for 3.8-3.10, so it doesn't addtomlias a test-only dependency.Findings (out of scope, not fixed)
Per the verification checklist (report what was found but not fixed):
tests/test_vuln_staleness.py::TestScanVulnerabilitiesCacheInfo::test_vulnerable_app_has_stale_cache_info— fails pre-PR too. It's a date-based staleness test (the built-inVULN_DBwas last updated 2025-02-28, now 485 days old); the test assertsis_stale is Truebut the engine returnsFalse. Pre-existing, unrelated to version metadata. Likely needs either a refresh ofVULN_DBor a test fixture that mocks the wall-clock date.test_architecture,test_compact_format,test_graph_incremental,test_graph_model,test_hybrid_type_resolver— all fail identically pre-PR and post-PR. Spot-checks suggest these are environmental (graph DB file path / fixture setup), not version-related. None of them touch version metadata, so they're outside this PR's scope.Issue link
Closes #37 — #37