Answer stability round 2: 0 🔴, 2 🟡; take the next release as the earliest todo.md has named since the last cut, so an emptied patch or a major jump stops the loop too, count work landed by the Unreleased entries before commits, read the default branch once, and test the emptied release and the stalled origin through real git

This commit is contained in:
2026-10-17 02:34:15 +02:00
parent 4cf3c2bd8c
commit 5ba8920dbf
13 changed files with 224 additions and 142 deletions
+9 -11
View File
@@ -12,10 +12,11 @@ that branch holds it, the plan loop-claude routes on, and prints:
holds under ## Unreleased, or else how many commits followed the tag;
- the earliest release in todo.md, and that release's first item that does not wait, the item
loop-claude routes on, with its L and E + I. It names that item only where the tag names no
version x.y.z, or the release is x.y.z+1, x.y+1.0 or x+1.0.0. For a later release, or a todo.md
that holds no item, it says the release after the tag holds none: finished and ready to cut where
commits followed the tag, and else to be planned first. For x.y.z or an earlier release, it says
todo.md files items under a release already cut;
version x.y.z, or the release is the earliest after x.y.z that todo.md has named at the tag or
since: the next release. Where the next release holds no item, it says so: finished and ready to
cut where work landed since the tag, counted as the ## Unreleased entries or else the commits, and
else to be planned first. For x.y.z or an earlier release, it says todo.md files items under a
release already cut;
- the item's worktree: a sibling of the checkout named <checkout>-item-<ID>, on the branch
item-<ID>. It continues a worktree already on that branch; else it adds one on the local branch,
else on a new branch tracking origin's, else on a new branch off the default branch;
@@ -46,7 +47,7 @@ import typing
from git_repo import commit_exists, default_branch, default_plan, file_at, git, top
from failure import Failure
from chunk_preflight.gathered import Forge, forge_of, Gathered, ItemFacts, named_paths, NamedPath, NoItem, Plan, planned, pulls_command, Ran, Release, Worktree, worktree_add, worktree_on
from chunk_preflight.gathered import Forge, forge_of, Gathered, ItemFacts, named_paths, NamedPath, NoItem, Plan, planned, pulls_command, Ran, Worktree, worktree_add, worktree_on
from chunk_preflight.facts import render
BIN = pathlib.Path(__file__).resolve().parents[1]
@@ -96,13 +97,10 @@ def preflight(root: pathlib.Path, timeout: float) -> list[str] | Failure:
if isinstance(default, Failure):
return default
ref, note = default
held = default_plan(str(root), timeout)
if isinstance(held, Failure):
return held
cut = Release(held.tag, file_at(ref, "CHANGELOG.md", str(root)), held.commits)
plan = planned(held.todo, cut, ref)
held = default_plan(str(root), ref)
plan = planned(held.todo, held.cut, ref)
item = plan if isinstance(plan, NoItem) else item_facts(root, ref, plan, timeout)
return render(Gathered(ref, note, cut, item))
return render(Gathered(ref, note, held.cut, item))
def item_facts(root: pathlib.Path, default: str, plan: Plan, timeout: float) -> ItemFacts: