Merge pull request #247 from Sea-Haven-Industries/fix/issue-240-dashboard-verdict
Some checks are pending
CI / Lint (push) Waiting to run
CI / Format check (push) Waiting to run
CI / Typecheck (push) Waiting to run
CI / Unit tests (push) Waiting to run
CI / Playwright E2E (push) Waiting to run
CI / Docker build smoke (push) Waiting to run
CI / Triage ledger up to date (push) Waiting to run
CI / ui bun.lock in sync (push) Waiting to run

fix(dashboard): authorize review verdicts from UI trigger
This commit is contained in:
Adam Moussa 2026-07-31 19:45:37 -04:00 • committed by GitHub
commit 7a1da5d0af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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"}]))