Bench rebuilding a shipped feature: take its chunk's change out, tell Haiku the item's tagline, check with the tests the change holds

This commit is contained in:
2026-11-24 00:29:25 +01:00
parent c0445a26d7
commit 87726f9f0b
7 changed files with 222 additions and 35 deletions
+13 -6
View File
@@ -1,9 +1,10 @@
import pathlib
from branch_chunks.fixes import blamed, fixing_changes, FixingChange, removed_work, Traced, with_fixes
from branch_chunks.cut import BranchChunk, cut_branch, LOG, NOT_WORK, plan_revisions, shipped_by
from branch_chunks.cut import Branch, BranchChunk, cut_branch, LOG, NOT_WORK, plan_revisions, shipped_by
from failure import Failure
from git_cli.git_repo import git, Git, text_at
from plan.todo_table import Item
from project_config.main import located
from project_config.settings import ProjectConfig
from record_store.stores import store
@@ -37,6 +38,16 @@ def branch_chunks(default: str, run: Git, titles: templates.Titles) -> list[Bran
"""Each chunk on the default branch's first-parent line, newest first, with the todo.md items it shipped and the later chunks that fixed code it shipped.
titles holds the project's title templates, which each commit's title is read through. run must run git in the checkout's top: the diff names each path from the top, while blame and a pathspec read a path from the current directory."""
cut = cut_with_shipped(default, run, titles)
if isinstance(cut, Failure):
return cut
branch, shipped = cut
traced = traces(fixing_changes(branch, shipped), run)
return traced if isinstance(traced, Failure) else with_fixes(branch, shipped, traced)
def cut_with_shipped(default: str, run: Git, titles: templates.Titles) -> tuple[Branch, list[tuple[Item, ...]]] | Failure:
"""The default branch cut into chunks, and the todo.md items each chunk shipped, in the order of the branch's chunks, newest first. run and titles are branch_chunks' own."""
# The -- keeps a file named like the branch from making it ambiguous.
log = run(*LOG, default, "--")
if isinstance(log, Failure):
@@ -45,11 +56,7 @@ def branch_chunks(default: str, run: Git, titles: templates.Titles) -> list[Bran
if isinstance(branch, Failure):
return branch
plans = plans_at(plan_revisions(branch), run)
if isinstance(plans, Failure):
return plans
shipped = shipped_by(branch, plans)
traced = traces(fixing_changes(branch, shipped), run)
return traced if isinstance(traced, Failure) else with_fixes(branch, shipped, traced)
return plans if isinstance(plans, Failure) else (branch, shipped_by(branch, plans))
def plans_at(revisions: list[str], run: Git) -> dict[str, str] | Failure: