Answer architecture round 1: 0 🔴, 3 🟡 (0 misread); move docker's parsing to bin/ for item 227's shim, read launchers once in shell_command.launched, and give the memory limit its own decision, sized to what the work needs

This commit is contained in:
2026-10-24 00:31:41 +02:00
parent 7b61fd5b4b
commit a292ec4cae
9 changed files with 89 additions and 67 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ from git_command import commits
from rule_hook.heavy_command import heavy
from review_folder import REPORTS
from shell_command import Simple
from rule_hook.docker_command import unlimited_container
from docker_command import unlimited_container
RuleName = typing.Literal["action-pin", "commit-one-line", "docker-run-memory", "ignorefile-sorted", "image-pin", "no-ai-attribution", "reviewer-report", "reviewer-rung", "round-cap", "round-title-counts", "run-heavy", "todo-rank-check"]
@@ -31,7 +31,7 @@ RULES: dict[RuleName, Rule] = {
"git commit takes its message as one -m with no line break; -F, a second -m and a heredoc are blocked",
),
"docker-run-memory": Rule(
"a container started with docker run or docker create has a memory limit, such as `--memory 4g --memory-swap 4g`, so one runaway container cannot starve the machine; --memory-swap equal to --memory keeps it out of swap",
"a container started with docker run or docker create has a memory limit, as large as its work needs, such as `--memory 4g --memory-swap 4g`, so one runaway container cannot starve the machine; --memory-swap equal to --memory keeps it out of swap",
"docker run, docker create, docker container run and docker container create, whether direct or through a launcher such as nice. A container a script or docker compose starts is not checked",
),
"ignorefile-sorted": Rule(
@@ -138,7 +138,7 @@ def command_breaches(command: str, simples: list[Simple], home: str) -> list[Bre
if heavy(simple.words):
breaches.append(Breach("run-heavy", f"run `{' '.join(simple.words)[:80]}` under `~/.claude/bin/run-heavy`, in the background", simple.directory))
if unlimited_container(simple.words):
breaches.append(Breach("docker-run-memory", f"give `{' '.join(simple.words)[:80]}` a memory limit, such as `--memory 4g --memory-swap 4g`", simple.directory))
breaches.append(Breach("docker-run-memory", f"give `{' '.join(simple.words)[:80]}` a memory limit as large as its work needs, such as `--memory 4g --memory-swap 4g`", simple.directory))
for commit in found:
if commit.from_file:
breaches.append(Breach("commit-one-line", "pass the message as one -m '<line>', not from a file", commit.directory))