Skip to content

Commit 2b093dc

Browse files
committed
fix(08.1-06): sync __version__ to 0.2.5a1 + accept PEP 440 alpha suffixes in managed-block markers
The package's runtime __version__ in src/supamem/__init__.py had drifted to 0.2.1 (last bumped manually two release lines ago); pyproject.toml was the only updated source. `supamem --version` reported 0.2.1 even on the freshly-built 0.2.5a1 wheel. Sync to match pyproject. While re-smoking, the version bump exposed a second bug: the managed- block fence regex in config_io._FENCE_RE / _BEGIN_RE and doctor._VERSION_RE matched only `v[\d\.]+`, which rejects PEP 440 pre-release versions that contain letters (e.g. 0.2.5a1, 1.0.0rc2, 2.1.dev0). Effect: `supamem install` was no-longer idempotent on alpha versions — the second run could not find the existing block and appended a duplicate to ~/CLAUDE.md. Widen the char-class to `[\w\.\+\-]+` (covers PEP 440 letters, digits, dots, plus, minus, underscore — full release-segment shape). Both fence-pair detection and doctor's drift probe now round-trip cleanly across alpha releases. Confirmed by: - tests/test_install_claude_code.py + test_install_opencode.py: green - uv run pytest -q: 504 passed, 1 skipped - Fresh-venv smoke: `supamem --version` reports 0.2.5a1; second `install()` is a true no-op (no duplicate managed block) Auto-fix per gsd-execute-phase Rule 1 (bug discovered during release smoke; fix is in-scope for the version bump that exposed it).
1 parent 27baeee commit 2b093dc

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/supamem/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""supamem — project-agnostic dual-memory tooling."""
2-
__version__ = "0.2.1"
2+
__version__ = "0.2.5a1"

src/supamem/config_io.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,17 @@ def atomic_write_json(
176176

177177
_BEGIN_FMT = "# BEGIN SUPAMEM v{version} MANAGED BLOCK — DO NOT EDIT"
178178
_END_FMT = "# END SUPAMEM v{version} MANAGED BLOCK"
179+
# PEP 440 versions can include alpha/beta/rc/dev suffixes (e.g. 0.2.5a1,
180+
# 1.0.0rc2, 2.1.dev0), so the marker version-token char-class must accept
181+
# letters, digits, dots, plus, minus, and underscore — not just `[\d\.]+`.
182+
# Anchor with leading `v` to keep the marker unambiguous.
179183
_FENCE_RE = re.compile(
180-
r"# BEGIN SUPAMEM v[\d\.]+ MANAGED BLOCK — DO NOT EDIT\n"
184+
r"# BEGIN SUPAMEM v[\w\.\+\-]+ MANAGED BLOCK — DO NOT EDIT\n"
181185
r"(?P<owned>.*?)\n"
182-
r"# END SUPAMEM v[\d\.]+ MANAGED BLOCK",
186+
r"# END SUPAMEM v[\w\.\+\-]+ MANAGED BLOCK",
183187
re.DOTALL,
184188
)
185-
_BEGIN_RE = re.compile(r"# BEGIN SUPAMEM v[\d\.]+ MANAGED BLOCK — DO NOT EDIT")
189+
_BEGIN_RE = re.compile(r"# BEGIN SUPAMEM v[\w\.\+\-]+ MANAGED BLOCK — DO NOT EDIT")
186190

187191

188192
def wrap_managed_block(content: str, version: str = __version__) -> str:

src/supamem/doctor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def _client_targets() -> tuple[tuple[str, Path], ...]:
3636
("opencode", Path.home() / "AGENTS.md"),
3737
)
3838

39-
_VERSION_RE = re.compile(r"BEGIN SUPAMEM v([\d\.]+) MANAGED BLOCK")
39+
# PEP 440 versions accept alpha/beta/rc/dev suffixes; matches config_io._FENCE_RE.
40+
_VERSION_RE = re.compile(r"BEGIN SUPAMEM v([\w\.\+\-]+) MANAGED BLOCK")
4041

4142

4243
def _redact(value: str, *, enabled: bool) -> str:

0 commit comments

Comments
 (0)