Answer prose round 1: 1 🔴, 3 🟡 (0 misread); sort the README entry, and reword the docstrings and comments the reviewer misread
CI / tests (pull_request) Successful in 2m56s

This commit is contained in:
2026-11-14 16:56:58 +01:00
parent 0f2cb3557f
commit 2fb0e7be5a
2 changed files with 10 additions and 12 deletions
+1 -1
View File
@@ -165,9 +165,9 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests. Beside the packages, `bin/`'s root holds only the launchers, the tools of one file with their tests, `test_env.py`, `failure.py` and `setup.cfg`. `failure.py`'s `Failure`, which modules across `bin/` return for a failed step, belongs to no single package. `branch_chunks/`, `claude_code/`, `command_lines/`, `git_cli/`, `loop_effects/`, `loop_state/`, `machine_load/`, `mattermost_dm/`, `model_routing/`, `plan_store/`, `record_store/`, `release_plan/`, `review_rules/`, `rung_replay/`, `text_files/` and `transcript_archive/` serve more than one tool.
- `adf_codec/` converts markdown to ADF, the rich text of Jira Cloud and Confluence, and back, in a throwaway container running a pinned `@larvit/adf-codec`.
- `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes` and `routing_figures`. It imports `reading_cost`'s record path.
- `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`.
- `adf_codec/` converts markdown to ADF (the rich text of Jira Cloud and Confluence) and back, with `@larvit/adf-codec`'s portable calls in a throwaway container: `convert.py` is the Python side, `node_shim/` the pinned Node shim and its Dockerfile. No tool calls it yet.
- `chunk_pr` imports `deploy_release`'s forge calls, and `forge_of` as `deploy_release` does.
- `deploy_release` imports `chunk_preflight`'s `forge_of`, which tells a GitHub origin from a Gitea one, and `release_plan`'s `release_standing`.
- `git_cli/` runs git for every tool (`git_repo.py`), and reads the git calls in a shell command (`git_command.py`).
+9 -11
View File
@@ -1,8 +1,6 @@
"""Converts markdown to ADF (Atlassian Document Format, the rich text of Jira Cloud and Confluence) and back.
It runs @larvit/adf-codec's portable calls in a throwaway container, since adf-codec is a Node package:
`portableMarkdownToAdf` to write ADF and `adfToPortableMarkdown` to read it. The container holds node_shim/shim.mjs,
whose exit status says what happened: 0 answered, 2 adf-codec refused the input (its error code is in the Failure), 1 the shim itself failed.
It runs @larvit/adf-codec, a Node package, in a throwaway container that holds node_shim/shim.mjs; the shim's header says what its exit status means.
"""
import dataclasses
import hashlib
@@ -15,7 +13,7 @@ from failure import Failure
SHIM = pathlib.Path(__file__).resolve().parent / "node_shim"
SHIM_FILES = ("Dockerfile", "package.json", "package-lock.json", "shim.mjs")
# Both limits are equal, so the container can't swap: a document too big for it ends in a Failure, not in a slow machine.
# `--memory` and `--memory-swap` both take this, so the container can't swap: a document too big for it ends in a Failure.
MEMORY = "256m"
RUN_SECONDS = 60
BUILD_SECONDS = 300
@@ -29,14 +27,14 @@ class Ran:
err: str
# Runs the shim in the given mode (`to-adf` or `to-markdown`) on a text, or fails to start it.
# Runs the shim in the given mode (`to-adf` or `to-markdown`) on a text, or fails to run it.
Run = typing.Callable[[str, str], Ran | Failure]
# Runs a docker command line on a text, in at most the given seconds, or fails to start it.
# Runs a docker command line on a text, in at most the given seconds, or fails to run it.
Docker = typing.Callable[[list[str], str, int], Ran | Failure]
def image_tag(shim: pathlib.Path) -> str:
"""A tag that changes with every file the image is built from, so an edited shim or a bumped adf-codec rebuilds it."""
"""A tag that changes with every file the image is built from, so an edited shim or a bumped adf-codec builds a new image."""
digest = hashlib.sha256()
for name in SHIM_FILES:
digest.update((shim / name).read_bytes())
@@ -58,7 +56,7 @@ def docker(args: list[str], text: str, seconds: int, call: typing.Callable[...,
def ensure_image(shim: pathlib.Path, run_docker: Docker = docker) -> str | Failure:
"""The tag of the shim's image, built from node_shim/ first where this machine has no image under that tag."""
"""The tag of the image for the shim folder, built from that folder first where this machine has no image under that tag."""
tag = image_tag(shim)
found = run_docker(["docker", "image", "inspect", tag], "", RUN_SECONDS)
if isinstance(found, Failure) or found.status == 0:
@@ -79,7 +77,7 @@ def container_run(mode: str, text: str, run_docker: Docker = docker, shim: pathl
def answer(mode: str, text: str, run: Run) -> str | Failure:
"""What the shim printed for text, or a Failure saying why it printed none."""
"""What the shim printed for text, or a Failure saying why it gave no answer."""
ran = run(mode, text)
if isinstance(ran, Failure):
return ran
@@ -100,7 +98,7 @@ def refusal(out: str) -> Failure:
def markdown_to_adf(markdown: str, run: Run = container_run) -> dict[str, typing.Any] | Failure:
"""The ADF document markdown reads as."""
"""The ADF document for the markdown."""
out = answer("to-adf", markdown, run)
if isinstance(out, Failure):
return out
@@ -112,5 +110,5 @@ def markdown_to_adf(markdown: str, run: Run = container_run) -> dict[str, typing
def adf_to_markdown(document: dict[str, typing.Any], run: Run = container_run) -> str | Failure:
"""The markdown an ADF document reads as."""
"""The markdown for the ADF document."""
return answer("to-markdown", json.dumps(document), run)