Answer stability round 1: 0 🔴, 4 🟡 (0 misread); a chunk window is handed the two XDG variables, rule-hook's checks are tested under them, and three tests stop passing the developer's
CI / tests (pull_request) Successful in 5m16s

This commit is contained in:
2026-12-03 21:30:06 +01:00
parent 173d591986
commit 9b8f9e05e7
7 changed files with 82 additions and 16 deletions
+52
View File
@@ -413,6 +413,20 @@ class ReviewerRung(unittest.TestCase):
self.assertEqual(reviewer_breaches(reviewer, environ, home), [])
self.assertEqual(skill_breaches(Call("Skill", {"skill": "security-review"}, checkout), environ, home), [])
def test_the_projects_ladder_is_read_from_a_config_under_xdg_config_home(self):
checkout, home = self.project(self.TWO_RUNGS)
pathlib.Path(home, ".config").rename(pathlib.Path(home, "moved"))
moved = {"XDG_CONFIG_HOME": f"{home}/moved"}
reviewer = Call("Agent", {"subagent_type": "stability-reviewer", "model": "fable", "effort": "medium"}, checkout)
self.assertEqual(rules(reviewer_breaches(reviewer, self.ON_TWO_RUNGS | moved, home)), ["reviewer-rung"])
self.assertEqual(rules(reviewer_breaches(reviewer, self.ON_TWO_RUNGS, home)), [], "without the variable the shipped ladder holds")
# On the shipped ladder the worker's high effort ranks above the project's low one; the project's ladder holds them the other way round.
pathlib.Path(home, "moved", "build-release", "acme", "routing-ladder.json").write_text('[{"model": "claude-fable-5-2", "effort": "high"}, {"model": "claude-fable-5-2", "effort": "low"}]')
environ = {"BUILD_RELEASE_PROJECT_RUNG": "claude-fable-5-2 at low effort", "BUILD_RELEASE_WORKER_RUNG": "claude-fable-5-2 at high effort"}
skill = Call("Skill", {"skill": "security-review"}, checkout)
self.assertEqual(rules(skill_breaches(skill, environ | moved, home)), ["reviewer-rung"])
self.assertEqual(skill_breaches(skill, environ, home), [])
def test_a_security_skill_is_held_to_the_projects_rung_on_the_projects_own_ladder(self):
checkout, home = self.project('[{"model": "claude-fable-5-2", "effort": "high"}, {"model": "claude-fable-5-2", "effort": "low"}]')
# On this ladder the worker's low effort ranks above the project's high one; on the shipped ladder it ranks below.
@@ -745,6 +759,13 @@ class ReviewerReport(unittest.TestCase):
with self.subTest(path):
self.assertEqual(self.breached("Write", path), ["reviewer-report"])
def test_the_reports_folder_follows_xdg_state_home(self):
env = {"XDG_STATE_HOME": "/state"}
for path, expected in [("/state/build-release/larv-review/x/prose-round-1.md", []), ("/h/.local/state/build-release/larv-review/x/prose-round-1.md", ["reviewer-report"])]:
with self.subTest(path):
found = breaches_of(Call("Write", {"file_path": path, "content": "x"}, "/r", "prose-reviewer"), "/h", env)
self.assertEqual(rules(found[2]), expected)
def test_a_reviewer_edits_no_file_even_in_the_reports_folder(self):
self.assertEqual(self.breached("Edit", "/h/.local/state/build-release/larv-review/x/prose-round-1.md"), ["reviewer-report"])
@@ -1233,6 +1254,21 @@ class Hook(unittest.TestCase):
self.assertEqual(self.round_commit("PAY-7 - Answer prose round 1: 0 🔴, 0 🟡 (0 misread); x").returncode, 0)
self.assertEqual(self.round_commit("Tidy # rule-override commit-title: the client asked for this title").returncode, 0)
def test_a_commit_is_checked_against_the_config_and_the_report_under_the_xdg_folders(self):
home = pathlib.Path(tempfile.mkdtemp())
self.addCleanup(subprocess.run, ["rm", "-rf", str(home)])
config = configured(self, pathlib.Path(self.repo), home=home) / "config.toml"
config.write_text(config.read_text() + 'commit-title = "PAY-{id} - {summary}"\n')
(home / ".config").rename(home / "configs")
git(self.repo, "checkout", "-q", "-b", "item-7")
folder = home / "state" / "build-release" / "larv-review" / self.repo.lstrip("/")
folder.mkdir(parents=True)
(folder / "stability-round-1.md").write_text("BLOCK\n\n### 🟡 `b.py:2`: worse\n")
self.env = {"HOME": str(home), "XDG_CONFIG_HOME": str(home / "configs"), "XDG_STATE_HOME": str(home / "state")}
self.assertIn("Blocked by rule commit-title: title the commit as the project's config asks, `PAY-{id} - {summary}`", self.round_commit("Tidy").stderr)
self.assertIn("Blocked by rule round-title-counts", self.round_commit("PAY-7 - Answer stability round 1: 0 🔴, 0 🟡 (0 misread); x").stderr)
self.assertEqual(self.round_commit("PAY-7 - Answer stability round 1: 0 🔴, 1 🟡 (0 misread); x").returncode, 0)
def test_a_commit_on_a_branch_that_doesnt_fit_the_configs_branch_template_takes_a_bare_title(self):
config = self.configured() / "config.toml"
config.write_text(config.read_text() + 'commit-title = "PAY-{id} - {summary}"\nbranch = "feature/PAY-{id}"\n')
@@ -1381,6 +1417,22 @@ class TodoRankCheck(unittest.TestCase):
self.assertTrue(reasons)
self.assertNotIn("own script", " ".join(reasons))
def test_a_config_under_xdg_config_home_names_the_checkout_and_holds_its_plan(self):
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
moved = self.home / "moved"
(self.home / ".config").rename(moved)
env = {"XDG_CONFIG_HOME": str(moved)}
def details(directory: str) -> list[str]:
return [breach.detail for breach in todo_breaches(directory, self.home, env, pathlib.Path(self.own))]
self.assertEqual(details(checkout), [f"own script checked {checkout}/todo.md"])
config = moved / self.config.relative_to(self.home / ".config")
config.write_text(config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
(config.parent / "todo.md").write_text("# todo\n")
git(str(config.parent), "init", "-q", "-b", "main")
self.assertEqual(details(str(config.parent)), [f"own script checked {config.parent}/todo.md"], "a commit in the config's folder checks the plan it holds")
def test_a_plan_the_config_puts_outside_the_checkout_is_checked_in_place_of_the_checkouts_todo_md(self):
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))