Skip to content

Commit e28008d

Browse files
committed
Don't rely on subject name when determinig PR for the series
The fix in series to git branch mapping 88cb274 made _guess_pr() to work incorrectly due to a wrong assumption there. _guess_pr() looks up a known open PR *by subject name*, which may not necessarily be the right PR for a given series. Before 88cb274 the branch name was (incorrectly) based on the oldest series id. However currently open PRs still use the wrong branch name. _guess_pr() then returns a wrong cached PR/branch. This leads to an exception in apply_push_comment(), because it tries to verify that PR was successfully updated, but looks at a wrong PR. Fix this by not using lookup in local cache by name in guess_pr(). Differential Revision: D79654888 Reviewed-by: Jordan Rome <[email protected]> Signed-off-by: Ihor Solodrai <[email protected]>
1 parent 56af211 commit e28008d

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

kernel_patches_daemon/branch_worker.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,6 @@ async def _guess_pr(
767767
- try to guess based on first series
768768
"""
769769

770-
# try to find amond known relevant PRs
771-
if series.subject in self.prs:
772-
return self.prs[series.subject]
773-
774770
if not branch:
775771
# resolve branch: series -> subject -> branch
776772
subject = Subject(series.subject, self.patchwork)

tests/test_branch_worker.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -633,16 +633,6 @@ def test_delete_branches(self) -> None:
633633
ggr.assert_called_once_with(f"heads/{branch_deleted}")
634634
ggr.return_value.delete.assert_called_once()
635635

636-
@aioresponses()
637-
async def test_guess_pr_return_from_active_pr_cache(self, m: aioresponses) -> None:
638-
# Whatever is in our self.prs's cache dictionary will be returned.
639-
series = Series(self._pw, SERIES_DATA)
640-
sentinel = random.random()
641-
# pyre-fixme[6]: For 2nd argument expected `PullRequest` but got `float`.
642-
self._bw.prs["foo"] = sentinel
643-
pr = await self._bw._guess_pr(series)
644-
self.assertEqual(sentinel, pr)
645-
646636
async def test_guess_pr_return_from_secondary_cache_with_specified_branch(
647637
self,
648638
) -> None:

0 commit comments

Comments
 (0)