From d029f9a1ee3d32fa40972a4410deb4995ca62d08 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 13 Nov 2026 03:08:06 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20principles=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20read=20the?= =?UTF-8?q?=20preloaded=20files=20before=20the=20scoring=20worktree=20is?= =?UTF-8?q?=20made,=20and=20state=20Route's=20contract?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/larv_review/scoring_setup.py | 6 +++++- bin/model_routing/route.py | 2 +- bin/rule_hook/test_rule_hook.py | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/larv_review/scoring_setup.py b/bin/larv_review/scoring_setup.py index caa89eef..a0288771 100644 --- a/bin/larv_review/scoring_setup.py +++ b/bin/larv_review/scoring_setup.py @@ -186,6 +186,10 @@ def prepare_scoring(worktree: str, preloaded: str | None, home: pathlib.Path) -> if isinstance(head, Failure): return head main = listing.splitlines()[0].removeprefix("worktree ") + try: + loaded = preloaded if preloaded is not None else preloaded_files(pathlib.Path(main), home) + except (OSError, UnicodeDecodeError) as failure: + return Failure(f"could not read a file Claude Code loads into a seat: {failure}") made = made_review_folder(worktree, home) if isinstance(made, Failure): return made @@ -205,7 +209,7 @@ def prepare_scoring(worktree: str, preloaded: str | None, home: pathlib.Path) -> "forbidden": forbidden_words, "git": f"`git -C {checkout} ls-files`", "files": file_globs(tracked.splitlines(), forbidden_files), - "preloaded": preloaded if preloaded is not None else preloaded_files(pathlib.Path(main), home), + "preloaded": loaded, "anchors": "\n".join(score[0]), "dimensions": "\n".join(score[1]), } diff --git a/bin/model_routing/route.py b/bin/model_routing/route.py index 927cced7..b63b1299 100644 --- a/bin/model_routing/route.py +++ b/bin/model_routing/route.py @@ -56,7 +56,7 @@ class Route: escalated_at: int = 0 def __post_init__(self) -> None: - # Raises on a programming error only, so nothing catches it: route_of checks fits before it builds a route, and todo_table.items gives first_route only levels on their scales. + # Raises on a programming error only, so nothing catches it: a caller builds a route only from levels it checked with fits, or took from an item todo_table.items read, which holds none off its scale. if not levels_fit(self.item, self.likelihood, self.escape_and_impact, self.escape_and_impact_taken_in): raise ValueError(f"a route by item {self.item} cannot hold an L of {self.likelihood}, an E + I of {self.escape_and_impact} and an E + I taken in of {self.escape_and_impact_taken_in}") diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index bc2f41b5..a1239c69 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -896,8 +896,7 @@ class TodoRankCheck(unittest.TestCase): checkout = self.changed_plan(self.other, "") pathlib.Path(checkout, "todo.md").chmod(0) self.addCleanup(pathlib.Path(checkout, "todo.md").chmod, 0o600) - self.assertEqual(len(self.details(checkout)), 1) - self.assertIn("Permission denied", self.details(checkout)[0]) + self.assertEqual(["Permission denied" in detail for detail in self.details(checkout)], [True]) def details(self, checkout: str) -> list[str]: return [breach.detail for breach in todo_breaches(checkout, pathlib.Path.home(), pathlib.Path(self.own))]