diff --git a/bin/git_repo.py b/bin/git_repo.py index 0c65933c..7e54751e 100644 --- a/bin/git_repo.py +++ b/bin/git_repo.py @@ -65,7 +65,6 @@ def origin_head(cwd: str | None, timeout: float | None) -> str | Failure: @dataclasses.dataclass(frozen=True) class DefaultPlan: """What the default branch, as last fetched, holds for picking the next chunk's item: todo_table.chunk_item's inputs.""" - ref: str # todo.md's text, empty where the branch holds none. todo: str | Failure cut: LastCut @@ -75,7 +74,7 @@ def default_plan(root: str, ref: str) -> DefaultPlan: """What ref, the default branch as last fetched, holds for the pick, read in the checkout at root.""" tag = newest_release_tag(ref, root) commits = tag if isinstance(tag, Failure) else commits_since(tag, ref, root) - return DefaultPlan(ref, file_at(ref, "todo.md", root), LastCut(tag, file_at(ref, "CHANGELOG.md", root), commits, todos_since(tag, ref, root))) + return DefaultPlan(file_at(ref, "todo.md", root), LastCut(tag, file_at(ref, "CHANGELOG.md", root), commits, todos_since(tag, ref, root))) def todos_since(tag: str | None | Failure, ref: str, cwd: str) -> list[str] | Failure: diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index bf23d212..6a4e0cf0 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -733,11 +733,11 @@ class Routing(unittest.TestCase): class RouteSources(unittest.TestCase): def test_routes_on_the_plan_item_and_says_why_it_routes_on_the_projects_rung(self): - self.assertIsNone(main.plan_item(DefaultPlan("origin/main", "", NO_CUT))) - self.assertEqual(main.plan_item(DefaultPlan("origin/main", TODO, LastCut("v0.1.0", "", 3, [TODO]))).id, 3) - self.assertIsNone(main.plan_item(DefaultPlan("origin/main", TODO, LastCut("v0.2.0", "", 3, [TODO])))) + self.assertIsNone(main.plan_item(DefaultPlan("", NO_CUT))) + self.assertEqual(main.plan_item(DefaultPlan(TODO, LastCut("v0.1.0", "", 3, [TODO]))).id, 3) + self.assertIsNone(main.plan_item(DefaultPlan(TODO, LastCut("v0.2.0", "", 3, [TODO])))) unreadable = Failure("git show origin/main:todo.md printed text that is not UTF-8") - for plan, said in ((DefaultPlan("origin/main", TODO.replace("| 4 | 2 | 3 |", "| x | 2 | 3 |"), NO_CUT), "routing on the project's rung: item 3's L 'x' is not a whole number from 1 to 4\n"), (DefaultPlan("origin/main", unreadable, NO_CUT), f"routing on the project's rung: {unreadable.reason}\n"), (Failure("no origin remote"), "routing on the project's rung: no origin remote\n")): + for plan, said in ((DefaultPlan(TODO.replace("| 4 | 2 | 3 |", "| x | 2 | 3 |"), NO_CUT), "routing on the project's rung: item 3's L 'x' is not a whole number from 1 to 4\n"), (DefaultPlan(unreadable, NO_CUT), f"routing on the project's rung: {unreadable.reason}\n"), (Failure("no origin remote"), "routing on the project's rung: no origin remote\n")): with self.subTest(said=said): with contextlib.redirect_stderr(io.StringIO()) as stderr: self.assertIsNone(main.plan_item(plan))