feat(dashboard): return recent commits from /api/hermes/update/check

Add a best-effort `commits` list (sha/summary/author/at) to the update-check
response for git/pip installs that are behind upstream, so the desktop's
remote update overlay can show what's changed before applying.

Additive and non-breaking: existing consumers (legacy dashboard, tests using
subset assertions) ignore the new field. Leaves the shared check_for_updates()
int contract untouched — commits come from a separate best-effort git call.
This commit is contained in:
yoniebans
2026-06-08 08:58:26 -07:00
committed by Teknium
parent fd1e7c2bc3
commit 9e360681f8
2 changed files with 84 additions and 0 deletions
@@ -701,6 +701,37 @@ class TestUpdateCheckEndpoint:
assert body["update_available"] is False
assert body["message"]
def test_git_behind_includes_commits(self, monkeypatch):
import hermes_cli.web_server as ws
import hermes_cli.banner as banner
monkeypatch.setattr(ws, "detect_install_method", lambda *a, **k: "git")
monkeypatch.setattr(banner, "check_for_updates", lambda: 3)
monkeypatch.setattr(
ws,
"_recent_upstream_commits",
lambda n=20: [
{"sha": "abc1234", "summary": "feat: x", "author": "a", "at": 1},
],
)
body = self.client.get("/api/hermes/update/check").json()
# The desktop overlay renders this as the "what's changed" list.
assert isinstance(body["commits"], list)
assert body["commits"][0]["sha"] == "abc1234"
assert body["commits"][0]["summary"] == "feat: x"
def test_up_to_date_omits_commits(self, monkeypatch):
import hermes_cli.web_server as ws
import hermes_cli.banner as banner
monkeypatch.setattr(ws, "detect_install_method", lambda *a, **k: "git")
monkeypatch.setattr(banner, "check_for_updates", lambda: 0)
body = self.client.get("/api/hermes/update/check").json()
# No commits list when there's nothing to show (additive, non-breaking).
assert body.get("commits", []) == []
class TestDebugShareEndpoint:
"""POST /api/ops/debug-share returns the paste URLs synchronously so the