Answer stability round 1: 1 🔴, 3 🟡 (0 misread); call project-config by its path in the README, pin the run-heavy breach, say who has the tools on PATH
CI / tests (pull_request) Has been cancelled
CI / tests (pull_request) Has been cancelled
This commit is contained in:
@@ -10,7 +10,7 @@ RELEASE_ROOT = pathlib.Path(__file__).resolve().parents[2]
|
||||
|
||||
# Each folder below is named relative to the person's home folder.
|
||||
|
||||
# The Claude home: Claude Code's own folder, with its settings and transcripts. A release is deployed into it, so the release's CLAUDE.md, rules/ and agents/ are read from it.
|
||||
# The Claude home: Claude Code's own folder, with its settings and transcripts. A release is deployed into it, so its CLAUDE.md, rules/ and agents/ are read from it.
|
||||
CLAUDE_HOME = ".claude"
|
||||
# The config folder, which holds one folder per project, and do-epic's.
|
||||
CONFIG_FOLDER = ".claude-projects"
|
||||
@@ -18,8 +18,9 @@ CONFIG_FOLDER = ".claude-projects"
|
||||
STATE_FOLDER = ".local/state"
|
||||
|
||||
|
||||
# Only a claude started through this has the tools on PATH. One a person starts by hand lacks them, as their shell does: short names such as `wait-for` stay out of it, and README.md → Tools says how to call a tool there.
|
||||
def with_release_tools(env: Mapping[str, str]) -> dict[str, str]:
|
||||
"""env with the release's tools first on `PATH`: what every claude the loop starts runs in, so its Bash tool and its hooks find each tool by its bare name."""
|
||||
"""env with the release's tools first on `PATH`: what every claude the loop or `task-bench` starts runs in, so its Bash tool finds each tool by its bare name, and so does a hook's own script."""
|
||||
tools = str(RELEASE_ROOT / "bin")
|
||||
rest = env.get("PATH", "")
|
||||
if rest.split(os.pathsep)[0] == tools:
|
||||
|
||||
@@ -228,7 +228,7 @@ class BlackBox(unittest.TestCase):
|
||||
top = self.project("# Comprehension history\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `README.md:1` \"Install\"\n")
|
||||
ran = self.run_tool(top)
|
||||
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
|
||||
self.assertIn("no scoring run in", ran.stderr)
|
||||
self.assertRegex(ran.stderr, r"no scoring run in \S+ could be scored; its format is what larv-review writes")
|
||||
|
||||
def test_exits_1_naming_a_history_it_cannot_read_and_unknown_arguments(self):
|
||||
top = self.project("")
|
||||
|
||||
@@ -6,10 +6,14 @@ from repo_checks import ROOT
|
||||
|
||||
# A tool spelled by its place in an install folder, as opposed to a source file under bin/, which a reader opens by its path. A session the loop starts has the release's tools on PATH, so prose names a tool bare, and works wherever the release is installed.
|
||||
BY_ITS_FOLDER = re.compile(r"(?:~|\$HOME)/\.claude/bin/[\w.<>-]+(?![\w.<>/-])")
|
||||
# The files that record what was once so, which nobody runs a command from.
|
||||
HISTORY = ("CHANGELOG.md", "todo.md", "docs/")
|
||||
# README.md → Install links loop-claude and compress-archives from a shell and a crontab, which lack the tools, and says how to run any other tool there.
|
||||
INSTALL = {"~/.claude/bin/loop-claude", "$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>"}
|
||||
# The plan, the changelog and the records: their text names a tool as it was spelled when the line was written, and nobody rewrites it.
|
||||
HISTORY = ("CHANGELOG.md", "docs/", "todo.md")
|
||||
# The lines a person runs in their own shell or a crontab, which lack the tools: only `loop-claude` is linked onto their `PATH`.
|
||||
BY_HAND = {
|
||||
"README.md": {"$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>", "~/.claude/bin/loop-claude", "~/.claude/bin/notify", "~/.claude/bin/project-config"},
|
||||
"presentation/README.md": {"~/.claude/bin/run-heavy"},
|
||||
"presentation/build-pdf.py": {"~/.claude/bin/run-heavy"},
|
||||
}
|
||||
# settings.json names its hooks and its status line by their folder, and the test of the reviewer hook quotes it. Claude Code reads the file in every session, also one the human starts without the tools on PATH. A hook it cannot find doesn't refuse anything, so a bare name there would switch rule-hook off in that session.
|
||||
SETTINGS = ("settings.json", "bin/review_rules/test_reviewer_context.py")
|
||||
|
||||
@@ -24,7 +28,7 @@ class ToolsNamedBare(unittest.TestCase):
|
||||
if name.startswith(HISTORY) or name in SETTINGS or name == "bin/repo_checks/test_tools_named_bare.py" or not path.is_file():
|
||||
continue
|
||||
for number, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), 1):
|
||||
found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line) if not (name == "README.md" and spelled in INSTALL)]
|
||||
found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line) if spelled not in BY_HAND.get(name, ())]
|
||||
|
||||
self.assertEqual(found, [], "name each tool bare, as in `todo-item`")
|
||||
|
||||
|
||||
@@ -128,6 +128,10 @@ class CommandBreaches(unittest.TestCase):
|
||||
with self.subTest(command):
|
||||
self.assertEqual(checked(command), ["run-heavy"])
|
||||
|
||||
def test_the_run_heavy_breach_quotes_the_first_80_characters_of_the_command_and_names_its_folder(self):
|
||||
command = "docker build -t " + "x" * 80 + " ."
|
||||
self.assertEqual(breaches(command), [Breach("run-heavy", f"run `{command[:80]}` under `run-heavy`, in the background", "/r")])
|
||||
|
||||
def test_a_heavy_command_under_run_heavy_or_a_light_docker_or_mutmut_call_passes(self):
|
||||
for command in ["~/tools/run-heavy docker build -t x .", "/home/me/.claude/bin/run-heavy uvx mutmut run", "nice -n 19 ~/tools/run-heavy docker build .", "env X=1 run-heavy docker compose run app mutmut run", "docker images", "docker compose run --rm app go vet", "docker compose run app make build", "uvx 'mutmut>=3,<4' results", "echo docker build", "npx prettier --check infection.json5", "echo mutmut run", "env", "docker build --help", "cargo mutants --list", "infection --version", "uvx mutmut a b run", "run-heavy mutate-changes --jobs 2", "mutate-changes --help"]:
|
||||
with self.subTest(command):
|
||||
|
||||
Reference in New Issue
Block a user