From 56c579bd54199853509c13d2111c3b6fbdd9fd72 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 22:20:43 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20product-owner=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20stop=20loop?= =?UTF-8?q?-claude=20where=20every=20item=20left=20awaits=20a=20person's?= =?UTF-8?q?=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/chunk_preflight/test_chunk_preflight.py | 13 ++++++--- bin/forge/test_forge.py | 6 ++-- bin/loop_claude/loop/chunk_windows.py | 16 +++++++---- bin/loop_claude/loop/test_chunk_start.py | 8 ++++-- bin/loop_claude/loop/test_chunk_windows.py | 5 ++++ bin/loop_effects/doubles.py | 2 +- bin/release_plan/next_chunk.py | 13 +++++++-- bin/release_plan/test_release_standing.py | 32 +++++++++++++++++++-- 8 files changed, 74 insertions(+), 21 deletions(-) diff --git a/bin/chunk_preflight/test_chunk_preflight.py b/bin/chunk_preflight/test_chunk_preflight.py index 0c03d951..f93753cb 100644 --- a/bin/chunk_preflight/test_chunk_preflight.py +++ b/bin/chunk_preflight/test_chunk_preflight.py @@ -20,7 +20,7 @@ from release_plan.awaiting_merge import marked from release_plan import next_chunk from chunk_preflight.facts import open_pulls, render from plan_store.todo_md import plan_of -from chunk_preflight.choices import worktree_add +from chunk_preflight.choices import worktree_add, worktree_on, worktrees from project_config.doubles import write_config BIN = pathlib.Path(__file__).resolve().parents[1] @@ -158,7 +158,7 @@ elif args[:6] == ["pr", "list", "--head", "item-2", "--state", "merged"]: self.assertEqual(done.returncode, 0, done.stderr) self.assertIn(f"- The worktree {repo.temp}/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step.\n", done.stdout) self.assertNotIn("proj-item-3, on the branch", done.stdout, "an open pull request leaves no worktree to clean") - self.assertIn("No plan item: every item of release 0.2.0 in origin/main's todo.md waits. Under `merge = \"human\"`, a person's merge is awaited of pull request #12 https://github.com/o/r/pull/12, which finishes item 3. The working loop stops here until one is merged.", done.stdout) + self.assertIn("No plan item: every item of release 0.2.0 in origin/main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #12 https://github.com/o/r/pull/12, which finishes item 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.", done.stdout) (repo.fake / "gh").write_text("#!/bin/sh\necho 'not logged in' >&2\nexit 1\n") unread = repo.preflight() self.assertIn("- The pull requests that await a person's merge cannot be read, so no item is passed over for one: `gh pr list` exited 1: not logged in\n", unread.stdout) @@ -437,12 +437,17 @@ def rendered(item, release=CUT, note=None): class Render(unittest.TestCase): + def test_reads_each_worktree_on_a_branch_from_gits_listing(self): + porcelain = "worktree /c/proj\nHEAD aaa\nbranch refs/heads/main\n\nworktree /c/proj-item-2\nHEAD bbb\nbranch refs/heads/item-2\n\nworktree /c/detached\nHEAD ccc\ndetached\n" + self.assertEqual(worktrees(porcelain), [(pathlib.Path("/c/proj"), "main", "aaa"), (pathlib.Path("/c/proj-item-2"), "item-2", "bbb")]) + self.assertEqual((worktree_on(porcelain, "item-2"), worktree_on(porcelain, "item-3")), (pathlib.Path("/c/proj-item-2"), None)) + def test_states_what_a_persons_merge_leaves_only_where_there_is_something(self): self.assertNotIn("merge", rendered(item_facts())) found = gathered(NoItem("the plan holds none.")) left = dataclasses.replace(found, left=(LeftWorktree(pathlib.Path("/c/proj-item-2"), "item-2", "11"),), merges_unread=Failure("`gh pr list` exited 1: no")) - passed = "\n".join(render(gathered(item_facts(marked(plan_of(TODO), {7: "#12 https://github.com/o/r/pull/12"}))))) - self.assertIn("\n- Passed over, since each is finished on a branch whose pull request is ready and awaits a person's merge: item 7, by pull request #12 https://github.com/o/r/pull/12. No chunk takes one.\n", passed) + passed = "\n".join(render(gathered(item_facts(marked(plan_of(TODO), {7: "#12 https://github.com/o/r/pull/12", 8: "#13 https://github.com/o/r/pull/13"}))))) + self.assertIn("\n- Items passed over, each finished on a branch whose ready pull request awaits a person's merge: item 7, by pull request #12 https://github.com/o/r/pull/12; item 8, by pull request #13 https://github.com/o/r/pull/13. No chunk takes one.\n", passed) self.assertIn("- No other item of release 0.2.0 may join item 3's chunk.", passed) self.assertEqual(render(left)[1:3], ["- The worktree /c/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step.", "- The pull requests that await a person's merge cannot be read, so no item is passed over for one: `gh pr list` exited 1: no"]) diff --git a/bin/forge/test_forge.py b/bin/forge/test_forge.py index 6002ad95..e2a4ee68 100644 --- a/bin/forge/test_forge.py +++ b/bin/forge/test_forge.py @@ -150,7 +150,7 @@ class ReadyPulls(unittest.TestCase): commands: list[list[str]] = [] listed = f"7\thttps://github.com/o/r/pull/7\t{SHA}\tfalse\tfalse\n8\thttps://github.com/o/r/pull/8\t{SHA}\ttrue\tfalse\n9\thttps://github.com/o/r/pull/9\t{SHA}\tfalse\ttrue\n" self.assertEqual(ready_pulls("gh", lambda command: commands.append(command) or listed), [ReadyPull("7", "https://github.com/o/r/pull/7", SHA)]) - self.assertEqual(commands[0][:5], ["gh", "pr", "list", "--limit", "100"]) + self.assertEqual(commands, [["gh", "pr", "list", "--limit", "100", "--json", "number,url,headRefOid,isDraft,isCrossRepository", "--template", "{{range .}}{{.number}}\t{{.url}}\t{{.headRefOid}}\t{{.isDraft}}\t{{.isCrossRepository}}\n{{end}}"]]) def test_leaves_out_on_gh_a_row_whose_head_is_no_commit_id(self): self.assertEqual(ready_pulls("gh", lambda command: "7\thttps://github.com/o/r/pull/7\t--upload-pack=x\tfalse\tfalse\n"), []) @@ -158,7 +158,9 @@ class ReadyPulls(unittest.TestCase): def test_lists_on_tea_each_open_pull_request_from_origins_own_branches_whose_title_marks_no_draft(self): fork = {**GITEA_PULL, "number": 8, "head": {"sha": SHA, "repo": {"full_name": "other/r"}}} draft = {**GITEA_PULL, "number": 9, "title": "wip: Do 9"} - self.assertEqual(ready_pulls("tea", lambda command: json.dumps([GITEA_PULL, fork, draft])), [ReadyPull("7", "https://gitea.example/o/r/pulls/7", SHA)]) + commands: list[list[str]] = [] + self.assertEqual(ready_pulls("tea", lambda command: commands.append(command) or json.dumps([GITEA_PULL, fork, draft])), [ReadyPull("7", "https://gitea.example/o/r/pulls/7", SHA)]) + self.assertEqual(commands, [["tea", "api", "repos/{owner}/{repo}/pulls?state=open&limit=50"]]) def test_fails_where_the_forge_cannot_list_them(self): self.assertEqual(ready_pulls("gh", lambda command: Failure("gh: no network")).reason, "gh: no network") diff --git a/bin/loop_claude/loop/chunk_windows.py b/bin/loop_claude/loop/chunk_windows.py index b9f9be65..7de34517 100644 --- a/bin/loop_claude/loop/chunk_windows.py +++ b/bin/loop_claude/loop/chunk_windows.py @@ -76,8 +76,11 @@ def room_of(windows: list[tmux.Listed], own: str | None, leaving: bool, limit: i return Room(running, stopped, restart, room - len(restart)) -def may_start(plan: NextChunk | NoItem, running: list[str], held: set[int], room: int) -> list[str]: - """The chunks to start now beside the running ones, whose chunks hold the items in held: the plan's next item and the items touch_predictions picks to run beside it, in the plan's order, up to room of them. Each leaves out an item in held, and one whose `Touches:` prediction overlaps a held item's, or where either has none. A plan without an item starts NO_ITEM, and only alone.""" +def may_start(plan: NextChunk | NoItem, running: list[str], held: set[int], room: int) -> list[str] | Failure: + """The chunks to start now beside the running ones, whose chunks hold the items in held: the plan's next item and the items touch_predictions picks to run beside it, in the plan's order, up to room of them. Each leaves out an item in held, and one whose `Touches:` prediction overlaps a held item's, or where either has none. A plan without an item starts NO_ITEM, and only alone. A plan whose NoItem names pull requests that await a person's merge starts none: where nothing runs, a Failure names them.""" + if isinstance(plan, NoItem) and plan.awaits_merge: + # Where nothing runs, the loop stops on the pull requests plan.why names, rather than start a worker only to report them. + return [] if running else Failure(plan.why) if isinstance(plan, NoItem): return [] if running or room < 1 else [NO_ITEM] beside = chunks_beside(plan.items, plan.first) @@ -122,6 +125,8 @@ def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Map if refused := refusal(session, windows, loop_run.root, effects.tmux): return refused chunks = chunks_to_start(windows, loop_run, leaving, config.parallel_chunks, paths, effects) + if isinstance(chunks, Failure): + return chunks for chunk in chunks: started = tmux.start_chunk(tmux.Window(session, chunk, ""), loop_run.root, handed, [str(launcher), CHUNK_FLAG, chunk, loop_run.task], windows, True, effects.tmux) if isinstance(started, Failure): @@ -139,8 +144,8 @@ def refusal(session: str, windows: list[tmux.Listed], root: str, run: tmux.Tmux) return None -def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool, limit: int, paths: Paths, effects: Effects) -> list[str]: - """The chunks to start beside windows, the session's: the stopped ones room_of restarts, then those of the plan that may_start picks. A plan that cannot be read starts NO_ITEM, as a plan without an item does.""" +def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool, limit: int, paths: Paths, effects: Effects) -> list[str] | Failure: + """The chunks to start beside windows, the session's: the stopped ones room_of restarts, then those of the plan that may_start picks. A plan that cannot be read starts NO_ITEM, as a plan without an item does. A Failure where no chunk runs or restarts and every item left waits on a person's merge: it names the pull requests.""" room = room_of(windows, loop_run.chunk, leaving, limit) if not room.left: return room.restart @@ -150,7 +155,8 @@ def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool say(f"starting a chunk without a plan item, since the plan cannot be read: {plan.reason}", effects) plan = NoItem(plan.reason) held = held_items(room.running + room.stopped, project_key(loop_run.root, paths.home), paths.claude_code_transcripts) - return room.restart + [chunk for chunk in may_start(plan, room.running + room.restart, held, room.left) if chunk not in room.stopped] + picked = may_start(plan, room.running + room.restart, held, room.left) + return picked if isinstance(picked, Failure) else room.restart + [chunk for chunk in picked if chunk not in room.stopped] def held_beside(chunk: str, root: str, paths: Paths, effects: Effects) -> list[int]: diff --git a/bin/loop_claude/loop/test_chunk_start.py b/bin/loop_claude/loop/test_chunk_start.py index 65f7ea75..277a4209 100644 --- a/bin/loop_claude/loop/test_chunk_start.py +++ b/bin/loop_claude/loop/test_chunk_start.py @@ -9,7 +9,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) from chunk_driver.doubles import a_loop -from loop_claude.loop import chunk_start +from loop_claude.loop import chunk_start, chunk_windows from project_config.doubles import configured from release_plan.release_standing import DefaultPlan, LastCut, UNSEEN_RELEASES from failure import Failure @@ -92,11 +92,13 @@ class RouteSources(unittest.TestCase): with tempfile.TemporaryDirectory() as root: folder = configured(self, pathlib.Path(root)) (folder / "config.toml").write_text((folder / "config.toml").read_text() + 'merge = "human"\n') - fake = FakeEffects(forge=[f"12\thttps://github.com/o/r/pull/12\t{head}\tfalse\tfalse\n"]) + fake = FakeEffects(forge=[f"12\thttps://github.com/o/r/pull/12\t{head}\tfalse\tfalse\n"] * 2) held = chunk_start.fetched_plan(a_loop(dataclasses.replace(fake.effects(), git=git), root=root, paths=paths.paths_from(folder.parents[1]))) self.assertEqual([(item.id, item.awaits_merge) for item in held.plan.items], [(7, ""), (3, "#12 https://github.com/o/r/pull/12"), (1, "")]) - self.assertEqual(fake.made("forge")[0][:3], ["gh", "pr", "list"]) + self.assertEqual(fake.made("forge")[0][:4], [root, "gh", "pr", "list"]) self.assertIsNone(chunk_start.plan_item(held, None, fake.effects()), "items 7 and 3 wait, so no item of the next release routes the chunk") + window = chunk_windows.next_plan(root, folder.parents[1], dataclasses.replace(fake.effects(), git=git)) + self.assertEqual((window.awaits_merge, fake.made("forge")[1][:4]), (True, [root, "gh", "pr", "list"]), "a window starts by the same pick") def test_reads_a_plan_outside_the_checkout_as_it_stands_and_stops_without_a_config(self): with tempfile.TemporaryDirectory() as root: diff --git a/bin/loop_claude/loop/test_chunk_windows.py b/bin/loop_claude/loop/test_chunk_windows.py index 71099dfa..ee35d0fa 100644 --- a/bin/loop_claude/loop/test_chunk_windows.py +++ b/bin/loop_claude/loop/test_chunk_windows.py @@ -61,6 +61,11 @@ class ChunkWindows(unittest.TestCase): windows = [tmux.Listed(f"item-{n}", "", False) for n in (1, 2, 3)] self.assertEqual(chunk_windows.room_of(windows, "item-1", False, 2).left, 0) + def test_stops_on_the_pull_requests_where_every_item_left_awaits_a_persons_merge_and_nothing_runs(self): + awaited = next_chunk.NoItem("every item of release 1.0.0 waits. Pull request #7 awaits a person's merge.", True) + self.assertEqual(chunk_windows.may_start(awaited, [], set(), 1), Failure(awaited.why)) + self.assertEqual(chunk_windows.may_start(awaited, ["item-5"], set(), 1), [], "a running or restarted chunk goes on, and no chunk without an item joins it") + def test_starts_no_item_that_overlaps_a_running_chunks_items(self): # Item 1 merged, so 2 is the plan's next item; it overlaps item 3, which still runs, at c.py. items = touch_plan((2, "1.0.0", "", "- `a.py`\n- `c.py`"), (3, "1.0.0", "", "- `c.py`"), (4, "1.0.0", "", "- `d.py`")) diff --git a/bin/loop_effects/doubles.py b/bin/loop_effects/doubles.py index 7226ac89..84e3b4ee 100644 --- a/bin/loop_effects/doubles.py +++ b/bin/loop_effects/doubles.py @@ -62,7 +62,7 @@ class FakeEffects: discard_typed=lambda: self.calls.append(("discard_typed", None)), dm=self.dm, execv=self.execv, - forge=lambda cwd: lambda command: self.answer("forge", command), + forge=lambda cwd: lambda command: self.answer("forge", [cwd, *command]), git=lambda *args, cwd=None, timeout=None, guarded=False, errors="strict": self.answer("git", list(args)), input=lambda prompt: self.answer("input", prompt), local_time=lambda seconds: f"<{seconds}>", diff --git a/bin/release_plan/next_chunk.py b/bin/release_plan/next_chunk.py index e9c7deb9..67c6dfe3 100644 --- a/bin/release_plan/next_chunk.py +++ b/bin/release_plan/next_chunk.py @@ -40,6 +40,8 @@ class NextChunk: class NoItem: """Why the plan names no item for the next chunk, as a sentence the worker reads.""" why: str + # Whether why names pull requests that await a person's merge, so that no chunk starts until one is merged. + awaits_merge: bool = False def cut_name(cut: LastCut) -> str | None: @@ -81,8 +83,11 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi return NoItem(f"{where} holds no item for {upcoming}, and changes are unreleased, and its release review has landed, so that release is finished and ready to cut. The working loop stops here. If todo.md renamed that release instead, add `- renamed to ` to todo.md's `## Renamed` section.") return NoItem(f"{where} holds no item for {upcoming}, and no change is unreleased, so that release is to be planned first.") first = pick.item + if first is None and pick.release is not None: + merges = awaited_merges(weighed.carried, pick.release) + return NoItem(f"every item of release {version(pick.release)} in {where} waits.{merges}", bool(merges)) if first is None: - return NoItem(f"every item of release {version(pick.release)} in {where} waits.{awaited_merges(weighed.carried, pick.release)}" if pick.release is not None else f"{where}'s items table holds no item.") + return NoItem(f"{where}'s items table holds no item.") held = weighed.carried # Every carried item takes one release, the next. over = CarriedOver(next(item.release for item in held if item.id == weighed.moved[0]), weighed.moved) if weighed.moved else None @@ -90,6 +95,8 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi first = next((item for item in held if item.id == item_id), None) if first is None: return NoItem(f"{where} holds no item {item_id}, the one --item names; it may have shipped.") + if first.awaits_merge: + return NoItem(f"item {item_id}, the one --item names, is finished on the branch of pull request {first.awaits_merge}, which awaits a person's merge.") return NextChunk(held, first, f"{first.tagline}\n\n{first.detail}".strip(), branch, over, item_id is not None) @@ -101,5 +108,5 @@ def awaited_merges(found: list[Item], release: Release) -> str: pulls.setdefault(item.awaits_merge, []).append(str(item.id)) if not pulls: return "" - named = listed([f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed(ids, 'and')}" for pull, ids in pulls.items()], "and") - return f" Under `merge = \"human\"`, a person's merge is awaited of pull request {named}. The working loop stops here until one is merged." + named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed(ids, 'and')}" for pull, ids in pulls.items()) + return f" Under `merge = \"human\"`, these pull requests await a person's merge: {named}. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again." diff --git a/bin/release_plan/test_release_standing.py b/bin/release_plan/test_release_standing.py index 78ed47b2..3be9fc38 100644 --- a/bin/release_plan/test_release_standing.py +++ b/bin/release_plan/test_release_standing.py @@ -402,7 +402,7 @@ class AwaitingMerge(unittest.TestCase): def setUp(self): self.repo = tempfile.mkdtemp() self.addCleanup(subprocess.run, ["rm", "-rf", self.repo]) - run = lambda *args: subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, cwd=self.repo, env=isolated_env(), text=True).stdout.strip() + run = self.run = lambda *args: subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, cwd=self.repo, env=isolated_env(), text=True).stdout.strip() rows = lambda *ids: HEADER + "".join(ROW.format(id=id_, release="0.1.0") for id_ in ids) run("init", "-q", "-b", "main") run("remote", "add", "origin", "https://github.com/o/r") @@ -426,6 +426,15 @@ class AwaitingMerge(unittest.TestCase): def test_names_none_for_a_pull_request_whose_head_the_checkout_lacks_and_fails_where_the_forge_does(self): unfetched = f"7\thttps://github.com/o/r/pull/7\t{'b' * 40}\tfalse\tfalse\n" self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: unfetched), {}) + self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: unfetched + self.listed), {1: "#7 https://github.com/o/r/pull/7"}, "the pull request listed after it still counts") + + def test_names_none_for_a_pull_request_whose_head_holds_no_plan(self): + self.run("checkout", "-q", "-b", "planless") + self.run("rm", "-q", "todo.md") + self.run("commit", "-q", "-m", "Drop the plan") + planless = f"9\thttps://github.com/o/r/pull/9\t{self.run('rev-parse', 'HEAD')}\tfalse\tfalse\n" + self.run("checkout", "-q", "main") + self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: planless), {}) self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: Failure("gh: no network")).reason, "gh: no network") def test_the_projects_plan_passes_over_an_item_that_awaits_a_persons_merge(self): @@ -433,6 +442,8 @@ class AwaitingMerge(unittest.TestCase): self.assertEqual([(item.id, item.awaits_merge) for item in held.plan.items], [(1, "#7 https://github.com/o/r/pull/7"), (2, ""), (3, ""), (4, "")]) self.assertIsNone(held.merges_unread) self.assertEqual(release_standing.chunk_item(held.plan.items, held.cut).item.id, 2) + self.assertEqual(next_chunk.planned(held.plan, held.cut, "main", "item-{id}", item_id=1), next_chunk.NoItem("item 1, the one --item names, is finished on the branch of pull request #7 https://github.com/o/r/pull/7, which awaits a person's merge.")) + self.assertEqual(next_chunk.planned(held.plan, held.cut, "main", "item-{id}", item_id=2).first.id, 2) self.assertEqual([item.id for item in todo_table.bundle_candidates(held.plan.items, held.plan.items[1])], [3, 4]) def test_the_projects_plan_asks_no_forge_where_the_chunk_merges_or_no_forge_is_given(self): @@ -441,12 +452,27 @@ class AwaitingMerge(unittest.TestCase): self.assertEqual((asked, [item.awaits_merge for item in chunk.plan.items]), ([], [""] * 4)) self.assertEqual([item.awaits_merge for item in release_standing.project_plan(self.config, "main", self.repo).plan.items], [""] * 4) + def test_the_projects_plan_asks_no_forge_about_a_plan_kept_outside_the_checkout(self): + outside = pathlib.Path(tempfile.mkdtemp()) + self.addCleanup(subprocess.run, ["rm", "-rf", str(outside)]) + (outside / "todo.md").write_text(pathlib.Path(self.repo, "todo.md").read_text()) + asked: list[list[str]] = [] + held = release_standing.project_plan(dataclasses.replace(self.config, paths=self.config.paths | {"plan": outside / "todo.md"}), "main", self.repo, forge_run=lambda command: asked.append(command) or self.listed) + self.assertEqual((asked, [item.awaits_merge for item in held.plan.items]), ([], [""] * 4)) + def test_the_projects_plan_says_why_where_the_forge_cannot_list_the_pull_requests(self): held = release_standing.project_plan(self.config, "main", self.repo, forge_run=lambda command: Failure("gh: no network")) self.assertEqual(([item.awaits_merge for item in held.plan.items], held.merges_unread.reason), ([""] * 4, "gh: no network")) + self.run("remote", "remove", "origin") + remoteless = release_standing.project_plan(self.config, "main", self.repo, forge_run=lambda command: self.listed) + self.assertEqual([item.awaits_merge for item in remoteless.plan.items], [""] * 4) + self.assertIsInstance(remoteless.merges_unread, Failure) def test_says_which_pull_requests_await_a_merge_where_every_item_left_waits(self): held = release_standing.project_plan(self.config, "main", self.repo, forge_run=lambda command: self.listed) - items = [dataclasses.replace(item, awaits_merge="#8 https://github.com/o/r/pull/8" if item.id != 1 else item.awaits_merge) for item in held.plan.items] + items = [dataclasses.replace(item, awaits_merge="#8 https://github.com/o/r/pull/8" if item.id in (2, 3) else item.awaits_merge) for item in held.plan.items] + items[3] = dataclasses.replace(items[3], exempt="question") none = next_chunk.planned(Plan(items), held.cut, "main", "item-{id}") - self.assertEqual(none.why, "every item of release 0.1.0 in main's todo.md waits. Under `merge = \"human\"`, a person's merge is awaited of pull request #7 https://github.com/o/r/pull/7, which finishes item 1 and #8 https://github.com/o/r/pull/8, which finishes items 2, 3 and 4. The working loop stops here until one is merged.") + self.assertEqual(none.why, "every item of release 0.1.0 in main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #7 https://github.com/o/r/pull/7, which finishes item 1; #8 https://github.com/o/r/pull/8, which finishes items 2 and 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.") + self.assertTrue(none.awaits_merge) + self.assertFalse(next_chunk.planned(Plan([dataclasses.replace(item, awaits_merge="", exempt="question") for item in items]), held.cut, "main", "item-{id}").awaits_merge)