Answer stability round 1: 1 🔴, 2 🟡 (1 misread); a feature whose branch landed by fast-forward is passed over and item 531 files benching it, a test refuses a plan outside the checkout from another folder, and the README states the import once
This commit is contained in:
@@ -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. 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. 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.
|
||||
- `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.
|
||||
@@ -278,7 +278,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
|
||||
- `review_rules/` holds the larv-review rules that several tools apply: its passes, its review folder, its round commit titles and the comprehension history's format.
|
||||
- `routing_figures/` measures loop-claude's archive, and each of its projects' default branches, for loop-claude's routing calls.
|
||||
- `rung_replay/` holds what `judge_replay` and `review_replay` share: the parallel replay runner, the argument reader, the candidate rungs and the exits, and `judge_replay`'s rung search. It reads `agent_cycle`'s retry count and `chunk_driver`'s models file, and finds that file through `loop_state`'s paths. Its `archive.py` keeps each replay's runs and its report in a `replays/` folder of loop-claude's archive.
|
||||
- `task_bench/` holds `task-bench`, which plants bugs in a project's Go and Python files, or takes the project's bench features, its data sources or the features its history shipped, and has Haiku fix, build or add them in containers. It imports `branch_chunks`, which says what each chunk shipped.
|
||||
- `task_bench/` holds `task-bench`, which plants bugs in a project's Go and Python files, or takes the project's bench features, its data sources or the features its history shipped, and has Haiku fix, build or add them in containers.
|
||||
- `test_env.py` serves the tests.
|
||||
- `text_files/` reads a Markdown file's `##` sections, quotes a passage and joins names into a list, reads the text piped into a command, stamps times in UTC, replaces a file in one step, private where it is new, and gzips a file beside its plain name, by which it reads it afterwards.
|
||||
- `transcript_archive/` stores loop-claude's transcripts. Its `project_key.py` names each project's archive folder, loop-claude session and models-file entry.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"""The features task-bench has Haiku rebuild: those the project shipped, read from its history rather than written for the bench.
|
||||
A shipped feature is a chunk on the base's first-parent line that took an item out of the plan, as branch_chunks cuts that line.
|
||||
The bench takes the chunk's change out of each side's tree and tells Haiku the item's tagline. From there it is a feature as
|
||||
task_bench.feature_tasks has it: its reference patch is the chunk's change, and its acceptance tests are the tests that change
|
||||
holds."""
|
||||
"""The features task-bench has Haiku rebuild: those the project shipped, read from its history. A shipped feature is a chunk on
|
||||
the base's first-parent line that took an item out of the plan, as branch_chunks cuts that line. Once its change is out of each
|
||||
side's tree, it is a feature as task_bench.feature_tasks has it. `task-bench --help` says what Haiku is told and how a rebuild
|
||||
is checked."""
|
||||
import functools
|
||||
import os
|
||||
import pathlib
|
||||
@@ -14,25 +13,31 @@ from task_bench.tasks import Bench, committed, on_disk, Planned, Task
|
||||
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
|
||||
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
|
||||
|
||||
# The options that keep the checkout's diff config out of a diff. A rename is written as a removal and an addition, which
|
||||
# `git apply` takes whatever it would have detected.
|
||||
# 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"
|
||||
|
||||
# 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.
|
||||
PLAIN_DIFF = ("--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", "--src-prefix=a/", "--dst-prefix=b/")
|
||||
|
||||
|
||||
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 chunk's change runs between."""
|
||||
of the plan, a paragraph each, the commits its chunk's change runs between, and how the chunk landed."""
|
||||
|
||||
name: str
|
||||
told: str
|
||||
before: str
|
||||
tip: str
|
||||
landing: Landing
|
||||
|
||||
|
||||
class ShippedFeatures(typing.NamedTuple):
|
||||
@@ -45,7 +50,8 @@ class ShippedFeatures(typing.NamedTuple):
|
||||
|
||||
def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> ShippedFeatures | Failure:
|
||||
"""The features that the project in checkout shipped on the first-parent line of the commit base. A Failure where no config
|
||||
names the checkout, where it keeps its plan where branch_chunks doesn't read it, and where that line shipped no item."""
|
||||
names the checkout, where its config puts the plan or a record at a path branch_chunks doesn't read, where git fails, and
|
||||
where that line shipped no item."""
|
||||
in_checkout = functools.partial(git, cwd=checkout)
|
||||
config = located(checkout, home, in_checkout)
|
||||
if isinstance(config, Failure):
|
||||
@@ -57,13 +63,12 @@ def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> Ship
|
||||
return cut
|
||||
branch, shipped = cut
|
||||
found = [
|
||||
# parse_row keeps a tagline in its two pairs of asterisks.
|
||||
Shipped(named(items), "\n\n".join(item.tagline[2:-2] for item in items), chunk.before, chunk.tip)
|
||||
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
|
||||
]
|
||||
if not found:
|
||||
return Failure("No chunk on the base's history took an item out of todo.md, so it holds no shipped feature to rebuild.")
|
||||
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])
|
||||
|
||||
|
||||
@@ -73,16 +78,18 @@ def named(items: tuple[Item, ...]) -> str:
|
||||
|
||||
|
||||
def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned | Failure:
|
||||
"""The task of rebuilding each of the first count features of shipped that count at the bench's commits, numbered from 1, and
|
||||
a line on each one passed over on the way. A Failure where none counts."""
|
||||
"""The task of rebuilding each feature of shipped that counts at the bench's commits, newest first, until there are count
|
||||
tasks. The tasks are numbered from 1, and a line says why each feature on the way was passed over. A Failure where none
|
||||
counts."""
|
||||
noun = bench.asked.kind.noun
|
||||
tasks: list[Task] = []
|
||||
passed_over: list[str] = []
|
||||
for feature in shipped.found:
|
||||
if len(tasks) == count:
|
||||
break
|
||||
folder = bench.folder / "shipped-features" / folder_name(feature.name)
|
||||
taken_out = on_disk(f"take {feature.name} out of the trees in {folder}", lambda: without(bench, feature, shipped.records, folder))
|
||||
# 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))
|
||||
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
|
||||
@@ -93,13 +100,13 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned
|
||||
passed_over.append(f"the {noun} {feature.name}: {why}.")
|
||||
bench.say(f"task-bench: passed over {passed_over[-1]}")
|
||||
if not tasks:
|
||||
return Failure(f"None of the {len(shipped.found)} {noun}s on the base's history counts; the lines above say why.")
|
||||
return Failure(f"No {noun} on the base's history counts; the lines above say why.")
|
||||
return Planned(tasks, [f"Passed over {line}" for line in passed_over], {})
|
||||
|
||||
|
||||
def folder_name(name: str) -> str:
|
||||
"""The folder that keeps the trees of the feature called name: `items-7-8` for `items 7, 8`."""
|
||||
return "-".join(name.replace(",", "").split())
|
||||
def held(path: str) -> bool:
|
||||
"""Whether path is a file or a link, which copies as a test does; a folder doesn't."""
|
||||
return os.path.islink(path) or os.path.isfile(path)
|
||||
|
||||
|
||||
class TakenOut(typing.NamedTuple):
|
||||
@@ -116,18 +123,19 @@ def without(bench: Bench, shipped: Shipped, records: list[str], folder: pathlib.
|
||||
|
||||
Raises OSError where a file cannot be copied."""
|
||||
change = (shipped.before, shipped.tip, "--", ".", *(f":(exclude,literal){path}" for path in records))
|
||||
# A path that is not UTF-8 is replaced, so the head's tree doesn't hold it and it is left out.
|
||||
# A name that is not UTF-8 is read with U+FFFD in it. The head's tree holds no file of that name, so the file is left out.
|
||||
names = bench.git("diff", "--name-only", "-z", *change, cwd=bench.checkout, errors="replace")
|
||||
if isinstance(names, Failure):
|
||||
return names
|
||||
tests = [path for path in names.split("\x00") if path and of_tests(path) and os.path.lexists(os.path.join(bench.trees["head"], path))]
|
||||
tests = [path for path in names.split("\x00") if path and of_tests(path) and held(os.path.join(bench.trees["head"], path))]
|
||||
if not tests:
|
||||
return "its change holds no test that the head holds"
|
||||
patch, acceptance = folder / PATCH, folder / ACCEPTANCE
|
||||
for path in tests:
|
||||
os.makedirs(os.path.dirname(acceptance / path), exist_ok=True)
|
||||
shutil.copy2(os.path.join(bench.trees["head"], path), acceptance / path, follow_symlinks=False)
|
||||
# --binary writes a binary file's bytes, which `git apply` needs, and --output keeps git from decoding them.
|
||||
# --binary writes a binary file's bytes, which `git apply` needs. --output has git write them to the file, since bench.git
|
||||
# would read them from its output as text.
|
||||
diffed = bench.git("diff", "--binary", f"--output={patch}", *PLAIN_DIFF, *change, cwd=bench.checkout)
|
||||
if isinstance(diffed, Failure):
|
||||
return diffed
|
||||
|
||||
@@ -15,26 +15,31 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
from task_bench.test_feature_tasks import ACCEPTANCE, BenchOfTasksCase
|
||||
from task_bench.test_task_bench import BASE_CODE, HEAD_CODE
|
||||
from failure import Failure
|
||||
from task_bench.shipped_features import folder_name, read_shipped
|
||||
from git_cli.git_repo import git
|
||||
from task_bench import main
|
||||
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 = {
|
||||
7: "| 7 | 0.1.0 | | | **Add `Halve`, which halves a whole number.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 |\n",
|
||||
8: "| 8 | 0.1.0 | | | **Multiply in `Twice`.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 |\n",
|
||||
9: "| 9 | 0.1.0 | | | **Say in the README what Calc is.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 |\n",
|
||||
10: "| 10 | 0.1.0 | | | **Keep `Twice` whole.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 |\n",
|
||||
10: "| 10 | 0.1.0 | | | **Keep `Twice` whole, as `a \\| b` is.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 |\n",
|
||||
11: "| 11 | 0.1.0 | | | **Add `Third`.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 |\n",
|
||||
}
|
||||
HALVE = "package calc\n\nfunc Halve(a int) int {\n\treturn a / 2\n}\n"
|
||||
|
||||
|
||||
class ShippedFeaturesCase(BenchOfTasksCase):
|
||||
"""BenchOfTasksCase's checkout, whose default branch then shipped four items, each in a chunk rebased onto it, oldest first:
|
||||
item 8 wrote the line of Twice that the head rewrites, item 7 added Halve with a binary file, a file whose name is not UTF-8, its test and a link to
|
||||
that test, item 9 changed the README alone, and item 10 added only a test that passes without it. The head branches off after
|
||||
them. The checkout's config writes a diff without the `a/` and `b/` that `git apply` strips."""
|
||||
"""BenchOfTasksCase's checkout, whose default branch then shipped four items, each in a chunk rebased onto it. Oldest first:
|
||||
|
||||
- item 8 wrote the line of Twice that the head rewrites;
|
||||
- item 7 added Halve, with a binary file, a file whose name is not UTF-8, a test, and a link to that test;
|
||||
- item 9 changed the README alone;
|
||||
- item 10 added only a test, which passes without it.
|
||||
|
||||
The head branches off after them. The checkout's config writes a diff without the `a/` and `b/` that `git apply` strips."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -74,14 +79,17 @@ class ShippedFeaturesCase(BenchOfTasksCase):
|
||||
"""Writes a plan that holds the items ids."""
|
||||
(self.repo / "todo.md").write_text("# Plan\n\n" + HEADER + "".join(ROWS[id_] for id_ in ids))
|
||||
|
||||
def landed(self, hour: int, *titles: str) -> None:
|
||||
def landed(self, hour: int, *titles: str, written_then: bool = False) -> None:
|
||||
"""Commits what the checkout holds under the first of titles, and an empty commit under each other one, all at the commit
|
||||
time a rebase at that hour would give them: branch_chunks reads the commits that share a commit time as one chunk."""
|
||||
self.env["GIT_COMMITTER_DATE"] = f"2026-11-01T0{hour}:00:00+00:00"
|
||||
time a rebase at that hour would give them: branch_chunks reads the commits that share a commit time as one chunk.
|
||||
With written_then the commits were written at that time too, as a fast-forward leaves them."""
|
||||
times = {"GIT_COMMITTER_DATE": f"2026-11-01T0{hour}:00:00+00:00"}
|
||||
self.env.update(times | {"GIT_AUTHOR_DATE": times["GIT_COMMITTER_DATE"]} if written_then else times)
|
||||
self.git("add", "--all")
|
||||
for title in titles:
|
||||
self.git("commit", "--quiet", "--allow-empty", "--message", title)
|
||||
del self.env["GIT_COMMITTER_DATE"]
|
||||
for name in ("GIT_COMMITTER_DATE", "GIT_AUTHOR_DATE"):
|
||||
self.env.pop(name, None)
|
||||
|
||||
|
||||
class ShippedFeatureBenchTest(ShippedFeaturesCase):
|
||||
@@ -124,14 +132,20 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase):
|
||||
|
||||
def test_gives_haiku_a_tree_whose_one_commit_holds_it_without_the_feature(self):
|
||||
report = self.bench()
|
||||
tree = pathlib.Path(report[-1].removeprefix(main.KEPT)) / "shipped-features" / "item-7" / "head"
|
||||
tree = pathlib.Path(report[-1].removeprefix(main.KEPT)) / "shipped-features" / "1" / "head"
|
||||
self.assertEqual(sorted(path.name for path in tree.iterdir()), [".git", "README.md", "calc.go", "calc_test.go", "dangling", "todo.md", "twice_test.go", "whole_test.go"])
|
||||
self.assertEqual(subprocess.run(["git", "log", "--format=%s"], cwd=tree, env=self.env, check=True, capture_output=True, text=True).stdout, "Import\n")
|
||||
self.assertEqual(subprocess.run(["git", "status", "--porcelain"], cwd=tree, env=self.env, check=True, capture_output=True, text=True).stdout, "")
|
||||
|
||||
def test_writes_a_digest_that_says_where_the_tree_without_each_feature_is(self):
|
||||
report = self.bench()
|
||||
digest = (pathlib.Path(report[-1].removeprefix(main.KEPT)) / "digest.md").read_text().splitlines()
|
||||
self.assertEqual(digest[2], f"Base {self.base}, head {self.head}. Each side's code without shipped feature <n> is in `shipped-features/<n>/base` and `shipped-features/<n>/head` in the bench's folder.")
|
||||
self.assertIn("## Shipped feature 1: item 7", digest)
|
||||
|
||||
def test_keeps_a_test_that_is_a_link_as_a_link(self):
|
||||
report = self.bench()
|
||||
acceptance = pathlib.Path(report[-1].removeprefix(main.KEPT)) / "shipped-features" / "item-7" / "acceptance"
|
||||
acceptance = pathlib.Path(report[-1].removeprefix(main.KEPT)) / "shipped-features" / "1" / "acceptance"
|
||||
self.assertEqual(sorted(path.name for path in acceptance.iterdir()), ["halve_test.go", "linked_test.go"])
|
||||
self.assertEqual(os.readlink(acceptance / "linked_test.go"), "halve_test.go")
|
||||
|
||||
@@ -142,27 +156,47 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase):
|
||||
self.assertNotIsInstance(report, Failure, report)
|
||||
self.assertIn("| 1: item 7 | head | 2/2 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | - |", report)
|
||||
|
||||
def test_passes_over_a_feature_whose_test_the_head_removed(self):
|
||||
# The checkout the process runs in still holds the test.
|
||||
def test_passes_over_a_feature_whose_tests_the_head_removed_or_made_a_folder(self):
|
||||
# The checkout the process runs in still holds both tests.
|
||||
self.git("checkout", "--quiet", "-b", "without-test")
|
||||
self.git("rm", "--quiet", "halve_test.go", "linked_test.go")
|
||||
(self.repo / "halve_test.go").mkdir()
|
||||
(self.repo / "halve_test.go" / "notes").write_text("Halve's test was here.\n")
|
||||
self.commit("Remove Halve's tests")
|
||||
self.git("checkout", "--quiet", "item-1")
|
||||
report = self.bench(**{"--head": "without-test"})
|
||||
self.assertEqual(report.reason, "None of the 4 shipped features on the base's history counts; the lines above say why.")
|
||||
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 7: its change holds no test that the head holds.", self.progress.getvalue().splitlines())
|
||||
|
||||
def test_fails_where_no_shipped_feature_counts(self):
|
||||
# The default branch as it was when item 8 had shipped and no other; the head rewrites the line item 8 wrote.
|
||||
self.git("branch", "--quiet", "--force", "main", "main~6")
|
||||
report = self.bench()
|
||||
self.assertEqual(report.reason, "None of the 1 shipped features on the base's history counts; the lines above say why.")
|
||||
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")
|
||||
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.")
|
||||
|
||||
def test_fails_before_docker_runs_where_the_history_shipped_no_item(self):
|
||||
self.git("branch", "--quiet", "--force", "main", "main~8")
|
||||
report = self.bench()
|
||||
self.assertEqual(report.reason, "No chunk on the base's history took an item out of todo.md, so it holds no shipped feature to rebuild.")
|
||||
self.assertEqual(report.reason, "No chunk on the base's history took an item out of todo.md, so that history holds no shipped feature to rebuild.")
|
||||
self.assertFalse(self.log.exists(), "docker ran")
|
||||
|
||||
def test_fails_before_docker_runs_where_the_plan_is_kept_outside_the_checkout(self):
|
||||
@@ -179,7 +213,8 @@ class ReadShippedTest(ShippedFeaturesCase):
|
||||
def test_reads_the_features_newest_first_with_the_paths_a_revert_leaves_alone(self):
|
||||
shipped = self.read()
|
||||
self.assertEqual([(feature.name, feature.told) for feature in shipped.found], [
|
||||
("item 10", "Keep `Twice` whole."),
|
||||
# The table writes a | as \\|.
|
||||
("item 10", "Keep `Twice` whole, as `a | b` is."),
|
||||
("item 9", "Say in the README what Calc is."),
|
||||
("item 7", "Add `Halve`, which halves a whole number."),
|
||||
("item 8", "Multiply in `Twice`."),
|
||||
@@ -208,15 +243,17 @@ class ReadShippedTest(ShippedFeaturesCase):
|
||||
self.enterContext(contextlib.chdir(self.root))
|
||||
self.assertEqual(len(self.read().found), 4)
|
||||
|
||||
def test_refuses_a_plan_outside_the_checkout_wherever_the_process_runs(self):
|
||||
self.config.write_text(self.config.read_text().replace('plan = "checkout:todo.md"', 'plan = "folder:todo.md"'))
|
||||
self.enterContext(contextlib.chdir(self.root))
|
||||
self.assertTrue(self.read().reason.startswith("task-bench cannot tell what the project shipped: "))
|
||||
|
||||
def test_fails_where_git_cannot_read_a_plan(self):
|
||||
def run(*args, **named):
|
||||
return Failure("git broke") if "show" in args[:1] or "cat-file" in args[:1] else git(*args, **named)
|
||||
|
||||
self.assertEqual(self.read(run).reason, "git broke")
|
||||
|
||||
def test_names_a_features_folder_by_its_items(self):
|
||||
self.assertEqual((folder_name("item 7"), folder_name("items 7, 8")), ("item-7", "items-7-8"))
|
||||
|
||||
|
||||
class OptionsTest(unittest.TestCase):
|
||||
def options(self, *argv: str):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
`Bar = 0.1`
|
||||
|
||||
`Next ID = 531`
|
||||
`Next ID = 532`
|
||||
|
||||
## Renamed
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 531 | 0.16.0 | | | **Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 | 1.1 |
|
||||
| 507 | 0.16.0 | | owner | **Bench rebuilding a feature the project shipped: revert its commit at the head, hand Haiku its item tagline, and check with the tests that commit added.** | 4 | 2 | 1 | 5 | 6 | 1.1 by 3 | 0.5 |
|
||||
| 524 | 0.16.0 | | owner | **Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 3 | 0.5 |
|
||||
| 526 | 0.16.0 | | owner | **Plant bugs for `task-bench` in Rust, from the mutants cargo-mutants kills.** | 3 | 2 | 1 | 4 | 4 | 1.1 by 1 | 0.3 |
|
||||
@@ -112,20 +113,34 @@
|
||||
|
||||
## Details
|
||||
|
||||
### 531. Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan.
|
||||
|
||||
Today `task-bench --tasks shipped-features` passes such a feature over. A fast-forwarded branch's commits keep a commit time each, so `branch_chunks` cuts each commit into a chunk of its own, and the chunk that took the item out of the plan holds only the feature's last commit. A project that lands every chunk by fast-forward, as this one does, has no shipped feature to bench.
|
||||
|
||||
The tagline's rule is a recommendation, not yet checked on a real history: a commit between two chunks that belongs to neither, such as a direct push, would join the later feature. The acceptance check still guards that: a feature counts only where its tests fail after the revert and pass with the reference patch.
|
||||
|
||||
Touches:
|
||||
|
||||
- `bin/task_bench/shipped_features.py`: `read_shipped`, `shipped_tasks` (small), `FAST_FORWARDED`
|
||||
- `bin/task_bench/test_shipped_features.py`
|
||||
- `bin/task_bench/main.py`: `(module)` (small)
|
||||
- `README.md`: `## Tools` (small)
|
||||
|
||||
### 507. Bench rebuilding a feature the project shipped: revert its commit at the head, hand Haiku its item tagline, and check with the tests that commit added.
|
||||
|
||||
Such tasks cost nothing to write and are realistic. A shipped feature whose revert doesn't apply cleanly at both the base and the head is passed over.
|
||||
Such tasks don't cost anything to write and are realistic. A shipped feature whose revert doesn't apply cleanly at both the base and the head is passed over.
|
||||
|
||||
A chunk lands as several commits, not one. So a shipped feature is a chunk on the base's first-parent history that took an item out of the plan, as `branch_chunks` cuts that history, newest first:
|
||||
|
||||
- Haiku is told the tagline of each item the chunk took out.
|
||||
- The feature's change is one diff, from the commit before the chunk to its tip, leaving out the project's records: the plan, the changelog and the other files its config names. Later chunks append to those, so a revert of them would never apply.
|
||||
- The revert applies that diff in reverse to a copy of each side's tree. The reference patch is the same diff forwards, and the acceptance tests are the test files it touches, as the head holds them.
|
||||
- The revert applies that diff in reverse to a copy of each side's tree, in `shipped-features/<n>/` in the bench's folder, where `<n>` counts the features taken. The reference patch is the same diff forwards, and the acceptance tests are the test files it touches, as the head holds them.
|
||||
- A shipped feature counts as a bench feature does, in `feature_tasks.py`: the tests fail at both sides after the revert and pass with the reference patch. One whose change holds no test is passed over.
|
||||
- A chunk whose branch landed by fast-forward is passed over: there each commit is a chunk of its own, so the history doesn't say which commits built the feature.
|
||||
|
||||
A panel of three readers seated as the audience picked the spellings on 2026-11-24: `--tasks shipped-features`, 3 to 0, and `--shipped <n>`, first for two and second for the third.
|
||||
|
||||
Re-scored after the first read of the code, from L 3 and S 5, when deriving tasks from git history looked like a new pattern across four packages. Reusing `branch_chunks` kept it to about 330 lines.
|
||||
Re-scored after the first read of the code, from L 3 and S 5 to L 4 and S 6, when deriving tasks from git history looked like a new pattern across four packages. Reusing `branch_chunks` kept it to about 330 lines.
|
||||
|
||||
### 524. Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user