From a030a8eee9ffbdecb253e1147cf670d2d56b8437 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 03:13:35 +0100 Subject: [PATCH] Say in the changelog where a fast-forwarded feature starts --- CHANGELOG.md | 2 +- bin/task_bench/main.py | 11 ++++----- bin/task_bench/shipped_features.py | 30 ++++++++++++++++--------- bin/task_bench/test_shipped_features.py | 7 +++--- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b0b1f8c..eaf7597c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `task-bench --tasks shipped-features` benches rebuilding features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of its plan item, and checks the build with the tests that change holds. `--shipped ` sets how many it takes, and a feature whose branch landed by fast-forward is passed over. +- `task-bench --tasks shipped-features` benches rebuilding features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of its plan item, and checks the build with the tests that change holds. `--shipped ` sets how many it takes, and a feature whose branch landed by fast-forward starts after the latest earlier chunk that shipped an item or landed by a merge or a rebase, and is passed over where none comes before it or its branch merged the default branch into itself. - `task-bench` plants a Python mutant in a file whose lines end in CRLF, which it could not re-apply before, and a Go mutant there keeps applying. - This repo documents its own `task-bench` command in the README → Test, with `task-bench-image/Dockerfile`, an image that holds pytest, git and tmux, so each scoring run in `larv-review` benches claude-config and records its figures. - The stability reviewer now checks a lookup key built by joining path segments, or matched by prefix, for two inputs that give one key, such as a column named like its own table or the namespaces `ns` and `ns.sub`. diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 8c7eead8..1eec166d 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -85,11 +85,12 @@ on the base's first-parent history that took an item out of `todo.md`. A chunk i commits a rebase landed together, which share a commit time. A chunk with a commit whose title opens `Drop item :` took that item out unbuilt, so it didn't ship it. Commits fast-forwarded onto the branch keep a commit time each, so each is a chunk of its own, and the chunk that took the item out holds only the feature's last commit. The feature then starts after the latest -earlier chunk that took an item out or landed by a merge or a rebase, leaving out a merge of the default branch into a feature -branch, titled `Merge ... into `. A commit between two features that belongs to neither joins the later one; it counts -only where its tests fail after the revert and pass with the reference patch, as for any feature. A fast-forwarded feature with -no such chunk before it is passed over. The bench goes through the shipped features newest first, until --shipped of -them, 5 by default, count. For each: +earlier chunk that took an item out or landed by a merge or a rebase. A commit between two features that belongs to neither +joins the later one; it counts only where its tests fail after the revert and pass with the reference patch, as for any feature. +A fast-forwarded feature is passed over where no such chunk comes before it, and where its branch merged the default branch into +itself, since its commits then hold the changes of the features that merge brought in. A merge titled +`Merge remote-tracking branch '...' into ` is read as that, whatever the branch. The bench goes through the shipped +features newest first, until --shipped of them, 5 by default, count. For each: - it takes the feature's change out of a copy of each side's tree, as `git apply -R` does. The plan and the project's records stay as the side holds them, since later chunks added to them. The records are the changelog, the comprehension history, the decisions, the reading cost and the score anchors. So Haiku can read there what the changelog says of the feature; diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py index a62f9b4b..cabefdd4 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/shipped_features.py @@ -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 diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index b3b5a82f..5e9c0555 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -17,8 +17,8 @@ from task_bench.test_task_bench import BASE_CODE, HEAD_CODE from failure import Failure from git_cli.git_repo import git from task_bench import main +from task_bench.shipped_features import MERGED_IN, read_shipped from branch_chunks.read import READ_AT -from task_bench.shipped_features import read_shipped HEADER = "| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves |\n|---|---|---|---|---|---|---|---|---|---|---|\n" ROWS = { @@ -275,9 +275,10 @@ class ReadShippedTest(ShippedFeaturesCase): self.landed(9, "Finish item 11 in the plan", written_then=True) return self.git("rev-parse", "main~1") - def test_a_fast_forwarded_feature_starts_before_a_merge_of_the_default_branch_into_its_branch(self): + def test_passes_over_a_fast_forwarded_feature_whose_branch_merged_the_default_branch_into_itself(self): self.fast_forwarded_item_11_around_a_merge("Merge remote-tracking branch 'origin/main' into item-11") - self.assertEqual(self.read().found[0].before, self.git("rev-parse", "main~4")) + newest = self.read().found[0] + self.assertEqual((newest.name, newest.before, newest.passed_over), ("item 11", None, MERGED_IN)) def test_a_fast_forwarded_feature_starts_after_a_chunk_that_landed_by_a_merge_and_shipped_no_item(self): merge = self.fast_forwarded_item_11_around_a_merge("Merge pull request 'Release review' (#7) from release-review into main")