Say in the changelog where a fast-forwarded feature starts
CI / tests (pull_request) Failing after 4m6s

This commit is contained in:
2026-11-24 03:13:35 +01:00
parent 767a9e1217
commit a030a8eee9
4 changed files with 30 additions and 20 deletions
+19 -11
View File
@@ -20,11 +20,13 @@ from task_bench.runs import of_tests
from project_config.settings import RECORDS
from task_bench.figures import Side, SIDES
# Why a feature that landed by fast-forward is passed over where no earlier chunk says where its commits start.
FAST_FORWARDED = "its branch landed by fast-forward, and nothing earlier marks where its commits start"
# What git titles a merge of the default branch into a feature branch. Such a merge sits inside the feature's own commits, so it
# doesn't mark where the feature starts.
SYNC_MERGE = re.compile(r"Merge .* into (?!main$|master$)\S+")
# Why a feature that landed by fast-forward is passed over: no earlier chunk says where its commits start, or its branch merged
# the default branch into itself, so its commits hold what other features built.
NO_START = "its branch landed by fast-forward, and nothing earlier marks where its commits start"
MERGED_IN = "its branch landed by fast-forward after merging the default branch into itself, so its commits hold other features' changes"
# What git titles a merge of the default branch into a feature branch, other than into main or master, which git leaves out of
# the title. A person's merge of a branch into another default branch has the same title; its feature is then passed over.
SYNC_MERGE = re.compile(r"Merge (?:remote-tracking )?branch '[^']+' into (?!main$|master$)\S+")
# The options that keep the checkout's diff config out of a patch. --no-renames writes a renamed file as one file removed and
# one added, so `git apply` doesn't have to detect the rename again.
@@ -34,12 +36,13 @@ PLAIN_DIFF = ("--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", "-
class Shipped(typing.NamedTuple):
"""A feature the project shipped: the name the report gives it, such as `item 7`, the tagline of each item its chunk took out
of the plan, a paragraph each, and the commits its change runs between. before is None where the history doesn't say where
the change starts."""
the change starts, and passed_over then says why."""
name: str
told: str
before: str | None
tip: str
passed_over: str = ""
class ShippedFeatures(typing.NamedTuple):
@@ -67,15 +70,20 @@ def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> Ship
found: list[Shipped] = []
# The oldest chunk first, so each feature knows the commit that ends the chunk before it.
marked = None
merged_in = False
for chunk, items in reversed(list(zip(branch.chunks, shipped))):
if items:
# A fast-forwarded feature's commits are a chunk each, and this chunk holds only the last. The earlier ones follow the
# commit that ends the latest earlier chunk of another feature.
starts = marked if chunk.landing == "push" else chunk.before
starts, why = chunk.before, ""
if chunk.landing == "push":
starts, why = (None, NO_START) if marked is None else (None, MERGED_IN) if merged_in else (marked, "")
told = "\n\n".join(tagline_text(item.tagline) for item in items)
found.append(Shipped(named(items), told, starts, chunk.tip))
if (items or chunk.landing != "push") and not SYNC_MERGE.fullmatch(branch.commits[chunk.tip].title):
marked = chunk.tip
found.append(Shipped(named(items), told, starts, chunk.tip, why))
if SYNC_MERGE.fullmatch(branch.commits[chunk.tip].title):
merged_in = True
elif items or chunk.landing != "push":
marked, merged_in = chunk.tip, False
found.reverse()
if not found:
return Failure("No chunk on the base's history took an item out of todo.md, so that history holds no shipped feature to rebuild.")
@@ -99,7 +107,7 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned
break
# A feature passed over leaves no folder, so the next one tried takes the same number.
folder = bench.folder / "shipped-features" / str(len(tasks) + 1)
taken_out = FAST_FORWARDED if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", functools.partial(without, bench, feature, feature.before, shipped.records, folder))
taken_out = feature.passed_over if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", functools.partial(without, bench, feature, feature.before, shipped.records, folder))
why = taken_out if not isinstance(taken_out, TakenOut) else why_passed_over(bench, taken_out.trees, taken_out.feature)
if isinstance(why, Failure):
return why