fix(dashboard): authorize review verdicts

This commit is contained in:
Adam Moussa 2026-07-31 12:34:56 -04:00
parent 674f9ccc4e
commit 056688e822
No known key found for this signature in database
2 changed files with 25 additions and 1 deletions

View file

@ -705,7 +705,12 @@ async def trigger_re_review(owner: str, repo: str, pr_number: int, login: str) -
number=pr_number,
url=f"https://github.com/{owner}/{repo}/pull/{pr_number}",
)
result = await trigger_pr_review_from_ref(pr_ref, source="dashboard", github_login=login)
result = await trigger_pr_review_from_ref(
pr_ref,
source="dashboard",
github_login=login,
request_verdict=True,
)
if not result.get("success"):
raise HTTPException(502, str(result.get("error") or "could not trigger review"))
return result

View file

@ -8,6 +8,7 @@ import pytest
from agent.dashboard import review_api, routes
from agent.review.findings import REVIEWER_THREAD_KIND
from agent.webhooks import github as github_webhooks
def _thread(owner: str, name: str, number: int, author: str) -> dict[str, Any]:
@ -78,6 +79,24 @@ async def test_list_reviews_applies_accessibility_and_has_more(monkeypatch) -> N
assert has_more is True
@pytest.mark.asyncio
async def test_trigger_re_review_authorizes_dashboard_verdict(monkeypatch) -> None:
trigger = AsyncMock(return_value={"success": True, "thread_id": "review-thread"})
monkeypatch.setattr(github_webhooks, "trigger_pr_review_from_ref", trigger)
result = await review_api.trigger_re_review("acme", "widgets", 42, "octocat")
trigger.assert_awaited_once()
pr_ref = trigger.await_args.args[0]
assert (pr_ref.owner, pr_ref.repo, pr_ref.number) == ("acme", "widgets", 42)
assert trigger.await_args.kwargs == {
"source": "dashboard",
"github_login": "octocat",
"request_verdict": True,
}
assert result["success"] is True
@pytest.mark.asyncio
async def test_accessible_repo_full_names_lowercases(monkeypatch) -> None:
fetch = AsyncMock(return_value=([], [{"full_name": "Acme/Repo"}, {"full_name": "Acme/Other"}]))