fix(robomp): clear needs-info on resume

This commit is contained in:
oldschoola
2026-06-15 18:22:34 -07:00
parent a409fd3216
commit b945f54962
8 changed files with 73 additions and 1 deletions
+3
View File
@@ -338,6 +338,8 @@ def round_trip_app(proxy_settings: Settings):
return httpx.Response(201, json={})
if path == "/repos/octo/widget/issues/1/labels":
return httpx.Response(200, json=[{"name": "triage"}])
if path == "/repos/octo/widget/issues/1/labels/needs-info" and req.method == "DELETE":
return httpx.Response(200, json={})
if path == "/repos/octo/widget/issues/1/assignees":
return httpx.Response(201, json={})
return httpx.Response(404, json={"message": f"unrouted {req.method} {path}"})
@@ -405,6 +407,7 @@ async def test_round_trip_all_endpoints(round_trip_app) -> None:
assert await client.request_reviewers(repo="octo/widget", pr_number=4, reviewers=["alice"]) is None
labels = await client.add_issue_labels("octo/widget", 1, ["triage"])
assert await client.remove_issue_label("octo/widget", 1, "needs-info") is None
assert labels == ("triage",)
assert await client.add_assignees("octo/widget", 1, ["alice"]) is None
+21
View File
@@ -505,6 +505,27 @@ async def test_add_issue_labels(proxy_settings: Settings) -> None:
assert json.loads(captured["req"].content) == {"labels": ["triage", "bug"]}
async def test_remove_issue_label(proxy_settings: Settings) -> None:
captured: dict[str, httpx.Request] = {}
def gh(req: httpx.Request) -> httpx.Response:
captured["req"] = req
return httpx.Response(200, json={})
app = _build_app(proxy_settings, gh)
body = b'{"repo":"octo/widget","number":1,"label":"needs-info"}'
async with await _async_client(app) as client:
resp = await client.post(
"/gh/v1/remove_issue_label",
content=body,
headers={**_signed("POST", "/gh/v1/remove_issue_label", body), "Content-Type": "application/json"},
)
assert resp.status_code == 200
assert resp.json() == {"ok": True}
assert captured["req"].method == "DELETE"
assert captured["req"].url.path == "/repos/octo/widget/issues/1/labels/needs-info"
async def test_add_assignees(proxy_settings: Settings) -> None:
captured: dict[str, httpx.Request] = {}
+7 -1
View File
@@ -2248,12 +2248,17 @@ async def test_handle_comment_resumes_needs_info_reply(
monkeypatch.setattr(tasks, "_resolve_repo_and_issue", _resolve)
post_comment_calls: list = []
removed_labels: list[tuple[str, int, str]] = []
async def _capture_post(self, *args, **kwargs):
post_comment_calls.append((args, kwargs))
return None
async def _capture_remove_label(self, repo: str, number: int, label: str) -> None:
removed_labels.append((repo, number, label))
monkeypatch.setattr(GitHubClient, "post_comment", _capture_post)
monkeypatch.setattr(GitHubClient, "remove_issue_label", _capture_remove_label)
payload = {
"action": "created",
@@ -2280,9 +2285,10 @@ async def test_handle_comment_resumes_needs_info_reply(
assert call["task_kind"] == "handle_comment"
assert call["comment"].body == "I am on Bun 1.3.14 and here is the trace"
assert sandbox.ensure_calls[0]["existing_branch"] == "farm/old/branch"
assert removed_labels == [("octo/widget", 88, "needs-info")]
assert post_comment_calls == [], "needs-info replies must not get the finalized-issue notice"
row = db.get_issue("octo/widget#88")
assert row is not None and row.state == "needs_info"
assert row is not None and row.state == "reproducing"
close_database()