Run the architecture and principles passes only in a release review before each cut

This commit is contained in:
2026-10-29 21:03:25 +01:00
parent 9debeb03cb
commit 6bc1e9ac9c
16 changed files with 146 additions and 57 deletions
+26 -6
View File
@@ -18,6 +18,8 @@ class LastCut:
commits: int | Failure
# todo.md's text at the tag and at each later commit that changed it, oldest first, as named_releases reads them; empty without a tag.
todos_since: list[str] | Failure
# Whether a release review has landed since the tag, as release_reviewed reads it.
reviewed: bool | Failure = False
@dataclasses.dataclass(frozen=True)
@@ -53,6 +55,13 @@ class ReadyToCut:
release: tuple[int, int, int] | None
@dataclasses.dataclass(frozen=True)
class ReviewDue:
"""The next release holds no item and work has landed towards it, but no release review has landed since the cut: `~/.claude/skills/larv-review/SKILL.md` → "Release review"."""
# The next release, None where todo.md has named none since the cut.
release: tuple[int, int, int] | None
@dataclasses.dataclass(frozen=True)
class Unplanned:
"""The next release holds no item, and no work has landed towards it."""
@@ -66,7 +75,7 @@ class Unknown:
# How the plan stands to the last cut, with the item the next chunk takes first where there is one.
Pick = Next | Cut | ReadyToCut | Unplanned | Unknown
Pick = Next | Cut | ReadyToCut | ReviewDue | Unplanned | Unknown
@dataclasses.dataclass(frozen=True)
@@ -81,7 +90,14 @@ 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(file_at(ref, "todo.md", root), LastCut(tag, file_at(ref, "CHANGELOG.md", root), commits, todos_since(tag, ref, root)))
reviewed = tag if isinstance(tag, Failure) else release_reviewed(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), reviewed))
def release_reviewed(tag: str | None, ref: str, cwd: str) -> bool | Failure:
"""Whether ref holds, after tag or in all where tag is None, a commit titled as a release review opens: `Release review of <release>`."""
titles = git("log", "--format=%s", f"{tag}..{ref}" if tag else ref, cwd=cwd)
return titles if isinstance(titles, Failure) else any(title.startswith("Release review of ") for title in titles.splitlines())
def todos_since(tag: str | None | Failure, ref: str, cwd: str) -> list[str] | Failure:
@@ -103,7 +119,7 @@ def todos_since(tag: str | None | Failure, ref: str, cwd: str) -> list[str] | Fa
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(found)) if isinstance(upcoming, Upcoming) else upcoming
return standing(upcoming, next_item(found), cut.reviewed) if isinstance(upcoming, Upcoming) else upcoming
def next_release(found: list[Item], cut: LastCut) -> Upcoming | Cut | Unknown:
@@ -139,16 +155,20 @@ def landed(cut: LastCut) -> bool | Failure:
return changes if isinstance(changes, Failure) else changes > 0
def standing(upcoming: Upcoming, first: Item | None) -> Next | ReadyToCut | Unplanned | Unknown:
def standing(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.
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:
return Next(upcoming.release, first)
if isinstance(upcoming.landed, Failure):
return Unknown()
return ReadyToCut(upcoming.release) if upcoming.landed else Unplanned(upcoming.release)
if not upcoming.landed:
return Unplanned(upcoming.release)
if isinstance(reviewed, Failure):
return Unknown()
return ReadyToCut(upcoming.release) if reviewed else ReviewDue(upcoming.release)
def unreleased_changes(cut: LastCut) -> int | Failure: