Answer principles round 1: 0 🔴, 1 🟡 (0 misread); chunk-pr's step takes its sleep and the tests fail on a wait; Rust test files read once per bench, the indent count bounded, and six nits
CI / tests (pull_request) Successful in 4m38s
CI / tests (pull_request) Successful in 4m38s
This commit is contained in:
+6
-3
@@ -18,7 +18,8 @@ PAGE_SIZE = 50
|
||||
# How long shown_pull waits for the forge to show the pushed commit as the head of the branch's open pull request, polling every PUSH_POLL_SECONDS: GitHub may list the old head for a while after a push.
|
||||
PUSH_SECONDS = 60
|
||||
PUSH_POLL_SECONDS = 5
|
||||
# What gh says of a pull request whose head has no check.
|
||||
# What gh says of a pull request whose head has no check. gh exits 1 for it, as for a failed check, so only the text tells the two apart. gh
|
||||
# doesn't document the text; it is read from gh 2.102.0's `pr checks`, whose source words it "no checks reported on the '<branch>' branch".
|
||||
NO_CHECKS = "no checks reported"
|
||||
|
||||
|
||||
@@ -32,11 +33,12 @@ def pull_from(forge: Forge, branch: str, run: Run) -> str | None | Failure:
|
||||
return pull_at(forge, branch, None, "open", run)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class StaleHead(Failure):
|
||||
"""The forge still lists a pull request at an older head than the one pushed."""
|
||||
|
||||
|
||||
def shown_pull(forge: Forge, branch: str, head: str, run: Run, sleep: typing.Callable[[float], None]) -> str | None | Failure:
|
||||
def shown_pull(forge: Forge, branch: str, head: str, run: Run, sleep: typing.Callable[[float], None]) -> str | None | StaleHead | Failure:
|
||||
"""The number of branch's open pull request at head, just pushed; None where the branch has no open pull request. Right after a push the forge may still list that pull request at an older head. While it does, this polls for up to PUSH_SECONDS, and is then a StaleHead that names the pull request."""
|
||||
other = None
|
||||
for waited in range(0, PUSH_SECONDS + 1, PUSH_POLL_SECONDS):
|
||||
@@ -101,7 +103,8 @@ def ready_pulls(forge: Forge, run: Run) -> list[ReadyPull] | Failure:
|
||||
rows = [line.split("\t") for line in listed.splitlines()]
|
||||
found = [ReadyPull(*row[:3]) for row in rows if row[3:] == ["false", "false"]]
|
||||
else:
|
||||
pulls = gitea(run, "repos/{owner}/{repo}/pulls?state=open&limit=50")
|
||||
# A limit: an awaited pull request past the first page of open ones, drafts and forks counted, is not seen.
|
||||
pulls = gitea(run, f"repos/{{owner}}/{{repo}}/pulls?state=open&limit={PAGE_SIZE}")
|
||||
if isinstance(pulls, Failure):
|
||||
return pulls
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user