Run every claude the loop starts in a Claude home generated outside the clone
CI / tests (pull_request) Successful in 4m45s

This commit is contained in:
2026-12-04 01:07:03 +01:00
parent 2460b9e132
commit 0203a8e0b3
48 changed files with 703 additions and 369 deletions
+27 -14
View File
@@ -5,22 +5,35 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from settings_filter import cleaned
from git_cli.git_repo import git
from claude_home.home import CLONE
from repo_checks import ROOT
INSTALL = "git config filter.settings.clean bin/settings_filter.py"
class Settings(unittest.TestCase):
def test_the_stored_settings_hold_no_model_and_sorted_keys(self):
# The index, not the working file: the working file holds this machine's model in Claude Code's key order.
stored = git("show", ":settings.json", cwd=str(ROOT))
self.assertIsInstance(stored, str, stored)
fix = f"commit settings.json with the filter on: {INSTALL}"
self.assertNotIn("model", json.loads(stored), fix)
self.assertEqual(stored, cleaned(json.loads(stored)), fix)
def setUp(self) -> None:
self.text = (ROOT / "settings.json").read_text(encoding="utf-8")
self.settings = json.loads(self.text)
def test_the_readme_installs_the_filter_git_attributes_names_for_the_root_settings_only(self):
self.assertEqual("/settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8"))
self.assertIn(f"{INSTALL}\n", (ROOT / "README.md").read_text(encoding="utf-8"))
def test_the_tracked_settings_hold_no_model_and_sorted_keys(self) -> None:
# A model belongs to the generated settings.json in the loop's Claude home, where /model writes it.
self.assertNotIn("model", self.settings)
self.assertEqual(self.text, json.dumps(self.settings, indent=2, sort_keys=True) + "\n")
def test_every_hook_runs_a_tool_of_the_clone(self) -> None:
commands = [hook["command"] for groups in self.settings["hooks"].values() for group in groups for hook in group["hooks"]]
self.assertTrue(commands)
for command in commands:
self.assertTrue(command.startswith(f"{CLONE}/bin/"), command)
self.assertTrue((ROOT / "bin" / command.split()[0].removeprefix(f"{CLONE}/bin/")).is_file(), command)
def test_the_persons_theme_and_status_line_are_not_set(self) -> None:
self.assertNotIn("theme", self.settings)
self.assertNotIn("statusLine", self.settings)
def test_every_enabled_plugins_marketplace_names_the_repo_the_home_adds_it_from(self) -> None:
enabled = [plugin for plugin, enabled in self.settings["enabledPlugins"].items() if enabled]
self.assertTrue(enabled)
for plugin in enabled:
self.assertRegex(self.settings["extraKnownMarketplaces"][plugin.split("@")[1]]["source"]["repo"], r"^[\w.-]+/[\w.-]+$", plugin)