Answer principles round 2: 0 🔴, 0 🟡 (0 misread); read the preloaded files before the scoring worktree is made, and state Route's contract
CI / tests (pull_request) Successful in 2m58s
CI / tests (pull_request) Successful in 2m58s
This commit is contained in:
@@ -186,6 +186,10 @@ def prepare_scoring(worktree: str, preloaded: str | None, home: pathlib.Path) ->
|
|||||||
if isinstance(head, Failure):
|
if isinstance(head, Failure):
|
||||||
return head
|
return head
|
||||||
main = listing.splitlines()[0].removeprefix("worktree ")
|
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)
|
made = made_review_folder(worktree, home)
|
||||||
if isinstance(made, Failure):
|
if isinstance(made, Failure):
|
||||||
return made
|
return made
|
||||||
@@ -205,7 +209,7 @@ def prepare_scoring(worktree: str, preloaded: str | None, home: pathlib.Path) ->
|
|||||||
"forbidden": forbidden_words,
|
"forbidden": forbidden_words,
|
||||||
"git": f"`git -C {checkout} ls-files`",
|
"git": f"`git -C {checkout} ls-files`",
|
||||||
"files": file_globs(tracked.splitlines(), forbidden_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]),
|
"anchors": "\n".join(score[0]),
|
||||||
"dimensions": "\n".join(score[1]),
|
"dimensions": "\n".join(score[1]),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Route:
|
|||||||
escalated_at: int = 0
|
escalated_at: int = 0
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
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):
|
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}")
|
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}")
|
||||||
|
|
||||||
|
|||||||
@@ -896,8 +896,7 @@ class TodoRankCheck(unittest.TestCase):
|
|||||||
checkout = self.changed_plan(self.other, "")
|
checkout = self.changed_plan(self.other, "")
|
||||||
pathlib.Path(checkout, "todo.md").chmod(0)
|
pathlib.Path(checkout, "todo.md").chmod(0)
|
||||||
self.addCleanup(pathlib.Path(checkout, "todo.md").chmod, 0o600)
|
self.addCleanup(pathlib.Path(checkout, "todo.md").chmod, 0o600)
|
||||||
self.assertEqual(len(self.details(checkout)), 1)
|
self.assertEqual(["Permission denied" in detail for detail in self.details(checkout)], [True])
|
||||||
self.assertIn("Permission denied", self.details(checkout)[0])
|
|
||||||
|
|
||||||
def details(self, checkout: str) -> list[str]:
|
def details(self, checkout: str) -> list[str]:
|
||||||
return [breach.detail for breach in todo_breaches(checkout, pathlib.Path.home(), pathlib.Path(self.own))]
|
return [breach.detail for breach in todo_breaches(checkout, pathlib.Path.home(), pathlib.Path(self.own))]
|
||||||
|
|||||||
Reference in New Issue
Block a user