Answer architecture round 1: 4 🔴, 5 🟡 (0 misread); one-way plan packages with a plan core and an Atlassian client, one parse and print of an item's cells, a pure chunk-start decision, a settings table, one plan read and one standing per pick, one config load in chunk-pr, notifier backends in notifier, and the bin regroup filed as item 392

This commit is contained in:
2026-11-16 14:47:46 +01:00
parent 3f7d85c48e
commit f58250d0ce
103 changed files with 1299 additions and 1044 deletions
+43 -27
View File
@@ -2,11 +2,11 @@
import dataclasses
from git_cli.git_repo import commits_since, file_at, git, Git
from release_plan.release import dated, dated_heading_pattern, newest_tag, parsed, Release, tagged
from plan.release import dated, dated_heading_pattern, newest_tag, parsed, Release, tagged
from failure import Failure
from release_plan.todo_table import Item, items, next_item, renames
from plan_store.stores import Plan
from plan_store import stores as plan_stores
from plan.todo_table import Item, items, next_item, renames
from plan_store.plans import Plan
from plan_store import stores as plan_stores, plans
from project_config.settings import ProjectConfig
from text_files.markdown_text import sections
from record_store import stores
@@ -38,8 +38,8 @@ class Upcoming:
"""The next release, and whether work has landed towards it, as `~/.claude/CLAUDE.md` → "Working loop" uses both."""
# The earliest release after the last cut that todo.md has named since that cut or the plan holds; without a cut, the earliest todo.md has named or the plan holds. None where there is none.
release: Release | None
# Whether it is the plan's earliest release. Also True without a cut where todo.md has never named a release and the plan holds no item.
is_earliest: bool
# Whether the plan is current: the next release is the plan's earliest, so the plan holds its items. Also True without a cut where todo.md has never named a release and the plan holds no item, since there is no release to plan, review or cut yet.
plan_is_current: bool
# Whether work has landed towards it: one or more changes are unreleased, as unreleased_changes counts them.
unreleased: bool | Failure
@@ -93,7 +93,7 @@ Pick = Next | Cut | ReadyToCut | ReviewDue | Unplanned | Unknown
class DefaultPlan:
"""What the default branch, as last fetched, holds for chunk_item."""
# The plan, a NoItemsTable where the branch holds none.
todo: Plan | Failure
plan: Plan | Failure
cut: LastCut
@@ -102,7 +102,7 @@ def project_plan(config: ProjectConfig, ref: str, root: str, run: Git = git) ->
return default_plan(root, ref, plan_stores.store(config), stores.store(config, "changelog"), config.titles, run)
def default_plan(root: str, ref: str, plan: plan_stores.PlanStore, changelog: stores.RecordStore, titles: templates.Titles, run: Git = git) -> DefaultPlan:
def default_plan(root: str, ref: str, plan: plans.PlanStore, changelog: stores.RecordStore, titles: templates.Titles, run: Git = git) -> DefaultPlan:
"""What ref, the default branch as last fetched, holds for the pick, read in the checkout at root through run. plan is the store the project's config names for its plan, changelog the store it names for the changelog, and titles its title templates."""
tag = newest_tag(root, merged_into=ref, run=run)
changes = stores.held_at(ref, changelog, root, run)
@@ -153,41 +153,57 @@ def todos_since(tag: str | None | Failure, ref: str, plan: str | None, cwd: str,
return texts
def chunk_item(found: list[Item], cut: LastCut) -> Pick:
"""The pick from todo.md's items, weighed against the last cut. Routing and chunk-preflight both pick with it, so they name one item."""
upcoming = next_release(found, cut)
return standing(upcoming, next_item(carried(found, cut)), cut.reviewed) if isinstance(upcoming, Upcoming) else upcoming
@dataclasses.dataclass(frozen=True)
class Standing:
"""The plan's items weighed once against the last cut, which next_release, picked and chunk-preflight all read."""
# Which version is cut, as cut_version says.
version: Release | None
# The releases todo.md has named since the cut, as named_releases reads them.
named: set[Release] | Failure
# The plan's items, each that the plan files under the last cut's version, or an earlier one, filed under the next release: the earliest after the cut that the plan holds or todo.md has named since it. Someone cut a release while it held those items, and the loop works on: lilleman's call, 2026-11-16. The plan's items as they are where nothing is cut, and where no release after the cut is known, since naming one is the human's.
carried: list[Item]
# The IDs of the items carried files under another release than the plan does, in the plan's order.
moved: tuple[int, ...]
def carried(found: list[Item], cut: LastCut) -> list[Item]:
"""found, with the release of each item that the plan files under the last cut's version, or an earlier one, replaced by the next release: the earliest after the cut that the plan holds or todo.md has named since it.
Someone cut a release while it held those items, and the loop works on: lilleman's call, 2026-11-16. found itself where nothing is cut, and where no release after the cut is known, since naming one is the human's.
"""
def standing_of(found: list[Item], cut: LastCut) -> Standing:
"""found, the plan's items, weighed against cut."""
version = cut_version(cut)
named = named_releases(cut.todos_since)
known = {item.release for item in found} | (set() if isinstance(named, Failure) else named)
after = set() if version is None else {release for release in known if release > version}
if not after or all(item.release >= min(after) for item in found):
return found
return [dataclasses.replace(item, release=max(item.release, min(after))) for item in found]
return Standing(version, named, found, ())
held = [dataclasses.replace(item, release=max(item.release, min(after))) for item in found]
return Standing(version, named, held, tuple(was.id for was, now in zip(found, held) if was.release != now.release))
def next_release(found: list[Item], cut: LastCut) -> Upcoming | Cut | Unknown:
"""The next release after cut, and whether work has landed towards it. found holds the plan's items.
def chunk_item(found: list[Item], cut: LastCut) -> Pick:
"""The pick from the plan's items, weighed against the last cut. Routing and chunk-preflight both pick with it, so they name one item."""
return picked(standing_of(found, cut), cut)
Cut where the plan files items under the last cut's version or earlier and no later release is known for carried to file them under, and Unknown where the tags, or todo.md's texts since the cut, cannot be read.
def picked(weighed: Standing, cut: LastCut) -> Pick:
"""chunk_item's pick, from the plan's items already weighed against cut."""
upcoming = next_release(weighed, cut)
return pick_from(upcoming, next_item(weighed.carried), cut.reviewed) if isinstance(upcoming, Upcoming) else upcoming
def next_release(weighed: Standing, cut: LastCut) -> Upcoming | Cut | Unknown:
"""The next release after cut, and whether work has landed towards it. weighed holds the plan's items, weighed against cut.
Cut where the plan files items under the last cut's version or earlier and no later release is known to carry them to, and Unknown where the tags, or todo.md's texts since the cut, cannot be read.
Where the branch has no tag, todos_since holds every version of todo.md, so a release todo.md named whose items are all done still reads as the next release.
"""
if isinstance(cut.tag, Failure):
return Unknown()
earliest = min((item.release for item in carried(found, cut)), default=None)
version = cut_version(cut)
earliest = min((item.release for item in weighed.carried), default=None)
version = weighed.version
if version is None:
return Upcoming(earliest, True, has_unreleased(cut))
if earliest is not None and earliest <= version:
return Cut(earliest)
named = named_releases(cut.todos_since)
named = weighed.named
if isinstance(named, Failure):
return Unknown()
after = {release for release in named if release > version}
@@ -219,12 +235,12 @@ def has_unreleased(cut: LastCut) -> bool | Failure:
return changes if isinstance(changes, Failure) else changes > 0
def standing(upcoming: Upcoming, first: Item | None, reviewed: bool | Failure) -> Next | ReadyToCut | ReviewDue | Unplanned | Unknown:
def pick_from(upcoming: Upcoming, first: Item | None, reviewed: bool | Failure) -> Next | ReadyToCut | ReviewDue | Unplanned | Unknown:
"""How the plan stands to upcoming, the next release. first is next_item's pick, which the pick holds where it is Next.
Unknown where the next release holds no item and the unreleased changes cannot be counted, or work has landed and git cannot say whether a release review has.
"""
if upcoming.is_earliest:
if upcoming.plan_is_current:
return Next(upcoming.release, first)
if isinstance(upcoming.unreleased, Failure):
return Unknown()