Answer product-owner round 1: 0 🔴, 5 🟡 (0 misread); merge allows a minute for checks to report, prepare-scoring replaces a stale setup, and the skill runs merge in the background

This commit is contained in:
2026-11-12 09:04:28 +01:00
parent c04864b6f0
commit eaa67bfcd9
9 changed files with 116 additions and 46 deletions
+6 -2
View File
@@ -7,7 +7,7 @@ holds a match. Without <pattern>, it waits until the file holds anything, and pr
line. It checks every 2 seconds and gives up after --timeout seconds, 540 by default, so it fits
one foreground call of the Bash tool, whose limit is 600 seconds.
Exit 0 on the line, 1 on the timeout or bad arguments, saying why.
Exit 0 on the line, 1 on the timeout, bad arguments or a file it cannot read, saying why.
"""
import pathlib
import re
@@ -27,12 +27,14 @@ class Clock(typing.Protocol):
def sleep(self, seconds: float) -> None: ...
def line_in(path: pathlib.Path, pattern: re.Pattern[str] | None) -> str | None:
def line_in(path: pathlib.Path, pattern: re.Pattern[str] | None) -> str | None | Failure:
"""The first line matching pattern, or without one the last line, where the file holds anything; else None."""
try:
lines = path.read_text(errors="replace").splitlines()
except FileNotFoundError:
return None
except OSError as error:
return Failure(f"cannot read {path}: {error.strerror}")
if pattern is None:
return lines[-1] if lines else None
return next((line for line in lines if pattern.search(line)), None)
@@ -48,6 +50,8 @@ def waited(file: str, pattern: str | None, timeout: float, clock: Clock = time)
if not path.exists():
return Failure(f"{file} did not appear in {timeout:g} s")
last = line_in(path, None)
if isinstance(last, Failure):
return last
wanted = f"no line matching `{pattern}`" if pattern is not None else "nothing"
return Failure(f"{file} held {wanted} after {timeout:g} s" + (f"; its last line: {last}" if last is not None else ""))
clock.sleep(min(POLL_SECONDS, left))