Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s

This commit is contained in:
2026-12-03 18:56:28 +01:00
parent 20c83f861f
commit 1ca2c8efe0
142 changed files with 1095 additions and 933 deletions
+15 -14
View File
@@ -325,13 +325,13 @@ class Checkout:
return self.home / ".claude.json"
def models_file(self):
return self.home / ".claude" / "loop-claude-models.json"
return self.home / ".config/build-release" / "models.json"
def transcripts(self):
return sorted((self.home / ".claude" / "projects").glob("*/*.jsonl"))
def archive(self):
return pathlib.Path(self.env.get("BUILD_RELEASE_TRANSCRIPTS", self.home / ".claude" / "loop-claude-transcripts"))
return pathlib.Path(self.env.get("BUILD_RELEASE_TRANSCRIPTS", self.home / ".local/state/build-release" / "transcripts"))
def archived(self):
"""Each archived transcript's outcomes, with every UTC stamp replaced by <UTC> and every setup version by <config>, after checking the copy is named by its content hash."""
@@ -397,10 +397,10 @@ class Premises(unittest.TestCase):
run = checkout.run([worker()])
self.assertEqual((run.code, run.calls), (1, []))
self.assertEqual(run.stderr.strip(), f"cannot read {checkout.root}/README.md: Is a directory - no premises.")
(checkout.home / ".claude-projects" / "proj" / "config.toml").unlink()
(checkout.home / ".config/build-release" / "proj" / "config.toml").unlink()
run = checkout.run([worker()])
self.assertEqual((run.code, run.calls), (1, []))
self.assertEqual(run.stderr.strip(), f"no config names the checkout {checkout.root}: write ~/.claude-projects/<key>/config.toml, as `project-config --help` shows - no premises.")
self.assertEqual(run.stderr.strip(), f"no config names the checkout {checkout.root}: write {checkout.home}/.config/build-release/<key>/config.toml, as `project-config --help` shows - no premises.")
(checkout.temp / "fake-bin" / "git").unlink()
run = checkout.run([worker()])
self.assertEqual((run.code, run.calls), (1, []))
@@ -512,7 +512,7 @@ class Cycles(unittest.TestCase):
def test_routes_on_the_ladder_the_projects_config_folder_holds_in_place_of_the_shipped_one(self):
checkout = Checkout(self)
checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-fable-5-2"
ladder = checkout.home / ".claude-projects" / "proj" / "routing-ladder.json"
ladder = checkout.home / ".config/build-release" / "proj" / "routing-ladder.json"
ladder.write_text('[{"model": "claude-fable-5-2", "effort": "low"}, {"model": "claude-fable-5-2", "effort": "max"}]')
checkout.commit_plan(CHEAP)
run = checkout.run([worker(), judge(), worker(), judge(), worker()])
@@ -524,7 +524,7 @@ class Cycles(unittest.TestCase):
def test_says_where_the_projects_own_ladder_leaves_out_the_workers_model_and_says_nothing_on_the_shipped_one(self):
checkout = Checkout(self)
self.assertNotIn("own ladder", checkout.run([worker()]).stderr)
ladder = checkout.home / ".claude-projects" / "proj" / "routing-ladder.json"
ladder = checkout.home / ".config/build-release" / "proj" / "routing-ladder.json"
ladder.write_text('[{"model": "claude-fable-5-2", "effort": "low"}]')
run = checkout.run([worker()])
self.assertIn(f"routing on the project's own ladder, {ladder}. worker-model is not on it, so the worker runs on worker-model unrouted; BUILD_RELEASE_WORKER_MODEL and BUILD_RELEASE_JUDGE_MODEL name other models for a run.\n", run.stderr)
@@ -533,7 +533,7 @@ class Cycles(unittest.TestCase):
def test_reads_the_projects_ladder_afresh_each_cycle_and_exits_1_once_it_holds_a_fault(self):
checkout = Checkout(self)
checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-fable-5-2"
ladder = checkout.home / ".claude-projects" / "proj" / "routing-ladder.json"
ladder = checkout.home / ".config/build-release" / "proj" / "routing-ladder.json"
ladder.write_text('[{"model": "claude-fable-5-2", "effort": "high"}]')
checkout.env["FAKE_CLAUDE_EDIT"] = str(ladder.parent)
run = checkout.run([worker(replace=["routing-ladder.json", '"high"}', '"high"},']), judge()])
@@ -672,7 +672,7 @@ class Cycles(unittest.TestCase):
checkout.archive().write_text("in the way")
run = checkout.run([worker(say="landed-it"), judge(finished=True, evidence="landed-it")])
self.assertEqual((run.code, run.roles()), (1, ["worker", "judge"]))
self.assertRegex(run.stderr.strip().splitlines()[-1], r"^could not archive the transcript: .*/loop-claude-transcripts/proj: Not a directory$")
self.assertRegex(run.stderr.strip().splitlines()[-1], r"^could not archive the transcript: .*/build-release/transcripts/proj: Not a directory$")
self.assertEqual(run.stderr.count("could not archive the transcript"), 1)
session = argument(run.calls[0], "--session-id")
checkout.archive().unlink()
@@ -820,7 +820,7 @@ class Windows(unittest.TestCase):
checkout = Checkout(self)
checkout.commit_plan(BESIDE)
if parallel:
config = checkout.home / ".claude-projects" / "proj" / "config.toml"
config = checkout.home / ".config/build-release" / "proj" / "config.toml"
config.write_text(f"parallel-chunks = {parallel}\n" + config.read_text())
return checkout
@@ -944,11 +944,11 @@ class Interrupt(unittest.TestCase):
def test_sends_the_dm_through_the_notifier_and_env_file_the_config_names_and_no_credential_reaches_a_prompt_a_line_printed_or_a_file_written(self):
checkout = Checkout(self)
token = "tok-3f9a1c7e-sentinel"
env_file = checkout.home / ".claude-projects" / "proj.env"
env_file = checkout.home / ".config/build-release" / "proj.env"
env_file.write_text(f"MATTERMOST_URL=https://127.0.0.1:1\nMATTERMOST_TOKEN={token}\nMATTERMOST_RECIPIENT=lilleman\n")
env_file.chmod(0o600)
with (checkout.home / ".claude-projects" / "proj" / "config.toml").open("a") as config:
config.write('env-file = "~/.claude-projects/proj.env"\nnotifier = "mattermost"\n')
with (checkout.home / ".config/build-release" / "proj" / "config.toml").open("a") as config:
config.write('env-file = "~/.config/build-release/proj.env"\nnotifier = "mattermost"\n')
run = checkout.run([worker(say="Shall I use A or B?"), judge(interrupt=True, evidence="Shall I use A or B?", question="A or B?")])
self.assertEqual((run.code, run.roles()), (2, ["worker", "judge"]))
self.assertIn("could not DM you: cannot reach https://127.0.0.1:1", run.stderr)
@@ -1054,7 +1054,7 @@ class Models(unittest.TestCase):
def test_keeps_the_models_file_mode_and_other_projects_when_saving(self):
checkout = Checkout(self)
del checkout.env["BUILD_RELEASE_JUDGE_MODEL"], checkout.env["BUILD_RELEASE_WORKER_MODEL"]
checkout.models_file().parent.mkdir(parents=True)
checkout.models_file().parent.mkdir(parents=True, exist_ok=True)
checkout.models_file().write_text(json.dumps({"other": "model-x"}))
checkout.models_file().chmod(0o640)
def saved_elsewhere():
@@ -1092,7 +1092,8 @@ class Models(unittest.TestCase):
assert_not_root(self)
checkout = Checkout(self)
del checkout.env["BUILD_RELEASE_JUDGE_MODEL"], checkout.env["BUILD_RELEASE_WORKER_MODEL"]
checkout.models_file().parent.mkdir(parents=True, mode=0o500)
checkout.models_file().parent.mkdir(parents=True, exist_ok=True)
checkout.models_file().parent.chmod(0o500)
self.addCleanup(checkout.models_file().parent.chmod, 0o700)
run = checkout.run([worker()], terminal_input="custom-model\n")
self.assertEqual((run.code, run.calls), (1, []))