fix(review): four findings from adversarial Codex review round 1

- twitter: align backend selection with the two-phase findings pattern —
  an unauthenticated twitter-cli (warn) no longer blocks a fully-working
  OpenCLI (ok) further down the candidate list
- watch: use _is_newer_version like check-update (the != comparison kept
  the downgrade prompt this branch fixed elsewhere)
- uninstall: third copy of the skill-dir removal also gets the symlink
  guard (full `agent-reach uninstall` path)
- doctor: a stale active_backend from a previous check on the singleton
  channel no longer leaks into an errored result

+4 regression tests (162 total).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Pnant
2026-06-11 17:53:37 +08:00
parent fc24fb699b
commit cc90e10b19
6 changed files with 100 additions and 16 deletions
+23
View File
@@ -199,3 +199,26 @@ class TestVersionCompare:
def test_unparseable_falls_back_to_inequality(self):
assert cli._is_newer_version("2026.06-beta", "1.5.0") is True
assert cli._is_newer_version("1.5.0", "1.5.0-dev") is True
class TestWatchVersionCompare:
def test_watch_does_not_prompt_downgrade(self, monkeypatch, capsys):
"""watch 与 check-update 同语义:本地领先远端 release 时不提示更新。"""
class R:
status_code = 200
headers = {}
@staticmethod
def json():
return {"tag_name": "v1.4.2", "body": ""}
monkeypatch.setattr(cli, "_github_get_with_retry", lambda *a, **k: (R(), None, 1))
monkeypatch.setattr(
"agent_reach.doctor.check_all",
lambda config: {"web": {"status": "ok", "name": "任意网页", "message": "ok",
"tier": 0, "backends": ["Jina Reader"], "active_backend": "Jina Reader"}},
)
cli._cmd_watch()
out = capsys.readouterr().out
assert "新版本可用" not in out
assert "全部正常" in out