Answer stability round 1: 0 🔴, 4 🟡 (0 misread); test that cut-release cuts the clone it ships in and refuses an option as --patch's commits, name both new packages in item 392, and correct the comment on PATH
This commit is contained in:
@@ -75,7 +75,7 @@ def cut(clone: str, sleep: typing.Callable[[float], None], say: Say) -> str | Fa
|
||||
return pushed
|
||||
say(f"pushed the tag {tag}")
|
||||
delete_release_branch(clone, branch, say)
|
||||
return f"Done: {tag} is cut and pushed. Each clone of a release takes it with its bin/self-update."
|
||||
return f"Done: {tag} is cut and pushed. Each clone of a release takes it with its own bin/self-update."
|
||||
|
||||
|
||||
def patch_refusal(clone: str, ref: str, release: Release) -> Failure | None:
|
||||
|
||||
@@ -71,7 +71,7 @@ def cut_patch(clone: str, commits: str, sleep: typing.Callable[[float], None], s
|
||||
if isinstance(git("merge-base", "--is-ancestor", tag, patch.ref, cwd=clone), Failure):
|
||||
return Failure(f"the merge-back merged, but {patch.ref} doesn't hold {tag}, so the next cut can't read it as cut")
|
||||
delete_release_branch(clone, branch, say)
|
||||
return f"Done: {tag} is cut and pushed. Each clone of a release takes it with its bin/self-update."
|
||||
return f"Done: {tag} is cut and pushed. Each clone of a release takes it with its own bin/self-update."
|
||||
|
||||
|
||||
def planned(clone: str, commits: str) -> Patch | Failure:
|
||||
|
||||
@@ -3,6 +3,7 @@ import io
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -19,7 +20,6 @@ from failure import Failure
|
||||
from test_env import isolated_env
|
||||
|
||||
BIN = pathlib.Path(__file__).resolve().parents[1]
|
||||
TOOL = BIN / "cut-release"
|
||||
# cut-release cuts the clone it ships in, so the tests hand its main the clone to cut.
|
||||
CUT = [sys.executable, "-c", "import sys; sys.path.insert(0, sys.argv[1]); from cut_release import main; sys.exit(main.main(sys.argv[3:], sys.argv[2]))", str(BIN)]
|
||||
|
||||
@@ -157,8 +157,8 @@ class Cut(unittest.TestCase):
|
||||
def set_checks(self, checks: str) -> None:
|
||||
self.forge_state({**self.forge_state(), "checks": checks})
|
||||
|
||||
def cut(self) -> subprocess.CompletedProcess[str]:
|
||||
return subprocess.run([*CUT, str(self.clone)], capture_output=True, env=self.env, text=True)
|
||||
def cut(self, *args: str) -> subprocess.CompletedProcess[str]:
|
||||
return subprocess.run([*CUT, str(self.clone), *args], capture_output=True, env=self.env, text=True)
|
||||
|
||||
def origin_git(self, *args: str) -> str:
|
||||
return self.git(self.temp, "--git-dir", str(self.origin), *args)
|
||||
@@ -185,6 +185,14 @@ class Cut(unittest.TestCase):
|
||||
self.assertEqual(self.git(self.clone, "rev-parse", "HEAD"), head, "the clone's own checkout stays where it was")
|
||||
self.assertEqual(self.git(self.clone, "status", "--porcelain"), "")
|
||||
|
||||
def test_cuts_the_clone_it_ships_in_whatever_the_directory_it_is_run_from(self):
|
||||
# The tools are untracked in this clone, so the cut leaves them as they are.
|
||||
shutil.copytree(BIN, self.clone / "bin", ignore=shutil.ignore_patterns("test_*", "__pycache__"))
|
||||
|
||||
ran = subprocess.run([sys.executable, str(self.clone / "bin" / "cut-release")], capture_output=True, cwd=self.temp, env=self.env, text=True)
|
||||
|
||||
self.assert_cut(ran)
|
||||
|
||||
def test_cuts_through_gh_on_a_github_origin(self):
|
||||
self.use_github()
|
||||
ran = self.cut()
|
||||
@@ -263,7 +271,7 @@ class Cut(unittest.TestCase):
|
||||
self.assertTrue(line.startswith("cut-release: "), line)
|
||||
for fact in facts:
|
||||
self.assertIn(fact, line)
|
||||
self.assertEqual(ran.stdout.splitlines()[-1], "Done: v0.2.0 is cut and pushed. Each clone of a release takes it with its bin/self-update.")
|
||||
self.assertEqual(ran.stdout.splitlines()[-1], "Done: v0.2.0 is cut and pushed. Each clone of a release takes it with its own bin/self-update.")
|
||||
|
||||
def test_deletes_the_merged_release_branch_on_origin(self):
|
||||
self.assert_cut(self.cut())
|
||||
@@ -277,7 +285,7 @@ class Cut(unittest.TestCase):
|
||||
self.assert_cut(ran)
|
||||
self.assertIn("cut-release: warning: the branch release-0.2.0 stays on origin:", ran.stderr)
|
||||
self.assertIn("deletes are refused", ran.stderr)
|
||||
self.assertEqual(ran.stdout.splitlines()[-1], "Done: v0.2.0 is cut and pushed. Each clone of a release takes it with its bin/self-update.")
|
||||
self.assertEqual(ran.stdout.splitlines()[-1], "Done: v0.2.0 is cut and pushed. Each clone of a release takes it with its own bin/self-update.")
|
||||
|
||||
def test_stops_where_the_tag_exists_on_another_commit_and_a_rerun_tags_the_merged_commit(self):
|
||||
self.git(self.clone, "switch", "-q", "-c", "side")
|
||||
@@ -597,13 +605,19 @@ class Cut(unittest.TestCase):
|
||||
self.assertEqual(self.forge_state()["pulls"], [])
|
||||
|
||||
def test_cut_patch_needs_its_commits(self):
|
||||
ran = subprocess.run([sys.executable, str(TOOL), "--patch"], capture_output=True, cwd=self.clone, env=self.env, text=True)
|
||||
ran = self.cut("--patch")
|
||||
self.assertEqual(ran.returncode, 1)
|
||||
self.assertIn("usage", ran.stderr)
|
||||
self.assertEqual(self.forge_state()["calls"], [])
|
||||
|
||||
def test_cut_patch_refuses_an_option_as_its_commits(self):
|
||||
ran = self.cut("--patch", "--force")
|
||||
self.assertEqual(ran.returncode, 1)
|
||||
self.assertIn("usage", ran.stderr)
|
||||
self.assertEqual(self.forge_state()["calls"], [])
|
||||
|
||||
def test_refuses_an_option_it_does_not_know(self):
|
||||
ran = subprocess.run([sys.executable, str(TOOL), "--force"], capture_output=True, cwd=self.clone, env=self.env, text=True)
|
||||
ran = self.cut("--force")
|
||||
self.assertEqual(ran.returncode, 1)
|
||||
self.assertIn("usage", ran.stderr)
|
||||
self.assertEqual(self.forge_state()["calls"], [])
|
||||
|
||||
@@ -8,9 +8,9 @@ from repo_checks import ROOT
|
||||
BY_ITS_FOLDER = re.compile(r"(?:~|\$HOME)/\.claude/bin/[\w.<>-]+(?![\w.<>/-])")
|
||||
# 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 `build-release` is linked onto their `PATH`.
|
||||
# The lines a person runs in their own shell or a crontab, which lack the tools: no step puts one on their `PATH`.
|
||||
BY_HAND = {
|
||||
"README.md": {"$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>", "~/.claude/bin/build-release", "~/.claude/bin/notify", "~/.claude/bin/self-update", "~/.claude/bin/project-config"},
|
||||
"README.md": {"$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>", "~/.claude/bin/build-release", "~/.claude/bin/deploy-release", "~/.claude/bin/notify", "~/.claude/bin/project-config", "~/.claude/bin/self-update"},
|
||||
"presentation/README.md": {"~/.claude/bin/run-heavy"},
|
||||
"presentation/build-pdf.py": {"~/.claude/bin/run-heavy"},
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ Group `bin/` by concern, one package level per group, with the launchers left at
|
||||
- `integrations/`: `atlassian`, `adf_codec`, `rest_client` and `notifier`.
|
||||
- `loop/`: `build_release`, `loop_effects`, `loop_state`, `model_routing`, `transcript_archive` and `routing_figures`.
|
||||
- `review/`: `larv_review`, `branch_chunks`, `review_rules`, `judge_replay`, `review_replay`, `rung_replay`, `score_outcomes`, `metric_bench`, `reading_cost`, `command_patterns` and `mutate_changes`.
|
||||
- `ship/`: `chunk_pr`, `chunk_preflight` and `deploy_release`. The shared forge module `bin/forge/` stays at the root of `bin/`, since packages outside `ship/` import it.
|
||||
- `ship/`: `chunk_pr`, `chunk_preflight`, `cut_release` and `self_update`. The shared forge module `bin/forge/` stays at the root of `bin/`, since packages outside `ship/` import it.
|
||||
- `host/`: `git_cli`, `command_lines`, `claude_code`, `machine_load`, `run_heavy`, `run_tests`, `text_files`, `wait_for`, `rule_hook` and `subagent_rung`.
|
||||
|
||||
`repo_checks` stays at the root, since it tests the repo, not a tool. The README's `bin/` list then becomes seven short groups. That list is a place the comprehension seats found hard (`README.md` → the `bin/` package list): make it easier to read.
|
||||
|
||||
Reference in New Issue
Block a user