Answer stability round 1: 0 🔴, 1 🟡 (0 misread); say the checkout's commits, not git, hold no version of a file outside it, and find a symlinked config folder
This commit is contained in:
@@ -81,7 +81,7 @@ RULES: dict[RuleName, Rule] = {
|
||||
),
|
||||
"todo-rank-check": Rule(
|
||||
"while todo.md has changes, staged or not, a git commit waits until rank_todo.py --check passes on it: the checkout's own bin/rank_todo.py where the checkout is of this setup's repo, else ~/.claude/bin/rank_todo.py",
|
||||
"a git commit in a checkout whose todo.md has changes, and every git commit where the project's config puts todo.md outside the checkout, where no commit says whether it changed; also a git commit in the config's folder, `~/.claude-projects/<key>/`, whose todo.md has changes there",
|
||||
"a git commit in a checkout whose todo.md has changes, and every git commit where the project's config puts todo.md outside the checkout, where the checkout's commits don't say whether it changed; and a git commit in the config's folder, `~/.claude-projects/<key>/`, whose todo.md has changes",
|
||||
),
|
||||
}
|
||||
# The lookahead ends each reason at the next marker on its line, or at the line's end. The reason is lazy, so it stops at the next marker instead of running on and swallowing the markers after it.
|
||||
|
||||
@@ -939,9 +939,14 @@ class TodoRankCheck(unittest.TestCase):
|
||||
git(folder, "add", "-A")
|
||||
git(folder, "commit", "-q", "-m", "plan")
|
||||
self.assertEqual(self.details(folder), [], "committed, so unchanged")
|
||||
|
||||
def test_an_unreadable_config_does_not_block_a_commit_in_its_folder(self):
|
||||
self.changed_plan(f"{self.folder}/clone", self.STUB)
|
||||
folder = str(self.config.parent)
|
||||
git(folder, "init", "-q", "-b", "main")
|
||||
self.config.write_text("checkout = 3\n")
|
||||
(self.config.parent / "todo.md").write_text("# changed\n")
|
||||
self.assertEqual(self.details(folder), [], "a config to fix doesn't block the commit that fixes it")
|
||||
self.assertEqual(self.details(folder), [], "the commit that fixes the config goes through")
|
||||
|
||||
def test_a_commit_in_the_configs_folder_of_another_repo_checks_its_plan_with_the_hooks_ranking(self):
|
||||
self.changed_plan(self.other, self.STUB)
|
||||
|
||||
@@ -20,7 +20,7 @@ OWN_CHECK_SECONDS = 20
|
||||
|
||||
|
||||
def todo_breaches(directory: str, own: pathlib.Path = OWN) -> list[Breach]:
|
||||
"""Why the plan of directory's project is not ranked, where the plan has changed; the plan is the todo.md its config names. directory may also be a config's folder, which commits its own files."""
|
||||
"""Why the plan of directory's project is not ranked, where the plan has changed; the plan is the todo.md its config names. directory may also be in a config's folder, a git repo of its own."""
|
||||
top = guarded_git(directory, "rev-parse", "--show-toplevel")
|
||||
if isinstance(top, Failure):
|
||||
return []
|
||||
@@ -33,16 +33,16 @@ def todo_breaches(directory: str, own: pathlib.Path = OWN) -> list[Breach]:
|
||||
unconfigured = pathlib.Path(top) / "todo.md"
|
||||
return [Breach("todo-rank-check", config.reason, top)] if unconfigured.is_file() and changed(top, unconfigured, "todo.md") else []
|
||||
todo, tracked = config.paths["plan"], config.tracked("plan")
|
||||
# A plan outside the checkout has no commit to differ from, so it is checked on every call.
|
||||
# A plan outside the checkout has no commit in the checkout to differ from, so it is checked on every call.
|
||||
if not todo.is_file() or (tracked is not None and not changed(top, todo, tracked)):
|
||||
return []
|
||||
return [Breach("todo-rank-check", line, top) for line in check_failures(top, todo, config, own)]
|
||||
|
||||
|
||||
def folder_breaches(top: str, config: ProjectConfig | Failure, own: pathlib.Path) -> list[Breach]:
|
||||
"""Why the plan in top, a config's folder and a git repo of its own, is not ranked, where the plan has changed there; checked as a commit in the project's checkout would check it.
|
||||
"""Why the plan kept in top, a config's folder, is not ranked, where the plan has changed in that folder's repo; ranked as for a commit in the project's checkout.
|
||||
|
||||
A config that cannot be read doesn't block anything here, so that the commit fixing it goes through."""
|
||||
A config that fails to load doesn't block anything here, so that the commit that fixes it goes through."""
|
||||
if isinstance(config, Failure) or not config.paths["plan"].is_relative_to(config.folder):
|
||||
return []
|
||||
todo = config.paths["plan"]
|
||||
|
||||
Reference in New Issue
Block a user