Answer prose round 1: 0 🔴, 11 🟡 (0 misread); loop-claude and do-epic are entry points everywhere, and each new sentence holds one idea
CI / tests (pull_request) Successful in 3m40s

This commit is contained in:
2026-11-19 13:44:20 +01:00
parent 2806a8edc9
commit aafe75e16f
10 changed files with 26 additions and 27 deletions
+3 -3
View File
@@ -65,12 +65,12 @@ def docker_args(image: str, mode: str) -> list[str]:
def docker(args: list[str], text: str, seconds: int) -> Ran | Failure:
"""Runs a docker command line as a process of this one: the shim's shell, as git_repo.git is git's."""
"""docker_ran with subprocess.run: the one place that starts docker as a process."""
return docker_ran(args, text, seconds, subprocess.run)
def docker_ran(args: list[str], text: str, seconds: int, call: typing.Callable[..., typing.Any]) -> Ran | Failure:
"""What call, which runs a command line as subprocess.run does, made of a docker command line on text."""
"""Runs a docker command line through call, with text on its stdin: what it exited with and printed, or a Failure where docker is missing or takes more than seconds. call runs a command line as subprocess.run does."""
try:
done = call(args, input=text, capture_output=True, text=True, encoding="utf-8", timeout=seconds)
except FileNotFoundError:
@@ -82,7 +82,7 @@ def docker_ran(args: list[str], text: str, seconds: int, call: typing.Callable[.
@contextlib.contextmanager
def machine_slot() -> typing.Iterator[Failure | None]:
"""heavy_slot on this process's environment, home, processors, stderr and clock: the shim's shell, as docker is."""
"""heavy_slot with this process's environment, home folder, processor count, stderr, sleep and flock."""
with heavy_slot(os.environ, pathlib.Path.home(), slot_count(usable_cpus()), lambda text: print(text, file=sys.stderr, flush=True), time.sleep, fcntl.flock) as refused:
yield refused
+3 -3
View File
@@ -1,4 +1,4 @@
"""What every reader of Jira Cloud's REST API version 3 shares: a search read page by page, the head of each entry it answers, an issue's "is blocked by" links, and the transition that finishes an issue."""
"""What every reader of Jira Cloud's REST API version 3 shares: a search read page by page, the key, fields, "is blocked by" links and property of each issue it finds, checked for their shape, and the transition that finishes an issue."""
import dataclasses
import re
import typing
@@ -32,7 +32,7 @@ class Link:
@dataclasses.dataclass(frozen=True)
class Entry:
"""The head of one entry of a search's answer, which every reader checks alike."""
"""The key, fields, links and property of one issue a search finds, which every reader checks alike."""
key: str
# The entry's `fields`, from which each reader takes the ones it asked for.
fields: dict[str, typing.Any]
@@ -42,7 +42,7 @@ class Entry:
def entry_of(raw: object, property_: str) -> Entry | Failure:
"""The head of one entry of a search's answer, or which issue is not in the shape Jira documents, and how. property_ names the issue property the search asked for."""
"""The Entry of one issue a search finds, or which issue is not in the shape Jira documents, and how. property_ names the issue property the search asked for."""
key = raw.get("key") if isinstance(raw, dict) else None
if not isinstance(raw, dict) or not isinstance(key, str) or not ISSUE_KEY.fullmatch(key):
return Failure("the search answered an issue without an issue key")
+3 -3
View File
@@ -57,12 +57,12 @@ def get_or_ask_model(project_key: str, paths: Paths, driver: str, effects: Effec
def save_model(project_key: str, chosen: str, paths: Paths, replace: typing.Callable[[pathlib.Path, bytes], Failure | None]) -> Failure | None:
"""Adds the project's model to the models file, whose only writer this is, through replace, which writes a file as replace_file does. It holds MODELS_LOCK from its read to its write, so two drivers that save at once both keep their pick."""
"""Adds the project's model to the models file, whose only writer this is, through replace, which writes a file as replace_file does. It holds MODELS_LOCK from its read to its write, so two entry points that save at once both keep their pick."""
saved = paths.models_file
with locked(paths.home / CLAIMS / MODELS_LOCK) as unlocked:
if unlocked:
return Failure(f"could not save the model in {saved}: {unlocked.reason}")
# Read under the lock: another driver may have saved its project while this one waited on the human.
# Read under the lock: another entry point may have saved its project while this one waited on the human.
models = read_models_file(saved)
if isinstance(models, Failure):
return models
@@ -72,7 +72,7 @@ def save_model(project_key: str, chosen: str, paths: Paths, replace: typing.Call
def read_models_file(saved: pathlib.Path) -> dict[str, str] | Failure:
"""Each project's model, as the models file at saved maps them; none where there is no such file. The chunk drivers and the replay tools read it, and only save_model writes it."""
"""Each project's model, as the models file at saved maps them; none where there is no such file. The entry points, loop-claude and do-epic, and the replay tools read it."""
try:
with open(saved, encoding="utf-8") as handle:
models = json.load(handle)
+3 -3
View File
@@ -68,11 +68,11 @@ class PullView:
# Empty where its branch protection asks for no review.
decision: str
reviews: tuple[Review, ...]
# When its author submitted each review and made each comment. A review the author has yet to submit has no time: it is empty, and answers nobody.
# When its author submitted each review and made each comment. A review the author has yet to submit has an empty time, and doesn't answer anyone.
said: tuple[str, ...]
# What `held` gives where the answer lacks the key asked for: no text, so the check of the field refuses it.
# What `held` gives where the answer lacks the key asked for: of no type a field may have, so each field's check refuses it.
MISSING = object()
@@ -116,7 +116,7 @@ def pull_view(printed: str) -> PullView | Failure:
def answered(pull: PullView, head: str) -> bool:
"""Whether the worker answered the newest review that requested changes on pull, whose head commit is head: the head is no longer the commit that review was made on, or the pull request's author commented or replied in a thread after it. False where pull lists no review that requested changes.
The review names its commit, so no clock tells whether the worker pushed: a commit's date says when it was made, never when it was pushed.
The review names the commit it was made on, so a head that differs shows the worker pushed. A commit's date cannot show that: it says when the commit was made, never when it was pushed.
"""
asked = max((review for review in pull.reviews if review.state == CHANGES_REQUESTED), key=lambda review: review.submitted_at, default=None)
if asked is None:
+1 -1
View File
@@ -54,7 +54,7 @@ def id_of(answer: object, request: str) -> str | Failure:
return found if isinstance(found, str) and found else Failure(f"{request} answered without an id")
# request is json_request.http_json, but in the test of what this hands it.
# request is json_request.http_json, except in the test of what this hands it.
def http_json(method: str, url: str, token: str, body: object, request: typing.Callable[[str, str, str, object, int, MessageOf], object] = json_request.http_json) -> object:
"""The JSON that url answers to the bot's request, None where the answer has no body, or a Failure saying why there is none."""
return request(method, url, f"Bearer {token}", body, TIMEOUT, error_message)
+1 -1
View File
@@ -42,7 +42,7 @@ def send(config: Config, message: str, http: Http) -> Failure | None:
return Failure(f"POST /api/chat.postMessage refused the message: {error if isinstance(error, str) and error else 'no error code'}")
# request is json_request.http_json, but in the test of what this hands it.
# request is json_request.http_json, except in the test of what this hands it.
def http_json(method: str, url: str, token: str, body: object, request: typing.Callable[[str, str, str, object, int, MessageOf], object] = json_request.http_json) -> object:
"""The JSON that url answers to the bot's request, None where the answer has no body, or a Failure saying why there is none."""
return request(method, url, f"Bearer {token}", body, TIMEOUT, error_message)
+1 -1
View File
@@ -105,7 +105,7 @@ LETTERS = ("L", "E", "I", "S")
NAMED = {"release": "Release", "blocked_by": BLOCKED_BY, "exempt": "Exempt", "tagline": TAGLINE, "moves": MOVES}
# plan_of is plan_store, but in the tests of a plan in Jira, which hand it a plan in memory.
# plan_of is plan_store, except in the tests of a plan in Jira, which hand it a plan in memory.
def main(argv: list[str], folder: pathlib.Path, home: pathlib.Path, stdin: typing.TextIO, plan_of: typing.Callable[[ProjectConfig], PlanStore] = plan_store) -> int:
if argv[:1] in (["-h"], ["--help"]):
print(__doc__.strip())