Skip to content

fix(claude-md): unify version source for outdated hint + stderr (#161) - #163

Merged
dreamlx merged 2 commits into
masterfrom
fix/161-version-source-stderr
Aug 14, 2026
Merged

fix(claude-md): unify version source for outdated hint + stderr (#161)#163
dreamlx merged 2 commits into
masterfrom
fix/161-version-source-stderr

Conversation

@dreamlx

@dreamlx dreamlx commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Closes #161

两处修复

  1. 版本源统一_get_current_version 弃用自己的 importlib-first 查询,改用模块既有 __version__ resolver(source pyproject 优先——与 --version 同源,editable install 下 dist-info 陈旧也不受影响)。同版本 CLAUDE.md 不再触发自相矛盾的 "v0.35.1 vs v0.35.1, run update" hint
  2. hint 走 stderrConsole(stderr=True)):--output json 消费方可直接 json.loads stdout(曾在 stale venv 上造成 21 个 CLI JSON 测试假红)

验证

  • 单元:TestVersionSourceConsistency——同源断言、stale dist-info 不泄漏(patch importlib 返回 0.0.1)、fresh CLAUDE.md 不被 flag、hint 在 stderr
  • E2E:临时目录 CLAUDE.md 标 v0.1.0 → 真命令 stdout 干净、stderr 报 "v0.1.0 vs v0.35.1"(如实差异)
  • 全套 1817 passed / 13 skipped;ruff clean

备注

模块 __init__._resolve_version 早已为 --version 解决过同一 stale dist-info 问题(含 rationale docstring);claude_md.py 是漏网的第二实现。本次统一后全仓单一版本源。

check_outdated compared against importlib.metadata (stale under editable
installs, dist-info baked at install time) while the hint print used
module __version__ — a fresh CLAUDE.md triggered a self-contradictory
"v0.35.1 vs v0.35.1, run update" hint. Now both use the module's
__version__ resolver (source pyproject first, same as --version), and
the startup hint prints to stderr so --output json stdout stays parseable
(once made 21 CLI JSON tests fail red on a stale venv).
Updated by post-commit hook.
Update level: affected
@dreamlx
dreamlx merged commit 77932f0 into master Aug 14, 2026
8 checks passed
@dreamlx
dreamlx deleted the fix/161-version-source-stderr branch August 14, 2026 18:27
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.

bug: check_outdated 双版本源不一致 —— 同版本仍触发 hint、误导性文案、污染 stdout 使 CLI JSON 假红

1 participant