Answer stability round 1: 0 🔴, 4 🟡 (0 misread); a cycle's close takes the task from the cycle, a resolved thread is skipped unread, and tests run git in their own environment
CI / tests (pull_request) Successful in 3m56s

This commit is contained in:
2026-11-19 14:04:11 +01:00
parent aafe75e16f
commit 914b8dc2d4
19 changed files with 143 additions and 87 deletions
+14 -2
View File
@@ -77,8 +77,20 @@ class TheThreadsThatWait(unittest.TestCase):
nodes = [{"isResolved": resolved, "path": path, "comments": {"nodes": [{"author": {"login": last}}]}} for path, resolved, last in threads]
return json.dumps({"data": {"repository": {"pullRequest": {"author": {"login": "me"}, "reviewThreads": {"nodes": nodes}}}}})
def test_parses_what_gh_prints_into_the_author_and_each_thread(self):
self.assertEqual(reviews.threads_read(self.printed(("a.py", False, "rev"), ("b.py", True, "me"))), ("me", (Thread("a.py", False, ("rev",)), Thread("b.py", True, ("me",)))))
def test_parses_what_gh_prints_into_the_author_and_each_thread_nobody_resolved(self):
self.assertEqual(reviews.threads_read(self.printed(("a.py", False, "rev"), ("b.py", True, "me"), ("c.py", False, "me"))), ("me", (Thread("a.py", ("rev",)), Thread("c.py", ("me",)))))
def pull_with(self, *nodes: dict[str, object]) -> str:
return json.dumps({"data": {"repository": {"pullRequest": {"author": {"login": "me"}, "reviewThreads": {"nodes": nodes}}}}})
def test_skips_a_resolved_thread_unread_so_a_deleted_accounts_comment_there_doesnt_fail_the_read(self):
deleted = {"comments": {"nodes": [{"author": None}]}}
printed = self.pull_with({"isResolved": True, "path": "b.py", **deleted}, {"isResolved": True}, {"isResolved": False, "path": "a.py", "comments": {"nodes": [{"author": {"login": "rev"}}]}})
self.assertEqual(reviews.waiting_threads("7", lambda args: printed), ["a.py"])
def test_a_deleted_accounts_last_word_in_a_thread_nobody_resolved_is_a_failure(self):
printed = self.pull_with({"isResolved": False, "path": "a.py", "comments": {"nodes": [{"author": None}]}})
self.assertEqual(reviews.waiting_threads("7", lambda args: printed), Failure(f"gh api graphql printed no review threads: {printed[:200]}"))
def test_a_thread_waits_while_unresolved_with_a_reviewers_last_word(self):
printed = self.printed(("b.py", False, "rev"), ("a.py", False, "rev"), ("a.py", False, "rev"), ("c.py", True, "rev"), ("d.py", False, "me"))