"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(cli): install the exact checked update version
Haozhe Wuf2e46228852a
diff --git a/agent/cli/commands/update.py b/agent/cli/commands/update.pyindex 4f9552286..184bea4a0 100644--- a/agent/cli/commands/update.py+++ b/agent/cli/commands/update.py@@ -175,7 +175,14 @@ def _pip_upgrade(latest: str) -> int:"""Upgrade the wheel install in place via pip, then verify. Returns exit code."""console.print(f"Upgrading {PACKAGE_NAME} {CURRENT_VERSION} -> {latest} ...")proc = subprocess.run(- [sys.executable, "-m", "pip", "install", "--upgrade", PACKAGE_NAME],+ [+ sys.executable,+ "-m",+ "pip",+ "install",+ "--upgrade",+ f"{PACKAGE_NAME}=={latest}",+ ],text=True,)if proc.returncode != 0:@@ -205,7 +212,7 @@ def _verify_upgrade(expected: str) -> int:installed = proc.stdout.strip()try:- confirmed = installed and Version(installed) >= Version(expected)+ confirmed = bool(installed) and Version(installed) == Version(expected)except InvalidVersion:confirmed = Falseif not confirmed:diff --git a/agent/tests/test_cli_update.py b/agent/tests/test_cli_update.pyindex 6473406f5..4ff01101e 100644--- a/agent/tests/test_cli_update.py+++ b/agent/tests/test_cli_update.py@@ -202,7 +202,7 @@ def test_downgrade_protection_no_pip(monkeypatch) -> None:def test_newer_wheel_upgrades(monkeypatch, capsys: pytest.CaptureFixture[str]) -> None:- """Newer version + wheel install: exactly one pip upgrade call, exit 0."""+ """The version checked on PyPI is the exact version passed to pip."""calls, fake_run = _fake_subprocess(pip_rc=0, verify_stdout="99.0.0")monkeypatch.setattr(update_mod.subprocess, "run", fake_run)_monkeypatch_upgrade_env(monkeypatch, latest="99.0.0")@@ -212,7 +212,8 @@ def test_newer_wheel_upgrades(monkeypatch, capsys: pytest.CaptureFixture[str]) -pip_cmd = calls[0]assert pip_cmd[:3] == [update_mod.sys.executable, "-m", "pip"]assert "install" in pip_cmd and "--upgrade" in pip_cmd- assert update_mod.PACKAGE_NAME in pip_cmd+ assert f"{update_mod.PACKAGE_NAME}==99.0.0" in pip_cmd+ assert update_mod.PACKAGE_NAME not in pip_cmdassert "Updated to 99.0.0" in capsys.readouterr().out@@ -238,6 +239,19 @@ def test_verification_mismatch(monkeypatch, capsys: pytest.CaptureFixture[str])assert "verification mismatch" in capsys.readouterr().out+def test_verification_rejects_a_different_newer_version(+ monkeypatch, capsys: pytest.CaptureFixture[str]+) -> None:+ """Verification must close over the checked release, not accept any newer one."""+ calls, fake_run = _fake_subprocess(pip_rc=0, verify_stdout="100.0.0")+ monkeypatch.setattr(update_mod.subprocess, "run", fake_run)+ _monkeypatch_upgrade_env(monkeypatch, latest="99.0.0")++ assert update_mod.cmd_update() == update_mod.EXIT_FAILED+ assert len(calls) == 2+ assert "expected 99.0.0" in capsys.readouterr().out++def test_editable_install_prints_hint_no_pip(monkeypatch, capsys: pytest.CaptureFixture[str]) -> None:calls, fake_run = _fake_subprocess()monkeypatch.setattr(update_mod.subprocess, "run", fake_run)