Park a chunk whose pull request waits on a gate, resume it when the gate opens, and print each chunk's state with do-epic --status
CI / tests (pull_request) Failing after 4m4s

This commit is contained in:
2026-11-18 23:17:07 +01:00
parent 1df19f4ac8
commit f0c8a26688
7 changed files with 344 additions and 30 deletions
+18
View File
@@ -192,3 +192,21 @@ def resume(epic: Epic, repo: str, window: tmux.Window, run: tmux.Tmux) -> str |
return None
except OSError as failure:
return f"cannot lock {failure.filename or epic.folder / LOCK}: {failure.strerror}"
def status(key: str, home: pathlib.Path, issues: list[EpicIssue], run: tmux.Tmux) -> list[str] | Failure:
"""A line per open issue of the epic called key, in the tracker's rank order: that its chunk runs, or why it waits. It starts nothing and checks no limit, so a chunk that has yet to start is told apart only from one that stopped."""
found, waits = chunks(issues)
parked = parked_chunks(home / STATE / key)
if isinstance(parked, Failure):
return parked
windows = tmux.listed(tmux.session_name(tmux.EPIC, key), run)
live = {window.name for window in windows if not window.dead}
again = f"run `do-epic {key}` to start it again"
reasons = {wait.issue: wait.reason for wait in waits}
for chunk in found:
if chunk.issue in parked:
reasons[chunk.issue] = parked[chunk.issue].waits + ("" if chunk.issue in live else f", and its window stopped; {again}")
elif chunk.issue not in live:
reasons[chunk.issue] = f"its window stopped; {again}" if chunk.issue in {window.name for window in windows} else f"it has not started; `do-epic {key}` starts it once the epic and its repo have room"
return [f"{issue.key} waits: {reasons[issue.key]}" if issue.key in reasons else f"{issue.key} runs" for issue in issues if issue.key in reasons or issue.key in live]