Let a project's config name a working branch per epic that chunks branch off and merge into
CI / tests (pull_request) Successful in 5m4s

This commit is contained in:
Lilleman
2026-11-20 19:32:59 +01:00
parent 9531e5c337
commit 72a4d346d7
33 changed files with 991 additions and 56 deletions
+9 -6
View File
@@ -21,6 +21,9 @@ from plan_store.todo_md import plan_of
from claude_code import session
from agent_cycle import tmux
# What git answers as `default_ref` reads the default branch in a checkout on main: the remote, the branch checked out, no chunk base, and origin's default branch.
ON_MAIN = ["origin\n", "main\n", Failure("no chunk base"), "origin/main\n"]
class RouteSources(unittest.TestCase):
def test_routes_on_the_plan_item_and_says_why_it_routes_on_the_projects_rung(self):
@@ -45,7 +48,7 @@ class RouteSources(unittest.TestCase):
transcript.parent.mkdir(parents=True)
transcript.write_text("")
unread = Failure("no git")
fake = FakeEffects(git=["origin\n", "origin/main\n", unread, unread, unread, unread])
fake = FakeEffects(git=[*ON_MAIN, unread, unread, unread, unread])
with contextlib.redirect_stderr(io.StringIO()) as stderr:
facts, held = chunk_start.chunk_start(a_loop(fake.effects(), root=root, session=opened, paths=paths.paths_from(folder.parents[1])))
self.assertEqual((facts, held.plan), ("", plan_of(TODO)))
@@ -70,7 +73,7 @@ class RouteSources(unittest.TestCase):
def test_reads_the_changelog_the_default_branch_holds_through_the_loops_git(self):
def git(*args, **options):
answers = {"remote": "origin\n", "symbolic-ref": "origin/main\n", "show": f"what {args[-1]} holds\n"}
answers = {"remote": "origin\n", "symbolic-ref": "origin/main\n", "config": Failure("no chunk base"), "show": f"what {args[-1]} holds\n"}
return answers.get(args[0], "1\n")
with tempfile.TemporaryDirectory() as root:
@@ -105,21 +108,21 @@ class RouteSources(unittest.TestCase):
def test_reads_a_plan_outside_the_checkout_as_it_stands_and_stops_without_a_config(self):
with tempfile.TemporaryDirectory() as root:
folder = configured(self, pathlib.Path(root))
loop = a_loop(FakeEffects(git=["origin\n", "origin/main\n"] * 2).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
loop = a_loop(FakeEffects(git=[*ON_MAIN] * 2).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
config = folder / "config.toml"
tracked = a_loop(FakeEffects(git=["origin\n", "origin/main\n", *[Failure("no git")] * 4]).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
tracked = a_loop(FakeEffects(git=[*ON_MAIN, *[Failure("no git")] * 4]).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
with contextlib.redirect_stderr(io.StringIO()) as stderr:
chunk_start.fetched_plan(tracked)
self.assertEqual(stderr.getvalue(), "", "a plan git tracks hides no release")
config.write_text(config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
(folder / "todo.md").write_text(TODO)
unread = Failure("no git")
standing = a_loop(FakeEffects(git=["origin\n", "origin/main\n", unread, unread, unread, unread]).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
standing = a_loop(FakeEffects(git=[*ON_MAIN, unread, unread, unread, unread]).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
with contextlib.redirect_stderr(io.StringIO()) as stderr:
held = chunk_start.fetched_plan(standing)
self.assertEqual((held.plan, held.cut.todos_since, held.cut.changelog), (plan_of(TODO), [], ""), "the plan as it stands, whatever git answers")
self.assertEqual(stderr.getvalue(), f"{STAMP} {UNSEEN_RELEASES}\n", "a release review loop-claude cannot call due is never skipped silently")
quiet = a_loop(FakeEffects(git=["origin\n", "origin/main\n", unread, unread, unread, unread]).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
quiet = a_loop(FakeEffects(git=[*ON_MAIN, unread, unread, unread, unread]).effects(), root=root, paths=paths.paths_from(folder.parents[1]))
with contextlib.redirect_stderr(io.StringIO()) as stderr:
chunk_start.fetched_plan(quiet, announce=False)
self.assertEqual(stderr.getvalue(), "", "said once per chunk, as it starts")