diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7adbb02e..d2a85731 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -141,6 +141,10 @@ is ok, the app is not installed on the repo: install it from https://github.com/apps/glama-ai/installations/new (only `pathiel`), then Sync on Glama's admin page. Signing in to Glama with GitHub authorizes the app but does not install it. +The two Dependabot lines stay "unavailable" even then: the Glama AI +app does not request GitHub's Dependabot alerts permission +(`vulnerability_alerts`), so it cannot read them on any repo. The script +prints the app's permissions; only Glama can change that. The website (GitHub Pages) is the `gh-pages` branch: the landing page in `site/` and the scoreboard in `docs/scoreboard/`, nothing else. After a diff --git a/scripts/glama_health.py b/scripts/glama_health.py index b7315646..3fb51419 100644 --- a/scripts/glama_health.py +++ b/scripts/glama_health.py @@ -40,6 +40,11 @@ PATHIEL = "Julian-dev28/pathiel" INSTALL_URL = "https://github.com/apps/glama-ai/installations/new" +APP_URL = "https://api.github.com/apps/glama-ai" +# GitHub App permission -> the Glama lines it feeds. An app reads only what +# it requests; Glama AI did not request vulnerability_alerts on 2026-11-20, +# so its two Dependabot lines read "unavailable" on every repo. +APP_NEEDS = {"vulnerability_alerts": "Dependabot", "security_events": "code scanning"} API = "https://api.github.com" # Check-run conclusions that mean red; cancelled, skipped, neutral and stale do not. @@ -134,6 +139,8 @@ def github_side(repo: str, get: Getter) -> dict: except ValueError: meta = {} out["glama_maintainers"] = meta.get("maintainers") or [] + _, app = get(APP_URL) + out["glama_app_permissions"] = (_json(app) or {}).get("permissions") return out @@ -180,10 +187,22 @@ def report(repo: str, glama: Optional[dict], gh: dict) -> Tuple[bool, str]: + (" (stale)" if iss.get("stale") else "")) lines.append(f" releases: {sum(int(r.get('releaseCount') or 0) for r in rel)} " f"({', '.join(r.get('month', '?') for r in rel) or 'none'})") + perms = gh.get("glama_app_permissions") + missing = [] if perms is None else [p for p in APP_NEEDS if p not in perms] + lines.append("Glama AI app (what it may read on any repo):") + if perms is None: + lines.append(" permissions not readable") + for p, feeds in APP_NEEDS.items(): + if perms is not None: + lines.append(f" {'ok ' if p in perms else 'NO '} {feeds:<28} " + + (f"{p}: {perms[p]}" if p in perms else + f"{p} not requested: Glama's {feeds} lines read \"unavailable\" on every repo " + "until Glama adds it to its app; nothing in this repo changes that")) if green: - lines.append("GitHub has every signal on. If Glama still says Dependabot, code scanning or CI " - f"\"unavailable\", the Glama AI app is not installed on {repo}: install it at " - f"{INSTALL_URL} (Only select repositories: {repo.split('/')[1]}), then Sync on Glama's admin page.") + clear = [v for p, v in APP_NEEDS.items() if p not in missing] + ["CI"] + lines.append(f"GitHub has every signal on. If Glama still says {', '.join(clear)} \"unavailable\", " + f"the Glama AI app is not installed on {repo}: install it at {INSTALL_URL} " + f"(Only select repositories: {repo.split('/')[1]}), then Sync on Glama's admin page.") else: lines.append("Fix the FIX rows on GitHub first; Glama cannot report a signal GitHub does not have.") return green, "\n".join(lines) diff --git a/tests/test_glama_health.py b/tests/test_glama_health.py index 6cf38c5c..7f674f75 100644 --- a/tests/test_glama_health.py +++ b/tests/test_glama_health.py @@ -52,7 +52,11 @@ def test_a_page_without_the_data_is_none_not_a_crash(): assert G.maintenance("") is None -def fake_github(*, admin=True, alerts=204, setup="configured", runs=None, glama=("me",), dependabot=True): +GLAMA_APP = {"contents": "read", "metadata": "read", "repository_advisories": "read", "security_events": "read"} + + +def fake_github(*, admin=True, alerts=204, setup="configured", runs=None, glama=("me",), dependabot=True, + app=GLAMA_APP): runs = [{"name": "Tests", "status": "completed", "conclusion": "success"}] if runs is None else runs glama_json = base64.b64encode(json.dumps({"maintainers": list(glama)}).encode()).decode() table = { @@ -66,6 +70,7 @@ def fake_github(*, admin=True, alerts=204, setup="configured", runs=None, glama= f"{API}/commits/main": (200, json.dumps({"sha": "abc1234def"}).encode()), f"{API}/commits/abc1234def/check-runs?per_page=100": (200, json.dumps({"check_runs": runs}).encode()), f"{API}/contents/glama.json": (200, json.dumps({"content": glama_json}).encode()), + G.APP_URL: (200, json.dumps({"permissions": app}).encode()), } return lambda url: table.get(url, (404, None)) @@ -111,3 +116,17 @@ def test_only_real_failures_turn_ci_red(): def test_the_token_only_goes_to_the_github_api(): assert G.C.sends_token(f"{API}/vulnerability-alerts") assert not G.C.sends_token("https://glama.ai/mcp/servers/me/srv") + + +def test_the_app_not_requesting_dependabot_is_named_as_glamas_gap(): + """2026-11-20: after the install, code scanning and CI cleared on Glama and + both Dependabot lines stayed: the app never requests vulnerability_alerts.""" + green, text = G.report(REPO, None, G.github_side(REPO, fake_github())) + assert green + assert "NO Dependabot" in text and "vulnerability_alerts not requested" in text + assert "ok code scanning" in text + assert 'still says code scanning, CI "unavailable"' in text # Dependabot is not blamed on the install + _, text = G.report(REPO, None, G.github_side(REPO, fake_github(app={**GLAMA_APP, "vulnerability_alerts": "read"}))) + assert "NO " not in text and 'still says Dependabot, code scanning, CI "unavailable"' in text + _, text = G.report(REPO, None, G.github_side(REPO, fake_github(app=None))) + assert "permissions not readable" in text