refactor(ai_review): drop AI_REVIEW/AI_USAGE label plumbing

This commit is contained in:
claude
2026-08-22 01:13:59 +00:00
parent 33e4c16782
commit e1b74d982d
2 changed files with 0 additions and 73 deletions
-29
View File
@@ -663,35 +663,6 @@ def test_reference_non_url_renders_as_plain_text():
assert "](CVE-" not in body
def test_pr_has_label_reads_the_live_labels(monkeypatch):
# The AI-USAGE opt-in is read at render time, not from the trigger
# payload: labelling AI-REVIEW then AI-USAGE is two events, the review
# claims on the first, and the second is dropped by the in-flight dedupe.
seen = {}
def _get(api, repo, path, token, accept="application/json"):
seen["path"] = path
return 200, b'[{"name": "AI-REVIEW"}, {"name": "AI-USAGE"}]'
monkeypatch.setattr(ai_review, "gitea_get", _get)
assert ai_review.pr_has_label("http://api", "o/r", "9", "t", "AI-USAGE") is True
assert seen["path"] == "issues/9/labels"
assert ai_review.pr_has_label("http://api", "o/r", "9", "t", "NOPE") is False
def test_pr_has_label_survives_a_broken_api(monkeypatch):
def _boom(*a, **k):
raise RuntimeError("gitea down")
monkeypatch.setattr(ai_review, "gitea_get", _boom)
assert ai_review.pr_has_label("http://api", "o/r", "9", "t", "AI-USAGE") is False
monkeypatch.setattr(ai_review, "gitea_get", lambda *a, **k: (404, b"nope"))
assert ai_review.pr_has_label("http://api", "o/r", "9", "t", "AI-USAGE") is False
monkeypatch.setattr(ai_review, "gitea_get", lambda *a, **k: (200, b'{"not": "a list"}'))
assert ai_review.pr_has_label("http://api", "o/r", "9", "t", "AI-USAGE") is False
def test_int_env_falls_back_on_garbage(monkeypatch, capsys):
monkeypatch.setenv("PRAGENT_DIFF_CONTEXT", "two")
assert ai_review._int_env("PRAGENT_DIFF_CONTEXT", 1) == 1