From 1ca6c800f580cf6b9efc595b4b7e9a797d7ae4ea Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:20:11 +0100 Subject: [PATCH 01/14] Re-score item 507 to L 4 and say how a shipped feature is found --- todo.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/todo.md b/todo.md index 6de38a62..ecf1cf6b 100644 --- a/todo.md +++ b/todo.md @@ -16,7 +16,7 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 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.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3 | 0.7 | +| 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 | | 527 | 0.16.0 | | owner | **Plant bugs for `task-bench` in TypeScript, from the mutants Stryker kills.** | 3 | 2 | 1 | 4 | 4 | 1.1 by 1 | 0.3 | @@ -114,7 +114,19 @@ ### 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 commit whose revert doesn't apply cleanly at both the base and the head is skipped. +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 skipped. + +A chunk lands as several commits, not one: test, code and review-answer commits, sometimes merges of the default branch, ending in the commit that removes the item's row from the plan. So the bench finds a shipped feature by that finishing commit, on the base's first-parent history, newest first: + +- The tagline Haiku is told is the one in the row the finishing commit removes. +- The feature's commits are the commits that are no merge, on the first-parent history from the finishing commit back to the one before it. +- The revert applies each of those commits' diffs in reverse, newest first, to a copy of each side's tree, 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 reference patch is the same diffs forwards, and the acceptance tests are the test files those commits touched, 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 that touches no test or no other file is passed over. + +A panel of readers seated as the audience picks the new value of `--tasks` and the flag that says how many shipped features to take. + +Re-scored after the first read of the code, from L 3 and S 5: about 600 lines in 8 or 9 files, across `task_bench`, the plan's table reader, `project_config` and `git_cli`, and deriving tasks from git history is a new pattern. ### 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. -- 2.52.0 From d432aa272c7f721adbfb2577a7a52f1d64e57d0e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:20:11 +0100 Subject: [PATCH 02/14] Record reading cost --- docs/reading-cost.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index e3d29537..3df0d017 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3521,3 +3521,40 @@ Read most (opens and searches): - `bin/task_bench/main.py` 2 - `CHANGELOG.md` 1 - `todo.md` 1 + +## Reading cost, chunk 5590d64e8135, finished 2026-11-23T22:28:19Z + +40082 new input tokens before the first commit. + +Read most (opens and searches): + +- `skills/larv-review/SKILL.md` 6 +- `agents/stability-reviewer.md` 2 + +## Reading cost, chunk b369f321ce4d, finished 2026-11-23T22:40:55Z + +45216 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 2 +- `bin/repo_checks/test_types.py` 1 +- `bin/run_tests/main.py` 1 +- `bin/task_bench/runs.py` 1 +- `ci.sh` 1 +- `docs/decisions.md` 1 +- `skills/larv-review/SKILL.md` 1 + +## Reading cost, chunk dc3c9bb92e0e, finished 2026-11-23T23:17:20Z + +65012 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/task_bench/test_python_bugs.py` 5 +- `bin/mutate_changes/mutmut_tool.py` 4 +- `bin/task_bench/planted_mutant.py` 2 +- `CHANGELOG.md` 1 +- `README.md` 1 +- `bin/task_bench/python_bugs.py` 1 +- `bin/task_bench/test_planted_mutant.py` 1 -- 2.52.0 From c0445a26d73d5d47459c0dea55c14a1752b5c2df Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:29:25 +0100 Subject: [PATCH 03/14] Test a bench of the features a project's history shipped --- bin/task_bench/test_shipped_features.py | 188 ++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 bin/task_bench/test_shipped_features.py diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py new file mode 100644 index 00000000..054afc40 --- /dev/null +++ b/bin/task_bench/test_shipped_features.py @@ -0,0 +1,188 @@ +"""`task-bench --tasks shipped-features` from its command line down: a whole bench of the features a project's history shipped, +with docker and claude faked, and the histories it passes over.""" +import functools +import json +import pathlib +import re +import subprocess +import sys +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from task_bench.test_task_bench import BASE_CODE, HEAD_CODE +from task_bench.test_feature_tasks import ACCEPTANCE, BenchOfTasksCase +from failure import Failure +from branch_chunks.read import READ_AT +from task_bench import main +from task_bench.shipped_features import read_shipped +from git_cli.git_repo import git + +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", +} +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 three 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 its test, and item 9 changed the README alone. + The head branches off after them.""" + + def setUp(self): + super().setUp() + self.given.update({"--tasks": "shipped-features", "--shipped": "5"}) + # branch_chunks reads the plan and two records at these paths alone. + self.config.write_text(re.sub(r'"checkout:(plan|comprehension-history|reading-cost)\.md"', lambda found: f'"checkout:{READ_AT[found[1]]}"', self.config.read_text())) + self.git("checkout", "--quiet", "main") + self.git("rm", "--quiet", "-r", "bench-tasks") + (self.repo / "calc.go").write_text(BASE_CODE.replace("a * 2", "a + a")) + self.plan(7, 8, 9) + self.landed(1, "Plan three items") + (self.repo / "calc.go").write_text(BASE_CODE) + (self.repo / "twice_test.go").write_text("grep -q 'a \\* 2\\|2 \\* a' calc.go\n") + self.plan(7, 9) + self.landed(2, "Multiply in Twice", "Finish item 8 in the plan") + (self.repo / "halve_test.go").write_text(ACCEPTANCE) + self.landed(3, "Test Halve") + (self.repo / "halve.go").write_text(HALVE) + self.plan(9) + self.landed(3, "Add Halve", "Finish item 7 in the plan") + (self.repo / "README.md").write_text("# Calc\n\nIt adds.\n") + self.plan() + self.landed(4, "Say what Calc is") + self.base = self.git("rev-parse", "HEAD") + self.git("checkout", "--quiet", "-B", "item-1") + (self.repo / "calc.go").write_text(HEAD_CODE) + self.head = self.commit("Head") + + def plan(self, *ids: int) -> None: + """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: + """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" + self.git("add", "--all") + for title in titles: + self.git("commit", "--quiet", "--allow-empty", "--message", title) + del self.env["GIT_COMMITTER_DATE"] + + +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() + self.assertNotIsInstance(report, Failure, report) + folder = pathlib.Path(report[-1].removeprefix(main.KEPT)) + self.assertEqual(report[:-1], [ + f"task-bench: base {self.base[:12]}, head {self.head[:12]}. 1 shipped feature, each run 2 times at each side by claude-haiku-5-5 in Claude Code 2.1.330.", + "Passed over the shipped feature item 9: its change holds no test that the head holds.", + "Passed over the shipped feature item 8: its revert doesn't apply at the head.", + "", + "| Shipped feature | Side | Passed | Input | Cache write | Cache read | Output | Turns | Wall, s | Reads |", + "|---|---|---|---|---|---|---|---|---|---|", + "| 1: item 7 | base | 0/2 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | - |", + "| 1: item 7 | head | 2/2 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | - |", + "| All | base | 0/2 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | - |", + "| All | head | 2/2 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | - |", + "| All | change | +2 | 0 % | 0 % | 0 % | 0 % | 0 | 0 % | - |", + "", + ]) + handed = json.loads(pathlib.Path(f"{self.log}.claude").read_text()) + self.assertEqual(handed["prompt"], "Build the feature below in this project.\n\nAdd `Halve`, which halves a whole number.") + # Haiku's copy holds the tree without Halve and without its test; the plan and the README stay as the side holds them. + self.assertEqual(handed["handed"], [".git", "README.md", "calc.go", "calc_test.go", "dangling", "todo.md", "twice_test.go"]) + results = json.loads((folder / "results.json").read_text()) + self.assertEqual((results["shipped-features"], len(results["runs"])), ({"1": "item 7"}, 4)) + self.assertEqual(sorted(path.name for path in (folder / "runs").iterdir() if path.suffix == ".jsonl"), [f"shipped-feature-1-{side}-{run}.jsonl" for side in ("base", "head") for run in (1, 2)]) + + def test_stops_looking_once_as_many_features_count_as_shipped_asks_for(self): + report = self.bench(**{"--shipped": "1"}) + self.assertNotIsInstance(report, Failure, report) + # Item 8 shipped before item 7, which filled the bench, so nothing is said of it. + self.assertEqual(report[1:3], ["Passed over the shipped feature item 9: its change holds no test that the head holds.", ""]) + + 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" + self.assertEqual(sorted(path.name for path in tree.iterdir()), [".git", "README.md", "calc.go", "calc_test.go", "dangling", "todo.md", "twice_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_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~4") + 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.assertIn("task-bench: passed over the shipped feature item 8: its revert doesn't apply at the head.", self.progress.getvalue().splitlines()) + + def test_fails_before_docker_runs_where_the_history_shipped_no_item(self): + self.git("branch", "--quiet", "--force", "main", "main~6") + 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.assertFalse(self.log.exists(), "docker ran") + + def test_fails_before_docker_runs_where_the_plan_is_kept_outside_the_checkout(self): + self.config.write_text(self.config.read_text().replace('plan = "checkout:todo.md"', 'plan = "folder:todo.md"')) + report = self.bench() + self.assertEqual(report.reason, f"task-bench cannot tell what the project shipped: the project's config puts {self.config.parent / 'todo.md'} elsewhere than todo.md, docs/comprehension-history.md, docs/reading-cost.md in the checkout, the only paths whose commits are read so far") + self.assertFalse(self.log.exists(), "docker ran") + + +class ReadShippedTest(ShippedFeaturesCase): + def read(self): + return read_shipped(self.home, str(self.repo), "main", functools.partial(git, env=self.env)) + + 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 9", "Say in the README what Calc is."), + ("item 7", "Add `Halve`, which halves a whole number."), + ("item 8", "Multiply in `Twice`."), + ]) + self.assertEqual(shipped.records, ["todo.md", "decisions.md", "score-anchors.md", "docs/comprehension-history.md", "docs/reading-cost.md", "changelog.md"]) + + 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) + self.landed(5, "Plan two items again") + self.plan() + self.landed(6, "Build both", "Finish item 7 in the plan", "Finish item 8 in the plan") + newest = self.read().found[0] + self.assertEqual((newest.name, newest.told), ("items 7, 8", "Add `Halve`, which halves a whole number.\n\nMultiply in `Twice`.")) + self.assertEqual((newest.before, newest.tip), (self.git("rev-parse", "main~3"), self.git("rev-parse", "main"))) + + def test_an_item_a_commit_title_drops_is_not_shipped(self): + self.git("checkout", "--quiet", "main") + self.plan(8) + self.landed(5, "Plan an item again") + self.plan() + self.landed(6, "Drop item 8: nobody asked for it") + self.assertEqual(self.read().found[0].name, "item 9") + + +class OptionsTest(unittest.TestCase): + def options(self, *argv: str): + return main.options(["--image", "golang:1.27.4", "--test", "go test ./...", *argv], {"CLAUDE_CODE_OAUTH_TOKEN": "sk-secret-token"}) + + def test_shipped_says_how_many_shipped_features_to_take_and_is_5_by_default(self): + self.assertEqual(self.options("--tasks", "shipped-features")["--shipped"], "5") + self.assertEqual(self.options("--tasks", "shipped-features", "--shipped", "2")["--shipped"], "2") + self.assertEqual(self.options("--tasks", "shipped-features", "--shipped", "0").reason, "--shipped takes a whole number from 1, not 0") + + def test_shipped_goes_with_no_other_kind_of_task(self): + for tasks in ("bugs", "features", "data-sources"): + with self.subTest(tasks=tasks): + self.assertEqual(self.options("--tasks", tasks, "--shipped", "2").reason, f"--shipped is for a bench of shipped features, so it doesn't go with --tasks {tasks}") + self.assertNotIn("--shipped", self.options()) + + def test_a_bench_of_shipped_features_takes_no_option_of_a_bench_of_bugs(self): + self.assertEqual(self.options("--tasks", "shipped-features", "--seed", "2").reason, "--seed is for a bench of bugs, so it doesn't go with --tasks shipped-features") + + +if __name__ == "__main__": + unittest.main() -- 2.52.0 From 87726f9f0bb4e81c9275a21ff286fbd8e3be6513 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:29:25 +0100 Subject: [PATCH 04/14] Bench rebuilding a shipped feature: take its chunk's change out, tell Haiku the item's tagline, check with the tests the change holds --- README.md | 6 +- bin/branch_chunks/read.py | 19 ++-- bin/task_bench/main.py | 77 +++++++++++---- bin/task_bench/shipped_features.py | 142 +++++++++++++++++++++++++++ bin/task_bench/tasks.py | 9 +- bin/task_bench/test_feature_tasks.py | 2 +- bin/task_bench/test_registers.py | 2 +- 7 files changed, 222 insertions(+), 35 deletions(-) create mode 100644 bin/task_bench/shipped_features.py diff --git a/README.md b/README.md index 897ab18c..eb4dea57 100644 --- a/README.md +++ b/README.md @@ -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] ` 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 --test []` 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 `--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 --test []` 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. - `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show ` one item's row and detail; `add …` files an item under the next free ID, `edit …` sets an item's cells or detail, and `move --release ` sets an item's release; `finish ` 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 ...` 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 [] [--timeout ]` waits until a file a background job writes holds a line matching the pattern, and prints it. @@ -240,7 +240,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `adf_codec/` converts markdown to ADF, the rich text of Jira Cloud and Confluence, and back, in a throwaway container running a pinned `@larvit/adf-codec`. It builds the container's image inside a heavy slot. - `agent_cycle/` runs one cycle (`run.py`): a headless claude worker, then the judge of its transcript. It also holds the interrupt, the tmux window and the routing of the worker's rung. The entry point that runs the cycles supplies the prompts and file names of its own workflow (`worker_prompts.py`), and reads which items a worker took in. `loop_claude` and `do_epic` drive it; `agent_cycle` doesn't import either. - `atlassian/` holds what the Jira and Confluence backends share (`client.py`): one Atlassian account's credentials, the request both backends send, and each service's error messages. `jira.py` holds what every reader of Jira shares: a search read page by page, the key, fields, links and property of each issue it finds, checked for their shape, and the transition that finishes an issue, for `plan_store` and `do_epic`. -- `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes` and `routing_figures`. It imports `reading_cost`'s record path. +- `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes`, `routing_figures` and `task_bench`. It imports `reading_cost`'s record path. - `chunk_driver/` holds what the entry points share. An entry point is a tool that drives chunks through `agent_cycle`: `loop_claude` and `do_epic` are the two. They share how a cycle starts (`cycle_start.py`) and closes (`chunk_run.py`), the claim on a checkout before a chunk starts in it (`claims.py`), the prompts every worker gets (`prompts.py`), and a checkout's premises, records and saved models (`project/`). It imports neither entry point, and `repo_checks` fails any package that imports one of the two. `agent_cycle` is the layer below it, and `repo_checks` fails `agent_cycle` where it imports `chunk_driver`, tests included. - `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`. - `deploy_release` imports `release_plan`'s `release_standing`. @@ -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 or data sources, and has Haiku fix, build or add them in containers. +- `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. - `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. diff --git a/bin/branch_chunks/read.py b/bin/branch_chunks/read.py index ae2874f7..75944488 100644 --- a/bin/branch_chunks/read.py +++ b/bin/branch_chunks/read.py @@ -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: diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 7adc0380..e7ec7df4 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -1,9 +1,11 @@ r"""Measure how hard a project's code is to fix a bug in, or to build a feature in, at a base commit and at a head: plant bugs its tests catch, have Haiku fix each several times at both, and print how often the fix passes and what it took. With --tasks features, -Haiku builds the project's bench features instead, and with --tasks data-sources it adds made-up data sources. +Haiku builds the project's bench features instead, with --tasks data-sources it adds made-up data sources, and with --tasks +shipped-features it rebuilds features the project shipped. usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] [--record-figures] task-bench --tasks features|data-sources --image --test [--base ] [--head ] [--runs ] [--record-figures] + task-bench --tasks shipped-features --image --test [--base ] [--head ] [--shipped ] [--runs ] [--record-figures] task-bench gather Run it in a checkout, under ~/.claude/bin/run-heavy, with a long-lived token in CLAUDE_CODE_OAUTH_TOKEN, which `claude setup-token` @@ -78,6 +80,24 @@ with the committed data. A task counts, and a run passes, as for a feature; the Haiku left it. Name the made-up publisher's country by a code no real data could carry: one ISO 3166-1 leaves to its users, such as QZ, and never XK, which is Kosovo's in practice. The table has a row per data source and side. +--tasks shipped-features benches rebuilding features the project shipped, so nobody writes a task. A shipped feature is a chunk +on the base's first-parent history that took an item out of `todo.md`. A chunk is a merge commit with what it merged, or the +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. The bench goes through the shipped features newest first, until --shipped of +them, 5 by default, count. For each: +- it takes the chunk'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 wrote on in them: the changelog, the decisions, the score anchors, the comprehension + history and the reading cost. So Haiku can read there what the changelog says of the feature; +- Haiku is told the tagline of the item, or of each item the chunk shipped, and nothing more; +- 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 one whose change doesn't +come out of both trees cleanly, as where a later chunk rewrote its lines, and 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`. +The project's config must name the checkout, with the plan at `todo.md`, the comprehension history at +`docs/comprehension-history.md` and the reading cost at `docs/reading-cost.md`. --seed, --bugs and --prefix don't go with +--tasks shipped-features, and --shipped goes with no other kind. + It prints the base and the head, then a table: a row per bug and side with how many fixes passed and the medians, over the runs that finished, of the input, cache-write, cache-read and output tokens, the turns, the wall time, and the reads and searches before the run first opened the file the bug is in. The median of the reads leaves out a run that never opened that file. Then come a row @@ -100,8 +120,8 @@ passed, so the pass rate's noise is unmeasured. With --record-figures, a bench that finishes appends its figures to the project's comprehension history: an entry with the table's header and its three All rows. The entry's heading gives the current UTC time, then `task-bench of : head against base `, where is the branch checked out, whatever --head names. For a bench of -features the heading reads `task-bench features of : ...` instead, and for one of data sources `task-bench data-sources -of : ...`. No tool reads the entry as a ruling or a scoring run. The bench's last line says where the entry went. A bench that fails or stops doesn't record anything. +features the heading reads `task-bench features of : ...` instead, for one of data sources `task-bench data-sources +of : ...`, and for one of shipped features `task-bench shipped-features of : ...`. No tool reads the entry as a ruling or a scoring run. The bench's last line says where the entry went. A bench that fails or stops doesn't record anything. `task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in gather-prompt.md beside this file. @@ -112,12 +132,16 @@ Each bench empties its own folder first, and removes the folder every earlier be not, unless a bench or a gather is using it. So gather a bench before the next one starts. Exit 1, saying why, on an unknown or repeated argument, a missing --image or --test, a --seed, --bugs or --runs that is no whole -number from 1, a --tasks that is none of bugs, features and data-sources, or no token; and where git, docker or a mutation tool +number from 1, a --tasks that is none of bugs, features, data-sources and shipped-features, or no token; and where git, docker or a mutation tool fails, the seats' places don't name any Go or Python file, the tests fail at a side without a bug, or no mutant becomes a bug. With --tasks features or data-sources it exits 1 on a --seed, --bugs or --prefix; where no config names the checkout or its config sets no `bench-tasks`, or the folder holds no task of that kind, one that lacks a part, or a `generate-register` that is no executable file, each before docker runs; and where the tests fail at a side without the acceptance tests, or no task counts. Where the -API refuses a run, the bench stops there and exits 1 too, after the table of the runs that finished. +With --tasks shipped-features it exits 1 on a --seed, --bugs or --prefix, and on a --shipped that is no whole number from 1; +where no config names the checkout or its config keeps the plan or one of those two records elsewhere, or the base's history +shipped no item, each before docker runs; and where the tests fail at a side with every feature in, or no shipped feature +counts. A --shipped with another kind of task exits 1 too. +Where the API refuses a run, the bench stops there and exits 1 too, after the table of the runs that finished. With --record-figures it also exits 1, saying why: before it plants a bug, where no config names the checkout or the history cannot be read; and after the bench, where the history already holds that branch's bench of those two commits or cannot be written. The folder then still holds the bench's results. @@ -137,7 +161,7 @@ import time import typing import uuid -from task_bench.tasks import Asked, Bench, BUG, check_made, committed, Kind, KINDS, on_disk, Planned, Task, tests_in_copy +from task_bench.tasks import Asked, Bench, BUG, check_made, committed, Kind, KINDS, on_disk, Planned, SHIPPED, Task, tests_in_copy from task_bench.planted_mutant import bug_at_sides, Mutant from claude_code.reply import Claude from task_bench.bench_folder import clear_left, held @@ -151,6 +175,7 @@ from claude_code.entries import entry_from, json_objects from mutate_changes.tool_process import failed, Ran, run_tool from failure import Failure from task_bench.feature_tasks import feature_tasks, Features, read_features +from task_bench.shipped_features import read_shipped, shipped_tasks, ShippedFeatures from task_bench.figures import figures, Result, Side, SIDES, table from git_cli import git_repo from review_rules.review_folder import made_review_folder, REPORTS @@ -158,17 +183,19 @@ from larv_review.history_commands import read_places from task_bench.record_figures import recorded_bench from run_heavy.capped_docker import SHARE_VARIABLE -USAGE = "usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] [--record-figures], or task-bench --tasks features|data-sources --image --test [--base ] [--head ] [--runs ] [--record-figures], or task-bench gather" +USAGE = "usage: task-bench --image --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] [--record-figures], or task-bench --tasks features|data-sources --image --test [--base ] [--head ] [--runs ] [--record-figures], or task-bench --tasks shipped-features --image --test [--base ] [--head ] [--shipped ] [--runs ] [--record-figures], or task-bench gather" # A panel of three readers, seated as the README's audience, picked these options on 2026-11-21, each 3 to 0. -OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--record-figures", "--runs", "--seed", "--tasks", "--test") +# Such a panel picked --shipped on 2026-11-24, first for two of its three and second for the third, who would spell it out as +# --shipped-features: it names its kind as --bugs does, where --features would read as counting the bench features. +OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--record-figures", "--runs", "--seed", "--shipped", "--tasks", "--test") # The one option that takes no value. RECORD = "--record-figures" -COUNTS = {"--bugs": "5", "--runs": "5", "--seed": "1"} +COUNTS = {"--bugs": "5", "--runs": "5", "--seed": "1", "--shipped": "5"} TASKS = "--tasks" # Opens the report's last line, which names the bench's folder. KEPT = "The digest, and each run's result and stream, until `task-bench gather` files plan items from them or the next bench starts: " -# The options only a bench of bugs takes: two choose the bugs to plant, and --prefix runs the mutation tool. -OF_BUGS = ("--seed", "--bugs", "--prefix") +# The options only a bench of one kind takes. For bugs, two choose the bugs to plant, and --prefix runs the mutation tool. +ONLY_FOR = {"--seed": BUG, "--bugs": BUG, "--prefix": BUG, "--shipped": SHIPPED} class Fixes(typing.NamedTuple): @@ -221,12 +248,12 @@ def options(argv: list[str], env: typing.Mapping[str, str]) -> dict[str, str] | return Failure(f"{name} is missing") if given.setdefault(TASKS, "bugs") not in KINDS: return Failure(f"{TASKS} takes {', '.join(list(KINDS)[:-1])} or {list(KINDS)[-1]}, not {given[TASKS]}") - of_features = KINDS[given[TASKS]] is not BUG - for name in OF_BUGS: - if of_features and name in given: - return Failure(f"{name} is for a bench of bugs, so it doesn't go with {TASKS} {given[TASKS]}") + kind = KINDS[given[TASKS]] + for name, only in ONLY_FOR.items(): + if only is not kind and name in given: + return Failure(f"{name} is for a bench of {only.noun}s, so it doesn't go with {TASKS} {given[TASKS]}") for name, default in COUNTS.items(): - if of_features and name in OF_BUGS: + if ONLY_FOR.get(name, kind) is not kind: continue if not given.setdefault(name, default).isdecimal() or int(given[name]) < 1: return Failure(f"{name} takes a whole number from 1, not {given[name]}") @@ -243,9 +270,11 @@ def progress(line: str) -> None: def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Callable[[pathlib.Path], str | Failure], home: pathlib.Path) -> list[str] | Failure: """The report of one bench of the checkout the process runs in, where `read` reads what `larv-review places` prints. It tells its progress on stderr.""" - # Only bugs are planted at the seats' places; features and data sources come from the project's folder. Each kind reads what it makes its tasks from before anything is copied or built, + # Only bugs are planted at the seats' places; features and data sources come from the project's folder, and shipped features from its history. Each kind reads what it makes its tasks from before anything is copied or built, # so a fault there stops the bench at once. - tasks_from = read(home) if KINDS[given[TASKS]] is BUG else read_features(home, KINDS[given[TASKS]]) + kind = KINDS[given[TASKS]] + # Shipped features are read from the base's history, once the base is known. + tasks_from = None if kind is SHIPPED else read(home) if kind is BUG else read_features(home, kind) if isinstance(tasks_from, Failure): return tasks_from git = functools.partial(git_repo.git, env=env) @@ -255,6 +284,10 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Cal sides = commits(given, checkout, git) if isinstance(sides, Failure): return sides + if tasks_from is None: + tasks_from = read_shipped(home, checkout, sides["base"], git) + if isinstance(tasks_from, Failure): + return tasks_from progress(f"task-bench: base {sides['base'][:12]}, head {sides['head'][:12]}.") review = made_review_folder(checkout, home) if isinstance(review, Failure): @@ -267,10 +300,10 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Cal return recorded_bench(run, folder, git, home, time.time) if RECORD in given else run() -def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[str, str], tasks_from: str | Features, checkout: str, sides: dict[Side, str], git: Git) -> list[str] | Failure: +def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[str, str], tasks_from: str | Features | ShippedFeatures, checkout: str, sides: dict[Side, str], git: Git) -> list[str] | Failure: """The report of a bench of the commits sides names, which empties folder and keeps its runs there. The bench plants bugs at - the places tasks_from names, where it is what `larv-review places` prints, and has Haiku build the features, or add the data - sources, it holds otherwise.""" + the places tasks_from names, where it is what `larv-review places` prints, and has Haiku build the features, add the data + sources, or rebuild the shipped features, it holds otherwise.""" containers = Containers(docker_cli(env), f"task-bench-{uuid.uuid4().hex[:12]}", given["--test"], int(env.get(SHARE_VARIABLE) or MEMORY_MIB), f"{os.getuid()}:{os.getgid()}") shutil.rmtree(folder, ignore_errors=True) trees: dict[Side, str] = {} @@ -282,6 +315,8 @@ def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[st planned: typing.Callable[[Bench], Planned | Failure] | Failure if isinstance(tasks_from, Features): asked, planned = Asked(KINDS[given[TASKS]], int(given["--runs"])), features_planner(tasks_from, checkout, trees) + elif isinstance(tasks_from, ShippedFeatures): + asked, planned = Asked(SHIPPED, int(given["--runs"])), functools.partial(shipped_tasks, shipped=tasks_from, count=int(given["--shipped"])) else: asked, planned = Asked(BUG, int(given["--runs"])), bugs_planner(given, env, tasks_from, trees["base"]) if isinstance(planned, Failure): diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py new file mode 100644 index 00000000..c91b9579 --- /dev/null +++ b/bin/task_bench/shipped_features.py @@ -0,0 +1,142 @@ +"""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.""" +import functools +import os +import pathlib +import shutil +import typing + +from branch_chunks.read import cut_with_shipped, unsupported +from failure import Failure +from plan.todo_table import Item +from project_config.main import located +from project_config.settings import RECORDS +from task_bench.feature_tasks import ACCEPTANCE, Feature, PATCH, why_passed_over +from task_bench.figures import Side, SIDES +from task_bench.runs import of_tests +from task_bench.tasks import Bench, committed, on_disk, Planned, Task +from git_cli.git_repo import Git + +# 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. +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.""" + + name: str + told: str + before: str + tip: str + + +class ShippedFeatures(typing.NamedTuple): + """The features a project shipped, newest first, and the paths of its plan and its records, each from the checkout's top. A + chunk's change to those paths is no part of its feature.""" + + found: list[Shipped] + records: list[str] + + +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.""" + in_checkout = functools.partial(git, cwd=checkout) + config = located(checkout, home, in_checkout) + if isinstance(config, Failure): + return config + if why := unsupported(checkout, home, in_checkout): + return Failure(f"task-bench cannot tell what the project shipped: {why}") + cut = cut_with_shipped(base, in_checkout, config.titles) + if isinstance(cut, Failure): + 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) + 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 ShippedFeatures(found, [path for path in map(config.tracked, ("plan", *RECORDS)) if path]) + + +def named(items: tuple[Item, ...]) -> str: + """What the report calls the feature that shipped items: `item 7`, or `items 7, 8`.""" + return f"item{'s' * (len(items) > 1)} {', '.join(str(item.id) for item in items)}" + + +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.""" + 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" / "-".join(feature.name.replace(",", "").split()) + taken_out = 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 + if isinstance(taken_out, TakenOut) and why is None: + tasks.append(Task(len(tasks) + 1, feature.name, taken_out.trees, dict.fromkeys(SIDES, feature.told), acceptance=taken_out.feature.acceptance)) + continue + shutil.rmtree(folder, ignore_errors=True) + 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 Planned(tasks, [f"Passed over {line}" for line in passed_over], {}) + + +class TakenOut(typing.NamedTuple): + """A shipped feature taken out of the bench's trees: each side's tree without it, committed once, and the feature that + builds it there again.""" + + trees: dict[Side, str] + feature: Feature + + +def without(bench: Bench, shipped: Shipped, records: list[str], folder: pathlib.Path) -> TakenOut | str | Failure: + """shipped taken out of a copy of each side's tree, under folder, where its patch and its acceptance tests go too; or why it + cannot be, which ends a sentence that opens with its name. A Failure where git fails. + + 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. + names = bench.git("diff", "--name-only", "-z", *PLAIN_DIFF, *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))] + 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. + diffed = bench.git("diff", "--binary", f"--output={patch}", *PLAIN_DIFF, *change, cwd=bench.checkout) + if isinstance(diffed, Failure): + return diffed + trees: dict[Side, str] = {} + for side in SIDES: + tree = str(folder / side) + shutil.copytree(bench.trees[side], tree, symlinks=True) + # In a repository of its own, the tree is where `git apply` reads the patch's paths from, whatever repository holds the + # bench's folder. git has run in this bench already, so a failure of the second command is the patch's. + if isinstance(made := bench.git("init", "--quiet", cwd=tree), Failure): + return made + if isinstance(bench.git("apply", "-R", str(patch), cwd=tree), Failure): + return f"its revert doesn't apply at the {side}" + if failure := committed(bench.git, tree): + return failure + trees[side] = tree + return TakenOut(trees, Feature(shipped.name, shipped.told, str(patch), str(acceptance))) diff --git a/bin/task_bench/tasks.py b/bin/task_bench/tasks.py index 63e22a87..adb4a3f9 100644 --- a/bin/task_bench/tasks.py +++ b/bin/task_bench/tasks.py @@ -1,4 +1,4 @@ -"""What task-bench's three kinds of task share: a planted bug, a feature to build and a data source to add. They share the task itself, the bench it runs in, and the +"""What task-bench's four kinds of task share: a planted bug, a feature to build, a data source to add and a shipped feature to rebuild. They share the task itself, the bench it runs in, and the steps that commit a task's tree and run the tests over a copy of one.""" import dataclasses import pathlib @@ -32,11 +32,14 @@ class Kind(typing.NamedTuple): BUG = Kind("bug", "A test of this project fails with the message below. Find the bug in the code and fix it. Change no test.\n\n{told}", "a planted bug") FEATURE = Kind("feature", "Build the feature below in this project.\n\n{told}", "a feature's acceptance tests") DATA_SOURCE = Kind("data source", "Add the data source below to this project.\n\n{told}", "a data source's acceptance tests") +# What Haiku is asked is a feature's prompt: the feature is new to the tree Haiku gets. +SHIPPED = Kind("shipped feature", FEATURE.prompt, "a shipped feature taken out") # By the value --tasks takes. A panel of three readers, seated as the README's audience, picked `--tasks features` on 2026-11-23, # 3 to 0, over a bare `--features` and a `features` subcommand: it names what the bench runs, and the bugs as its other value. # Such a panel picked `data-sources` the same day, 3 to 0, over `sources` and `imports`, which read as source code and as import -# statements. -KINDS = {"bugs": BUG, "features": FEATURE, "data-sources": DATA_SOURCE} +# statements. Such a panel picked `shipped-features` on 2026-11-24, 3 to 0, over `shipped`, `rebuilds`, `reverts` and `history`: +# it says what was shipped, and stands apart from the features someone wrote for the bench. +KINDS = {"bugs": BUG, "features": FEATURE, "data-sources": DATA_SOURCE, "shipped-features": SHIPPED} @dataclasses.dataclass(frozen=True) diff --git a/bin/task_bench/test_feature_tasks.py b/bin/task_bench/test_feature_tasks.py index 43ee3443..2232fed0 100644 --- a/bin/task_bench/test_feature_tasks.py +++ b/bin/task_bench/test_feature_tasks.py @@ -288,7 +288,7 @@ class OptionsTest(unittest.TestCase): def test_tasks_names_the_kind_of_task_and_bugs_is_the_default(self): self.assertEqual(self.options()["--tasks"], "bugs") self.assertEqual(self.options("--tasks", "features")["--tasks"], "features") - self.assertEqual(self.options("--tasks=chores").reason, "--tasks takes bugs, features or data-sources, not chores") + self.assertEqual(self.options("--tasks=chores").reason, "--tasks takes bugs, features, data-sources or shipped-features, not chores") def test_features_run_5_times_at_each_side_by_default(self): self.assertEqual(self.options("--tasks", "features")["--runs"], "5") diff --git a/bin/task_bench/test_registers.py b/bin/task_bench/test_registers.py index f3a6b196..1a3b492d 100644 --- a/bin/task_bench/test_registers.py +++ b/bin/task_bench/test_registers.py @@ -218,7 +218,7 @@ class OptionsTest(unittest.TestCase): def test_data_sources_is_a_kind_of_task_that_runs_5_times_at_each_side_by_default(self): self.assertEqual(self.options("--tasks", "data-sources")["--runs"], "5") - self.assertEqual(self.options("--tasks", "sources").reason, "--tasks takes bugs, features or data-sources, not sources") + self.assertEqual(self.options("--tasks", "sources").reason, "--tasks takes bugs, features, data-sources or shipped-features, not sources") self.assertIn(", or task-bench --tasks features|data-sources --image ", main.USAGE) def test_the_options_that_choose_bugs_are_refused_with_data_sources(self): -- 2.52.0 From 1ca84223cecf013b451698d18f524910bcbbda0d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:30:34 +0100 Subject: [PATCH 05/14] Say in item 507 how a shipped feature is found, as built --- todo.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/todo.md b/todo.md index ecf1cf6b..9167e0e3 100644 --- a/todo.md +++ b/todo.md @@ -114,19 +114,18 @@ ### 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 skipped. +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. -A chunk lands as several commits, not one: test, code and review-answer commits, sometimes merges of the default branch, ending in the commit that removes the item's row from the plan. So the bench finds a shipped feature by that finishing commit, on the base's first-parent history, newest first: +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: -- The tagline Haiku is told is the one in the row the finishing commit removes. -- The feature's commits are the commits that are no merge, on the first-parent history from the finishing commit back to the one before it. -- The revert applies each of those commits' diffs in reverse, newest first, to a copy of each side's tree, 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 reference patch is the same diffs forwards, and the acceptance tests are the test files those commits touched, 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 that touches no test or no other file is passed over. +- 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. +- 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 panel of readers seated as the audience picks the new value of `--tasks` and the flag that says how many shipped features to take. +A panel of three readers seated as the audience picked the spellings on 2026-11-24: `--tasks shipped-features`, 3 to 0, and `--shipped `, first for two and second for the third. -Re-scored after the first read of the code, from L 3 and S 5: about 600 lines in 8 or 9 files, across `task_bench`, the plan's table reader, `project_config` and `git_cli`, and deriving tasks from git history is a new pattern. +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. ### 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. -- 2.52.0 From 8e43967fac5dd3909416c87821cd9a3c814a7511 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:32:03 +0100 Subject: [PATCH 06/14] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 74ffd6da5300550181605a0335bffaf6864e5bae Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:33:08 +0100 Subject: [PATCH 07/14] Sort the shipped-feature imports and type what a bench makes its tasks from --- bin/task_bench/main.py | 4 ++-- bin/task_bench/shipped_features.py | 10 +++++----- bin/task_bench/test_shipped_features.py | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index e7ec7df4..faf6883e 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -175,11 +175,11 @@ from claude_code.entries import entry_from, json_objects from mutate_changes.tool_process import failed, Ran, run_tool from failure import Failure from task_bench.feature_tasks import feature_tasks, Features, read_features -from task_bench.shipped_features import read_shipped, shipped_tasks, ShippedFeatures from task_bench.figures import figures, Result, Side, SIDES, table from git_cli import git_repo from review_rules.review_folder import made_review_folder, REPORTS from larv_review.history_commands import read_places +from task_bench.shipped_features import read_shipped, shipped_tasks, ShippedFeatures from task_bench.record_figures import recorded_bench from run_heavy.capped_docker import SHARE_VARIABLE @@ -274,7 +274,7 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Cal # so a fault there stops the bench at once. kind = KINDS[given[TASKS]] # Shipped features are read from the base's history, once the base is known. - tasks_from = None if kind is SHIPPED else read(home) if kind is BUG else read_features(home, kind) + tasks_from: str | Features | ShippedFeatures | Failure | None = None if kind is SHIPPED else read(home) if kind is BUG else read_features(home, kind) if isinstance(tasks_from, Failure): return tasks_from git = functools.partial(git_repo.git, env=env) diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py index c91b9579..33af6cc2 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/shipped_features.py @@ -9,16 +9,16 @@ import pathlib import shutil import typing +from task_bench.feature_tasks import ACCEPTANCE, Feature, PATCH, why_passed_over +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 project_config.main import located -from project_config.settings import RECORDS -from task_bench.feature_tasks import ACCEPTANCE, Feature, PATCH, why_passed_over -from task_bench.figures import Side, SIDES from task_bench.runs import of_tests -from task_bench.tasks import Bench, committed, on_disk, Planned, Task -from git_cli.git_repo import Git +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. diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index 054afc40..5c12cc16 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -10,13 +10,13 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from task_bench.test_task_bench import BASE_CODE, HEAD_CODE 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 branch_chunks.read import READ_AT -from task_bench import main -from task_bench.shipped_features import 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 = { -- 2.52.0 From 7e4854bd8e23b4389ae5b0ff44bfc43d0d253eca Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:54:52 +0100 Subject: [PATCH 08/14] Test a shipped feature's binary file, linked test, removed test and passing test, a checkout that drops a diff's prefixes, and a bench run from a folder inside the checkout --- bin/task_bench/shipped_features.py | 9 ++- bin/task_bench/test_shipped_features.py | 88 ++++++++++++++++++++----- 2 files changed, 77 insertions(+), 20 deletions(-) diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py index 33af6cc2..3800218c 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/shipped_features.py @@ -81,7 +81,7 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned for feature in shipped.found: if len(tasks) == count: break - folder = bench.folder / "shipped-features" / "-".join(feature.name.replace(",", "").split()) + 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)) why = taken_out if not isinstance(taken_out, TakenOut) else why_passed_over(bench, taken_out.trees, taken_out.feature) if isinstance(why, Failure): @@ -97,6 +97,11 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned 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()) + + class TakenOut(typing.NamedTuple): """A shipped feature taken out of the bench's trees: each side's tree without it, committed once, and the feature that builds it there again.""" @@ -112,7 +117,7 @@ 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. - names = bench.git("diff", "--name-only", "-z", *PLAIN_DIFF, *change, cwd=bench.checkout, errors="replace") + 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))] diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index 5c12cc16..2bd41ead 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -1,7 +1,9 @@ """`task-bench --tasks shipped-features` from its command line down: a whole bench of the features a project's history shipped, with docker and claude faked, and the histories it passes over.""" +import contextlib import functools import json +import os import pathlib import re import subprocess @@ -13,24 +15,26 @@ 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", } 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 three 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 its test, and item 9 changed the README alone. - The head branches off after them.""" + """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, 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.""" def setUp(self): super().setUp() @@ -38,22 +42,28 @@ class ShippedFeaturesCase(BenchOfTasksCase): # branch_chunks reads the plan and two records at these paths alone. self.config.write_text(re.sub(r'"checkout:(plan|comprehension-history|reading-cost)\.md"', lambda found: f'"checkout:{READ_AT[found[1]]}"', self.config.read_text())) self.git("checkout", "--quiet", "main") + self.git("config", "diff.noprefix", "true") self.git("rm", "--quiet", "-r", "bench-tasks") (self.repo / "calc.go").write_text(BASE_CODE.replace("a * 2", "a + a")) - self.plan(7, 8, 9) - self.landed(1, "Plan three items") + self.plan(7, 8, 9, 10) + self.landed(1, "Plan four items") (self.repo / "calc.go").write_text(BASE_CODE) (self.repo / "twice_test.go").write_text("grep -q 'a \\* 2\\|2 \\* a' calc.go\n") - self.plan(7, 9) + self.plan(7, 9, 10) self.landed(2, "Multiply in Twice", "Finish item 8 in the plan") (self.repo / "halve_test.go").write_text(ACCEPTANCE) self.landed(3, "Test Halve") (self.repo / "halve.go").write_text(HALVE) - self.plan(9) + (self.repo / "halve.bin").write_bytes(b"\x00\xff") + os.symlink("halve_test.go", self.repo / "linked_test.go") + self.plan(9, 10) self.landed(3, "Add Halve", "Finish item 7 in the plan") (self.repo / "README.md").write_text("# Calc\n\nIt adds.\n") - self.plan() + self.plan(10) self.landed(4, "Say what Calc is") + (self.repo / "whole_test.go").write_text("exit 0\n") + self.plan() + self.landed(5, "Keep Twice whole", "Finish item 10 in the plan") self.base = self.git("rev-parse", "HEAD") self.git("checkout", "--quiet", "-B", "item-1") (self.repo / "calc.go").write_text(HEAD_CODE) @@ -80,6 +90,7 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase): folder = pathlib.Path(report[-1].removeprefix(main.KEPT)) self.assertEqual(report[:-1], [ f"task-bench: base {self.base[:12]}, head {self.head[:12]}. 1 shipped feature, each run 2 times at each side by claude-haiku-5-5 in Claude Code 2.1.330.", + "Passed over the shipped feature item 10: its acceptance tests pass at the base before it is built.", "Passed over the shipped feature item 9: its change holds no test that the head holds.", "Passed over the shipped feature item 8: its revert doesn't apply at the head.", "", @@ -94,8 +105,8 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase): ]) handed = json.loads(pathlib.Path(f"{self.log}.claude").read_text()) self.assertEqual(handed["prompt"], "Build the feature below in this project.\n\nAdd `Halve`, which halves a whole number.") - # Haiku's copy holds the tree without Halve and without its test; the plan and the README stay as the side holds them. - self.assertEqual(handed["handed"], [".git", "README.md", "calc.go", "calc_test.go", "dangling", "todo.md", "twice_test.go"]) + # Haiku's copy holds the tree without Halve, its binary file and its tests; the plan and the later items' files stay as the side holds them. + self.assertEqual(handed["handed"], [".git", "README.md", "calc.go", "calc_test.go", "dangling", "todo.md", "twice_test.go", "whole_test.go"]) results = json.loads((folder / "results.json").read_text()) self.assertEqual((results["shipped-features"], len(results["runs"])), ({"1": "item 7"}, 4)) self.assertEqual(sorted(path.name for path in (folder / "runs").iterdir() if path.suffix == ".jsonl"), [f"shipped-feature-1-{side}-{run}.jsonl" for side in ("base", "head") for run in (1, 2)]) @@ -104,24 +115,51 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase): report = self.bench(**{"--shipped": "1"}) self.assertNotIsInstance(report, Failure, report) # Item 8 shipped before item 7, which filled the bench, so nothing is said of it. - self.assertEqual(report[1:3], ["Passed over the shipped feature item 9: its change holds no test that the head holds.", ""]) + self.assertEqual(report[1:4], [ + "Passed over the shipped feature item 10: its acceptance tests pass at the base before it is built.", + "Passed over the shipped feature item 9: its change holds no test that the head holds.", + "", + ]) 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" - self.assertEqual(sorted(path.name for path in tree.iterdir()), [".git", "README.md", "calc.go", "calc_test.go", "dangling", "todo.md", "twice_test.go"]) + 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_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" + 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") + + def test_benches_the_whole_checkout_from_a_folder_inside_it(self): + (self.repo / "inside").mkdir() + self.enterContext(contextlib.chdir(self.repo / "inside")) + report = self.bench() + 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. + self.git("checkout", "--quiet", "-b", "without-test") + self.git("rm", "--quiet", "halve_test.go", "linked_test.go") + 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.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~4") + 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.assertIn("task-bench: passed over the shipped feature item 8: its revert doesn't apply at the head.", self.progress.getvalue().splitlines()) def test_fails_before_docker_runs_where_the_history_shipped_no_item(self): - self.git("branch", "--quiet", "--force", "main", "main~6") + 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.assertFalse(self.log.exists(), "docker ran") @@ -134,12 +172,13 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase): class ReadShippedTest(ShippedFeaturesCase): - def read(self): - return read_shipped(self.home, str(self.repo), "main", functools.partial(git, env=self.env)) + def read(self, run=git): + return read_shipped(self.home, str(self.repo), "main", functools.partial(run, env=self.env)) 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."), ("item 9", "Say in the README what Calc is."), ("item 7", "Add `Halve`, which halves a whole number."), ("item 8", "Multiply in `Twice`."), @@ -162,7 +201,20 @@ class ReadShippedTest(ShippedFeaturesCase): self.landed(5, "Plan an item again") self.plan() self.landed(6, "Drop item 8: nobody asked for it") - self.assertEqual(self.read().found[0].name, "item 9") + self.assertEqual(self.read().found[0].name, "item 10") + + def test_reads_the_checkout_it_is_given_wherever_the_process_runs(self): + self.enterContext(contextlib.chdir(self.root)) + self.assertEqual(len(self.read().found), 4) + + 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): -- 2.52.0 From 52c525a12fffa2edd058adcc83306c41327a13f7 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 00:55:14 +0100 Subject: [PATCH 09/14] Test a shipped feature that holds a file whose name is not UTF-8 --- bin/task_bench/test_shipped_features.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index 2bd41ead..77d352b7 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -32,8 +32,8 @@ 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, 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 + 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.""" def setUp(self): @@ -55,6 +55,7 @@ class ShippedFeaturesCase(BenchOfTasksCase): self.landed(3, "Test Halve") (self.repo / "halve.go").write_text(HALVE) (self.repo / "halve.bin").write_bytes(b"\x00\xff") + (self.repo / os.fsdecode(b"halv\xe9.txt")).write_text("A name that is not UTF-8.\n") os.symlink("halve_test.go", self.repo / "linked_test.go") self.plan(9, 10) self.landed(3, "Add Halve", "Finish item 7 in the plan") -- 2.52.0 From c6ebfe0cfe610665f789f2a69add1d0cdbb94a3e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 01:29:45 +0100 Subject: [PATCH 10/14] =?UTF-8?q?Answer=20stability=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(1=20misread);=20a=20feature?= =?UTF-8?q?=20whose=20branch=20landed=20by=20fast-forward=20is=20passed=20?= =?UTF-8?q?over=20and=20item=20531=20files=20benching=20it,=20a=20test=20r?= =?UTF-8?q?efuses=20a=20plan=20outside=20the=20checkout=20from=20another?= =?UTF-8?q?=20folder,=20and=20the=20README=20states=20the=20import=20once?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- bin/task_bench/shipped_features.py | 56 ++++++++++-------- bin/task_bench/test_shipped_features.py | 79 ++++++++++++++++++------- todo.md | 23 +++++-- 4 files changed, 111 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index eb4dea57..02eb8079 100644 --- a/README.md +++ b/README.md @@ -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] ` 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 --test []` 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 --test []` 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 ` one item's row and detail; `add …` files an item under the next free ID, `edit …` sets an item's cells or detail, and `move --release ` sets an item's release; `finish ` 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 ...` 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 [] [--timeout ]` 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. diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py index 3800218c..dcbc97b3 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/shipped_features.py @@ -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 diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index 77d352b7..a6488716 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -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 is in `shipped-features//base` and `shipped-features//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): diff --git a/todo.md b/todo.md index 9167e0e3..fddd62f0 100644 --- a/todo.md +++ b/todo.md @@ -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//` in the bench's folder, where `` 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 `, 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. -- 2.52.0 From 8d4609fad71321d1b70c195ae79182bebd6712ac Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 01:29:45 +0100 Subject: [PATCH 11/14] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20the=20di?= =?UTF-8?q?gest=20and=20the=20gather=20prompt=20name=20the=20folders=20tha?= =?UTF-8?q?t=20hold=20each=20side=20without=20a=20shipped=20feature,=20and?= =?UTF-8?q?=20the=20help's=20exit-1=20paragraph=20reads=20whole?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/task_bench/digest.py | 4 +++- bin/task_bench/gather-prompt.md | 2 ++ bin/task_bench/main.py | 27 +++++++++++++++------------ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/bin/task_bench/digest.py b/bin/task_bench/digest.py index c561ddbf..b09bbadd 100644 --- a/bin/task_bench/digest.py +++ b/bin/task_bench/digest.py @@ -46,7 +46,9 @@ def digest(sides: dict[Side, str], table: list[str], tasks: list[TaskRuns], is_f """The digest of a bench of the commits sides names: where each side's code is, the table of its figures, then each task, which the digest calls by noun. is_file says whether a path in the project names a file.""" line = " A bug's name gives its line at the base." if noun == "bug" else "" - code = f"Base {sides['base']}, head {sides['head']}.{line} Each side's code without the {noun}s is in `trees/base` and `trees/head` in the bench's folder." + # `trees` holds every shipped feature built; each one's task starts in trees of its own, which lack it. + where = "shipped feature is in `shipped-features//base` and `shipped-features//head`" if noun == "shipped feature" else f"the {noun}s is in `trees/base` and `trees/head`" + code = f"Base {sides['base']}, head {sides['head']}.{line} Each side's code without {where} in the bench's folder." return "\n".join(["# task-bench digest", "", code, "", *table, *(line for task in tasks for line in ["", *told(task, is_file, noun)])]) + "\n" diff --git a/bin/task_bench/gather-prompt.md b/bin/task_bench/gather-prompt.md index ea2ba57a..67526516 100644 --- a/bin/task_bench/gather-prompt.md +++ b/bin/task_bench/gather-prompt.md @@ -12,6 +12,8 @@ Where the digest's headings read `## Feature`, the bench had Haiku build feature Where the digest's headings read `## Data source`, the bench had Haiku add data sources instead. Each data source is a spec, which the digest quotes, and a register: a made-up dataset as a publisher would release it. Haiku wrote the importer, the data and whatever else the spec asks. Read every data source as a feature, with two differences. Its runs are named as `data-source-1-base-2`. And the tree Haiku started in, register included, is `data-sources//base` or `data-sources//head` in the bench's folder, `` being the name in the heading; `trees/base` and `trees/head` lack the register. +Where the digest's headings read `## Shipped feature`, the bench had Haiku rebuild features the project had shipped instead. Each shipped feature is the tagline of its plan item, which the digest quotes, and a rebuild of it passed where the tests its change touched, which Haiku never saw, passed over that rebuild. Read every shipped feature as a feature, with two differences. Its runs are named as `shipped-feature-1-base-2`. And the tree Haiku started in, without the feature, is `shipped-features//base` or `shipped-features//head` in the bench's folder, `` being the number in the heading; `trees/base` and `trees/head` hold the feature built. + Each run's whole stream is in the `runs` folder of the bench's folder, named below, as `.jsonl`. Open one only where the digest leaves a question open, and read it in parts: a stream is large. The folder is removed when you end, so an item must say everything it needs. What to do: diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index faf6883e..fc66729b 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -86,14 +86,17 @@ commits a rebase landed together, which share a commit time. A chunk with a comm that item out unbuilt, so it didn't ship it. The bench goes through the shipped features newest first, until --shipped of them, 5 by default, count. For each: - it takes the chunk'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 wrote on in them: the changelog, the decisions, the score anchors, the comprehension - history and the reading cost. So Haiku can read there what the changelog says of the feature; -- Haiku is told the tagline of the item, or of each item the chunk shipped, and nothing more; + 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; +- 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 one whose change doesn't -come out of both trees cleanly, as where a later chunk rewrote its lines, and 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`. +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; +- 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`. The project's config must name the checkout, with the plan at `todo.md`, the comprehension history at `docs/comprehension-history.md` and the reading cost at `docs/reading-cost.md`. --seed, --bugs and --prefix don't go with --tasks shipped-features, and --shipped goes with no other kind. @@ -136,10 +139,10 @@ number from 1, a --tasks that is none of bugs, features, data-sources and shippe fails, the seats' places don't name any Go or Python file, the tests fail at a side without a bug, or no mutant becomes a bug. With --tasks features or data-sources it exits 1 on a --seed, --bugs or --prefix; where no config names the checkout or its config sets no `bench-tasks`, or the folder holds no task of that kind, one that lacks a part, or a `generate-register` that is no executable -file, each before docker runs; and where the tests fail at a side without the acceptance tests, or no task counts. Where the +file, each before docker runs; and where the tests fail at a side without the acceptance tests, or no task counts. With --tasks shipped-features it exits 1 on a --seed, --bugs or --prefix, and on a --shipped that is no whole number from 1; -where no config names the checkout or its config keeps the plan or one of those two records elsewhere, or the base's history -shipped no item, each before docker runs; and where the tests fail at a side with every feature in, or no shipped feature +where no config names the checkout, its config keeps the plan, the comprehension history or the reading cost at another path +than the one above, or the base's history shipped no item, each before docker runs; and where the tests fail at a side with every feature in, or no shipped feature counts. A --shipped with another kind of task exits 1 too. Where the API refuses a run, the bench stops there and exits 1 too, after the table of the runs that finished. With --record-figures it also exits 1, saying why: before it plants a bug, where no config names the checkout or the history @@ -301,9 +304,9 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Cal def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[str, str], tasks_from: str | Features | ShippedFeatures, checkout: str, sides: dict[Side, str], git: Git) -> list[str] | Failure: - """The report of a bench of the commits sides names, which empties folder and keeps its runs there. The bench plants bugs at - the places tasks_from names, where it is what `larv-review places` prints, and has Haiku build the features, add the data - sources, or rebuild the shipped features, it holds otherwise.""" + """The report of a bench of the commits sides names, which empties folder and keeps its runs there. Where tasks_from is what + `larv-review places` prints, the bench plants bugs at the places it names. Where tasks_from holds features, data sources or + shipped features, the bench has Haiku build, add or rebuild them.""" containers = Containers(docker_cli(env), f"task-bench-{uuid.uuid4().hex[:12]}", given["--test"], int(env.get(SHARE_VARIABLE) or MEMORY_MIB), f"{os.getuid()}:{os.getgid()}") shutil.rmtree(folder, ignore_errors=True) trees: dict[Side, str] = {} -- 2.52.0 From 788a66d628274eef7932e287d34b19b820fc9c2e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 01:29:45 +0100 Subject: [PATCH 12/14] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=208=20=F0=9F=9F=A1=20(0=20misread);=20the=20help,?= =?UTF-8?q?=20docstrings,=20comments=20and=20item=20507's=20detail=20are?= =?UTF-8?q?=20reworded=20in=20this=20commit=20and=20the=20two=20before?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/branch_chunks/read.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/branch_chunks/read.py b/bin/branch_chunks/read.py index 75944488..bbac2f60 100644 --- a/bin/branch_chunks/read.py +++ b/bin/branch_chunks/read.py @@ -47,7 +47,7 @@ def branch_chunks(default: str, run: Git, titles: templates.Titles) -> list[Bran 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 first-parent line of default, a branch or a commit, 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): -- 2.52.0 From b77912589b4cf6d4350319e3543df920ad3f9e50 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 01:55:34 +0100 Subject: [PATCH 13/14] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20approved;?= =?UTF-8?q?=20item=20531's=20detail=20says=20how=20many=20of=20this=20proj?= =?UTF-8?q?ect's=20features=20landed=20by=20fast-forward?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- todo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todo.md b/todo.md index fddd62f0..a3d70043 100644 --- a/todo.md +++ b/todo.md @@ -115,7 +115,7 @@ ### 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. +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. This project landed 114 of its 260 shipped features that way, and none of those can be benched. A squash-merged feature whose one commit was authored and committed at the same time would be passed over too; whether a forge writes such commits is not checked. 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. -- 2.52.0 From 6f5839479ae2c91f64b236bdab74a209318edf3b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 01:58:07 +0100 Subject: [PATCH 14/14] Finish item 507 in the plan --- CHANGELOG.md | 1 + todo.md | 17 ----------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0187817f..5b0b1f8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +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` 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/todo.md b/todo.md index a3d70043..5819ddde 100644 --- a/todo.md +++ b/todo.md @@ -17,7 +17,6 @@ | 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 | | 527 | 0.16.0 | | owner | **Plant bugs for `task-bench` in TypeScript, from the mutants Stryker kills.** | 3 | 2 | 1 | 4 | 4 | 1.1 by 1 | 0.3 | @@ -126,22 +125,6 @@ Touches: - `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 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, in `shipped-features//` in the bench's folder, where `` 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 `, first for two and second for the third. - -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. The second part of item 504, which says what a bench feature is and when a run counts. A stronger model than the project's writes the six, once. Each breaks one of fejkdata's goals while it would suit another audience: -- 2.52.0