nisse-review: one unlistable repository holds up no other
Found at bring-up: an empty private repository's /pulls answered 404, and intake stopped there, so the whole round failed and nothing was reviewed. A repository whose PRs can't be listed is now logged (intake.repo_failed) and skipped for the round; its items stay as they are. Also, from nisse-review's review of this PR: a two-page test pins the search listing the patterns rest on. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk
This commit is contained in:
1 parent
faf973be6c
commit
6e697b55a8
4 files changed
+43
-1
No files matched your search
@@ -72,6 +72,7 @@ class FakeGitea:
|
||||
down: bool = False
|
||||
# Readable but not given (public, no grant): missing from /user/repos.
|
||||
public: set[str] = field(default_factory=set)
|
||||
unlisted: set[str] = field(default_factory=set) # its PRs can't be listed
|
||||
|
||||
def _up(self) -> None:
|
||||
if self.down:
|
||||
@@ -99,6 +100,8 @@ class FakeGitea:
|
||||
|
||||
def open_pull_requests(self, repo: str) -> list[PullRequest]:
|
||||
self._up()
|
||||
if repo in self.unlisted:
|
||||
raise GiteaNotFound(f"gitea GET /repos/{repo}/pulls returned 404")
|
||||
return list(self.repos[repo])
|
||||
|
||||
def pull_request(self, repo: str, index: int) -> PullRequest:
|
||||
|
||||
@@ -328,6 +328,20 @@ def test_patterns_reach_public_repositories_the_account_was_not_given(
|
||||
assert w["store"].work_item("infra/tofu#3") is None
|
||||
|
||||
|
||||
def test_a_repository_whose_prs_cannot_be_listed_holds_up_no_other(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
# Found at bring-up: an empty private repository's /pulls was a 404,
|
||||
# and the round stopped there, so no repository was reviewed.
|
||||
gitea = FakeGitea(repos={"a/empty": [], REPO: [pr()]}, unlisted={"a/empty"})
|
||||
out = io.StringIO()
|
||||
w = world(tmp_path, Scripted(*REVIEW), gitea)
|
||||
w["scheduler"]._oplog = OpLog("t", out)
|
||||
assert w["scheduler"].round() is True # REPO's PR was reviewed
|
||||
assert item(w).position == REVIEWED
|
||||
assert '"intake.repo_failed"' in out.getvalue() and "a/empty" in out.getvalue()
|
||||
|
||||
|
||||
def test_a_configured_repository_it_cannot_read_is_left_out() -> None:
|
||||
gitea = FakeGitea(repos={REPO: []})
|
||||
out = io.StringIO()
|
||||
|
||||
Reference in new issue
Block a user