fix: skip malformed nested issue metadata (#85)
CI / lint (pull_request) Successful in 8s
CI / build-frontend (pull_request) Successful in 4s

This commit is contained in:
timmy committed 2026-08-06 07:48:04 +00:00
1 parent fcdca7a37c
commit 68c2048724
2 files changed
+48 -1

No files matched your search

+31
View File
@@ -65,6 +65,37 @@ async def test_context_normalizes_nullable_issue_collections(monkeypatch):
assert issue["assignees"] == []
@pytest.mark.anyio
async def test_context_skips_malformed_nested_issue_metadata(monkeypatch):
async def user():
return {"id": 1, "login": "timmy"}
async def empty_collection():
return []
async def issue_collection():
return [{
"id": 85,
"number": 85,
"title": "Malformed nested metadata",
"state": "open",
"labels": [None, {"name": "bug"}, "invalid"],
"assignees": [None, {"login": "timmy"}, "invalid"],
"html_url": "https://forge.example/issues/85",
}]
monkeypatch.setattr(main, "current_user", user)
monkeypatch.setattr(main, "repos", empty_collection)
monkeypatch.setattr(main, "issues", issue_collection)
monkeypatch.setattr(main, "pull_requests", empty_collection)
response = await main.context()
issue = json.loads(response.body)["issues"][0]
assert issue["labels"] == ["bug"]
assert issue["assignees"] == ["timmy"]
@pytest.mark.anyio
async def test_context_normalizes_nullable_repository_description(monkeypatch):
async def user():