Answer principles round 2: 0 🔴, 2 🟡 (0 misread); workflow-bench hands its effects in as arguments, and no Python file of the repo patches a global
CI / tests (pull_request) Successful in 3m46s
CI / tests (pull_request) Successful in 3m46s
This commit is contained in:
@@ -165,8 +165,8 @@ def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str
|
||||
now = start_chunk(epic, chunk if chunk.issue not in parked else Chunk(chunk.issue, None), own, windows, run)
|
||||
if isinstance(now, Failure):
|
||||
return now
|
||||
if isinstance(now, str):
|
||||
waits.append(Waits(chunk.issue, now))
|
||||
if isinstance(now, Waits):
|
||||
waits.append(now)
|
||||
else:
|
||||
windows = now
|
||||
started.append(chunk.issue)
|
||||
@@ -176,8 +176,8 @@ def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str
|
||||
return Started(started, sorted(waits, key=lambda wait: order.index(wait.issue)))
|
||||
|
||||
|
||||
def start_chunk(epic: Epic, chunk: Chunk, own: str | None, windows: list[tmux.Listed], run: tmux.Tmux) -> list[tmux.Listed] | str | Failure:
|
||||
"""Starts chunk's window beside windows, the epic's session's, and returns the session's windows afterwards; the reason where its repo takes no chunk now, and a Failure where tmux started none, or where the repo's lock cannot be taken. It holds that lock from the check to the start. A chunk without a repo starts in the epic's folder. So does a parked chunk, since it takes no room in its repo."""
|
||||
def start_chunk(epic: Epic, chunk: Chunk, own: str | None, windows: list[tmux.Listed], run: tmux.Tmux) -> list[tmux.Listed] | Waits | Failure:
|
||||
"""Starts chunk's window beside windows, the epic's session's, and returns the session's windows afterwards; a Waits with the reason where its repo takes no chunk now, and a Failure where tmux started none, or where the repo's lock cannot be taken. It holds that lock from the check to the start. A chunk without a repo starts in the epic's folder. So does a parked chunk, since it takes no room in its repo."""
|
||||
session = tmux.session_name(tmux.EPIC, epic.key)
|
||||
handed = {**{name: value for name, value in epic.env.items() if name.startswith(HANDED)}, PARKS: "1"}
|
||||
command = [str(epic.launcher), CHUNK_FLAG, chunk.issue, epic.key]
|
||||
@@ -185,13 +185,13 @@ def start_chunk(epic: Epic, chunk: Chunk, own: str | None, windows: list[tmux.Li
|
||||
return tmux.start_chunk(tmux.Window(session, chunk.issue, ""), str(epic.folder), handed, command, windows, False, run)
|
||||
located = epic.locate(chunk.repo)
|
||||
if isinstance(located, Failure):
|
||||
return located.reason
|
||||
return Waits(chunk.issue, located.reason)
|
||||
checkout, limit = located
|
||||
with starting(project_lock(str(checkout), epic.home)) as unlocked:
|
||||
if unlocked:
|
||||
return unlocked
|
||||
if reason := refusal(chunk.repo, room_in(str(checkout), limit, (session, own), epic.home, run)):
|
||||
return reason
|
||||
return Waits(chunk.issue, reason)
|
||||
return tmux.start_chunk(tmux.Window(session, chunk.issue, ""), str(checkout), handed, command, windows, False, run)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user