Answer product-owner round 1: 0 🔴, 2 🟡 (0 misread); print the checks even where the epic stays, stop a do-epic that hangs, and state the sandbox's needs in the README

This commit is contained in:
2026-11-19 03:09:36 +01:00
parent 098bfddef9
commit b00470996b
6 changed files with 81 additions and 20 deletions
+13 -6
View File
@@ -1,4 +1,4 @@
"""What the e2e command does to a sandbox epic: runs the do-epic commands that need no tmux session and no worker, each as a process of its own against the real Jira site, and checks what the site holds after each."""
"""What the e2e command does to a sandbox epic: runs `do-epic --file`, `--record-decision` and `--close-epic`, each as a process of its own against the real Jira site, and checks what the site holds after each."""
import dataclasses
import os
import pathlib
@@ -16,6 +16,8 @@ from model_routing.ladder_file import read_ladder, SHIPPED
from project_config.settings import Epic, Finish
from record_store.jira_description import EpicDescription
# Seconds one do-epic command may take.
TIMEOUT = 300
RULE = "A label that equals a repo's name names that repo.\n"
@@ -32,13 +34,16 @@ class Report:
@dataclasses.dataclass(frozen=True)
class Machine:
"""A home folder of its own, holding the do-epic settings that point at the sandbox, so that nothing of the real home is read or written."""
"""A home folder of its own, holding the do-epic settings that point at the sandbox, so that do-epic writes its state there. The sandbox's env-file stays where it is."""
home: pathlib.Path
launcher: pathlib.Path
def do_epic(self, *args: str, stdin: str = "") -> subprocess.CompletedProcess[str]:
env = {**os.environ, "HOME": str(self.home)}
return subprocess.run([str(self.launcher), *args], input=stdin, env=env, capture_output=True, text=True, timeout=300, check=False)
try:
return subprocess.run([str(self.launcher), *args], input=stdin, env=env, capture_output=True, text=True, timeout=TIMEOUT, check=False)
except subprocess.TimeoutExpired:
return subprocess.CompletedProcess(args, 124, "", f"do-epic {' '.join(args)} ran over {TIMEOUT} seconds and was stopped")
def machine_made(home: pathlib.Path, sandbox: Sandbox, launcher: pathlib.Path) -> Machine | Failure:
@@ -81,7 +86,7 @@ def read(report: Report, store: JiraEpic, what: str) -> list[EpicIssue]:
def items_filed(report: Report, store: JiraEpic, epic_key: str) -> None:
"""The epic's own issues, which a person files in Jira: an item, its sub-task and a second item."""
"""Files an item, its sub-task and a second item in the epic, and checks that a read answers them in the tracker's order."""
parent = store.file(epic_key, "Sandbox item with a sub-task", "The first item.", (HUMAN_LABEL,))
second = store.file(epic_key, "Sandbox second item", "", ())
child = store.file(parent, "Sandbox sub-task", "", ()) if isinstance(parent, str) else parent
@@ -109,10 +114,12 @@ def decision_recorded(report: Report, machine: Machine, record: epic_record.Epic
def closed(report: Report, machine: Machine, store: JiraEpic, epic_key: str) -> None:
early = machine.do_epic(epic_key, finish.CLOSE, stdin="Too early.\n")
report.check(early.returncode == 1 and " open" in early.stderr and store.closed() is False, f"`do-epic {finish.CLOSE}` refuses while issues are open and leaves the epic open (exit {early.returncode}: {early.stderr.strip()})")
still = store.closed()
report.check(early.returncode == 1 and " open" in early.stderr and still is False, f"`do-epic {finish.CLOSE}` refuses while issues are open and leaves the epic open (exit {early.returncode}: {early.stderr.strip()}; epic closed: {still!r})")
for issue in read(report, store, "before finishing them"):
done = store.finish_issue(issue.key)
report.check(done is None, f"finish {issue.key}" + (f": {done.reason}" if isinstance(done, Failure) else ""))
late = machine.do_epic(epic_key, finish.CLOSE, stdin="Everything the sandbox epic held is done.\n")
report.check(late.returncode == 0 and "closed it" in late.stdout, f"`do-epic {finish.CLOSE}` posts the summary and closes the epic (exit {late.returncode}: {late.stdout.strip() or late.stderr.strip()})")
report.check(store.closed() is True, "Jira counts the epic as done")
now = store.closed()
report.check(now is True, f"Jira counts the epic as done (found {now!r})")