Bench a shipped feature whose branch landed by fast-forward from the commits after the item shipped before it
CI / tests (pull_request) Failing after 4m50s

This commit is contained in:
2026-11-24 02:09:49 +01:00
parent 6f5839479a
commit 280f7521d0
5 changed files with 78 additions and 32 deletions
+1 -1
View File
@@ -228,7 +228,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
- `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter.
- `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it.
- `subagent-rung [--plan] <model> <L>` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule.
- `task-bench --image <image> --test <shell text> [<options>]` plants bugs that the tests catch, in the Go and Python files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. It passes over a feature whose branch landed by fast-forward. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams.
- `task-bench --image <image> --test <shell text> [<options>]` plants bugs that the tests catch, in the Go and Python files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. Where a feature's branch landed by fast-forward, its change runs from the commit after the one that took the previous item out of the plan. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams.
- `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show <ID>` one item's row and detail; `add …` files an item under the next free ID, `edit <ID> …` sets an item's cells or detail, and `move <ID> --release <version>` sets an item's release; `finish <ID>` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`, except for a plan kept in Jira. Each change ranks a markdown plan. `todo-item --help` states the flags.
- `touch-predictions record <ID>...` appends what a chunk's items were predicted to touch, under `Touches:` in their details, beside the files and parts its branch touched, to the record the config names as `touch-predictions`; `touch-predictions --help` shows the spelling and how a part is named. `chunk-preflight` reads the same predictions to name the items that may start chunks at once.
- `wait-for <file> [<pattern>] [--timeout <seconds>]` waits until a file a background job writes holds a line matching the pattern, and prints it.
+5 -3
View File
@@ -91,9 +91,11 @@ them, 5 by default, count. For each:
- Haiku is told the tagline of the item, or of each item the chunk shipped;
- the acceptance tests are the test files the change touched, and its files under a `testdata` folder, each as the head holds it;
- the reference patch is the change itself.
With those, a shipped feature counts, and a build passes, as for a feature. The bench also passes over three kinds:
- one whose branch landed by fast-forward. Its commits keep a commit time each, so the history doesn't say which of them
built it;
With those, a shipped feature counts, and a build passes, as for a feature. Where its branch landed by fast-forward, its
commits keep a commit time each, so the history doesn't mark the feature's start. Its change then runs from the commit after
the one that took the previous item out of the plan, and a commit between two features that belongs to neither joins the later
one; the acceptance check still holds. The bench also passes over three kinds:
- one whose branch landed by fast-forward, with no feature shipped before it to start from;
- one whose change doesn't come out of both trees cleanly, as where a later chunk rewrote its lines;
- one whose change touched no test the head still holds.
The report says which and why. The table has a row per shipped feature and side, named by its items, as `item 7`.
+22 -13
View File
@@ -14,15 +14,15 @@ from branch_chunks.read import cut_with_shipped, unsupported
from failure import Failure
from git_cli.git_repo import Git
from plan.todo_table import Item, tagline_text
from branch_chunks.cut import Landing
from project_config.main import located
from task_bench.runs import of_tests
from project_config.settings import RECORDS
from task_bench.figures import Side, SIDES
# Why a feature whose chunk landed by fast-forward is passed over. Each of its commits is a chunk of its own to branch_chunks,
# so the chunk that took the item out holds the branch's last commit alone.
FAST_FORWARDED = "its branch landed by fast-forward, so the history doesn't say which commits built it"
# Why a feature whose chunk landed by fast-forward and has no earlier feature before it is passed over. Each of its commits is a
# chunk of its own to branch_chunks, so the chunk that took the item out holds the branch's last commit alone, and only the commit
# of the feature shipped before it says where the branch starts.
FAST_FORWARDED = "its branch landed by fast-forward, and no feature shipped before it to say which commits built it"
# 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.
@@ -31,13 +31,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, the commits its chunk's change runs between, and how the chunk landed."""
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."""
name: str
told: str
before: str
before: str | None
tip: str
landing: Landing
class ShippedFeatures(typing.NamedTuple):
@@ -62,11 +62,20 @@ def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> Ship
if isinstance(cut, Failure):
return cut
branch, shipped = cut
found = [
Shipped(named(items), "\n\n".join(tagline_text(item.tagline) for item in items), chunk.before, chunk.tip, chunk.landing)
for chunk, items in zip(branch.chunks, shipped)
if items and chunk.before
]
found: list[Shipped] = []
# The oldest chunk first, so each feature knows the commit the one before it shipped at.
shipped_at = None
for chunk, items in reversed(list(zip(branch.chunks, shipped))):
if not items:
continue
if chunk.before:
# A fast-forwarded branch keeps a commit time per commit, so branch_chunks cuts each commit into a chunk of its own, and
# this chunk holds only the commit that took the item out. The feature is every commit since the last item shipped.
starts = shipped_at if chunk.landing == "push" else chunk.before
told = "\n\n".join(tagline_text(item.tagline) for item in items)
found.append(Shipped(named(items), told, starts, chunk.tip))
shipped_at = chunk.tip
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.")
return ShippedFeatures(found, [path for path in map(config.tracked, ("plan", *RECORDS)) if path])
@@ -89,7 +98,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.landing == "push" else on_disk(f"take {feature.name} out of the trees in {folder}", lambda: without(bench, feature, shipped.records, folder))
taken_out = FAST_FORWARDED if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", lambda: without(bench, feature, 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
+38 -15
View File
@@ -92,6 +92,22 @@ class ShippedFeaturesCase(BenchOfTasksCase):
self.env.pop(name, None)
def fast_forwarded_item_11(self):
"""Item 11 lands as a fast-forward leaves a branch: a plan commit, the feature and the commit that takes the item out, each
with the time it was written at, so each is a chunk of its own to branch_chunks. The head leaves the default branch after."""
self.git("checkout", "--quiet", "main")
self.plan(11)
self.landed(6, "Plan an item", written_then=True)
(self.repo / "third.go").write_text("package calc\n")
(self.repo / "third_test.go").write_text("test -e third.go\n")
self.landed(7, "Add Third", written_then=True)
self.plan()
self.landed(8, "Finish item 11 in the plan", written_then=True)
self.git("checkout", "--quiet", "-B", "item-1")
(self.repo / "calc.go").write_text(HEAD_CODE)
self.commit("Head")
class ShippedFeatureBenchTest(ShippedFeaturesCase):
def test_has_haiku_rebuild_each_shipped_feature_from_its_tagline_and_checks_it_with_the_tests_its_change_added(self):
report = self.bench()
@@ -175,23 +191,13 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase):
self.assertEqual(report.reason, "No shipped feature on the base's history counts; the lines above say why.")
self.assertIn("task-bench: passed over the shipped feature item 8: its revert doesn't apply at the head.", self.progress.getvalue().splitlines())
def test_passes_over_a_feature_whose_branch_landed_by_fast_forward(self):
# Each commit keeps the time it was written at, so the commit that takes the item out is a chunk of its own.
self.git("checkout", "--quiet", "main")
self.plan(11)
self.landed(6, "Plan an item")
(self.repo / "third.go").write_text("package calc\n")
(self.repo / "third_test.go").write_text("test -e third.go\n")
self.landed(7, "Add Third", written_then=True)
self.plan()
self.landed(8, "Finish item 11 in the plan", written_then=True)
# The bench's base is where the head left the default branch, so the head leaves it after item 11.
self.git("checkout", "--quiet", "-B", "item-1")
(self.repo / "calc.go").write_text(HEAD_CODE)
self.commit("Head")
def test_rebuilds_a_feature_whose_branch_landed_by_fast_forward_from_the_commits_after_the_item_shipped_before_it(self):
self.fast_forwarded_item_11()
report = self.bench(**{"--shipped": "1"})
self.assertNotIsInstance(report, Failure, report)
self.assertEqual(report[1], "Passed over the shipped feature item 11: its branch landed by fast-forward, so the history doesn't say which commits built it.")
# Nothing is passed over, and the feature has a row at each side.
self.assertEqual(report[1], "")
self.assertEqual([line[:23] for line in report if line.startswith("| 1: item 11")], ["| 1: item 11 | base | 0", "| 1: item 11 | head | 0"])
def test_fails_before_docker_runs_where_the_history_shipped_no_item(self):
self.git("branch", "--quiet", "--force", "main", "main~8")
@@ -221,6 +227,23 @@ class ReadShippedTest(ShippedFeaturesCase):
])
self.assertEqual(shipped.records, ["todo.md", "decisions.md", "score-anchors.md", "docs/comprehension-history.md", "docs/reading-cost.md", "changelog.md"])
def test_a_fast_forwarded_feature_starts_after_the_chunk_that_shipped_the_item_before_it(self):
self.fast_forwarded_item_11()
newest = self.read().found[0]
self.assertEqual((newest.name, newest.before, newest.tip), ("item 11", self.git("rev-parse", "main~3"), self.git("rev-parse", "main")))
def test_a_fast_forwarded_feature_with_no_item_shipped_before_it_has_no_start(self):
self.git("checkout", "--quiet", "--orphan", "fresh")
self.git("rm", "--quiet", "-r", "-f", ".")
self.plan(11)
self.landed(1, "Plan an item", written_then=True)
(self.repo / "third.go").write_text("package calc\n")
self.landed(2, "Add Third", written_then=True)
self.plan()
self.landed(3, "Finish item 11 in the plan", written_then=True)
self.git("branch", "--quiet", "--force", "main", "fresh")
self.assertEqual([(feature.name, feature.before) for feature in self.read().found], [("item 11", None)])
def test_a_chunk_that_shipped_two_items_is_one_feature_told_by_both_taglines(self):
self.git("checkout", "--quiet", "main")
self.plan(7, 8)
+12
View File
@@ -3558,3 +3558,15 @@ Read most (opens and searches):
- `README.md` 1
- `bin/task_bench/python_bugs.py` 1
- `bin/task_bench/test_planted_mutant.py` 1
## Reading cost, chunk be78ef577b52, finished 2026-11-24T01:07:00Z
102199 new input tokens before the first commit.
Read most (opens and searches):
- `bin/task_bench/feature_tasks.py` 3
- `bin/task_bench/main.py` 2
- `bin/task_bench/registers.py` 1
- `bin/task_bench/runs.py` 1
- `bin/task_bench/tasks.py` 1