Compare commits

..

3 Commits

Author SHA1 Message Date
lilleman 6719d10034 Read a Rust string with a regex and kill the surviving mutants
CI / tests (pull_request) Has started running
2026-11-26 00:28:10 +01:00
lilleman dd15690903 Tell a Rust file's test modules apart as bytes and kill the surviving mutants
CI / tests (pull_request) Failing after 5m15s
2026-11-26 00:00:33 +01:00
lilleman c794073312 Keep a Rust file's test modules as planted when task-bench checks a fix
CI / tests (pull_request) Failing after 5m10s
2026-11-25 23:29:11 +01:00
14 changed files with 337 additions and 179 deletions
+1 -2
View File
@@ -2,10 +2,9 @@
## Unreleased
- larv-review's prose pass takes a second round after a fix that rewrites a claim a command or a source file can check, such as generated output, a number or a licence term.
- `deploy-release --cut-patch <commits>` cuts the newest tag's next patch release, such as 0.15.2 after v0.15.1, holding only the commits named, for a fix that must ship before main's other unreleased work. It runs `ci.sh` on the patch, tags and pushes it, merges the tag back into main through a pull request, and moves `~/.claude` to it. Plain `--cut` now refuses a patch release, and a release review counts only for a release later than the last cut.
- `task-bench` plants bugs in Rust files too, from the mutants cargo-mutants catches, and tells Haiku the panic message `cargo test` prints.
- `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 <n>` sets how many it takes, and a feature whose branch landed by fast-forward starts after the latest earlier chunk that shipped an item or landed by a merge or a rebase, and is passed over where none comes before it or its branch merged the default branch into itself.
- `task-bench --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 <n>` 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`.
+1 -1
View File
@@ -236,7 +236,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
- `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter.
- `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it.
- `subagent-rung [--plan] <model> <L>` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule.
- `task-bench --image <image> --test <shell text> [<options>]` plants bugs that the tests catch, in the Go, Python and Rust files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams.
- `task-bench --image <image> --test <shell text> [<options>]` plants bugs that the tests catch, in the Go, Python and Rust files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. It passes over a feature whose branch landed by fast-forward. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams.
- `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show <ID>` one item's row and detail; `add …` files an item under the next free ID, `edit <ID> …` sets an item's cells or detail, and `move <ID> --release <version>` sets an item's release; `finish <ID>` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`, except for a plan kept in Jira. Each change ranks a markdown plan. `todo-item --help` states the flags.
- `touch-predictions record <ID>...` appends what a chunk's items were predicted to touch, under `Touches:` in their details, beside the files and parts its branch touched, to the record the config names as `touch-predictions`; `touch-predictions --help` shows the spelling and how a part is named. `chunk-preflight` reads the same predictions to name the items that may start chunks at once.
- `wait-for <file> [<pattern>] [--timeout <seconds>]` waits until a file a background job writes holds a line matching the pattern, and prints it.
-2
View File
@@ -28,8 +28,6 @@ Run them in this order. A fix for a later check never breaks an earlier one.
Also report a list whose order carries no meaning and is not sorted (the technical principles' "Deterministic order", in the folder your prompt's `Technical principles:` line names; without one, open your report by saying so), a sentence contradicting another, a claim the code shows false, and a word used against `CLAUDE.md` → "Vocabulary".
Where your prompt hands you claims a fix rewrote, judge each claim afresh, not only the finding it answered. Look for a counter-example: one input or case where it is false. Then check it against every term of the source it names, such as each credit and notice a licence file lists. Report a claim you can't check as a ❓ naming what would check it.
Where your prompt has a `Claimed output:` line, that file holds the command and real output of each changed line that says what a command prints. Report a claim its output doesn't bear out, and name the missing words. A claim marked `not run` is a ❓ naming the command that would run it.
## Growth
+12 -13
View File
@@ -29,8 +29,9 @@ No model judges anything: the bench runs programs, and reads Haiku's own stream.
Claude home is new and empty, so the project's own CLAUDE.md, or AGENTS.md, in the copy is all the setup that loads. Its network
reaches api.anthropic.com and nothing else. A fix ends after 30 minutes.
- Check. The test command runs over the planted tree with each file that is no test as Haiku left it; a fix passes where it exits 0.
A test Haiku changed, removed or added doesn't count, and neither does a file under a `testdata` folder. A Rust test that
stands in the file of the code it tests is the exception: the bench takes that file whole, so a change to such a test counts.
A test Haiku changed, removed or added doesn't count, and neither does a file under a `testdata` folder. In a Rust file, each
inline `#[cfg(test)]` module stands as the planted file has it, and the rest is as Haiku left it. A Rust mutant is passed over
where its file's modules cannot be told apart, as where two share a name or a brace, string or comment is never closed.
--image is the project's development image, such as golang:1.27.4. The bench adds Claude Code to it, as its installer installs it,
so the image needs curl and bash; the result names the version. Haiku works in that image. So does --test: sh runs that text at
@@ -90,21 +91,17 @@ such as QZ, and never XK, which is Kosovo's in practice. The table has a row per
--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 <ID>:` took
that item out unbuilt, so it didn't ship it. Commits fast-forwarded onto the branch keep a commit time each, so each is a chunk
of its own, and the chunk that took the item out holds only the feature's last commit. The feature then starts after the latest
earlier chunk that took an item out or landed by a merge or a rebase. A commit between two features that belongs to neither
joins the later one; it counts only where its tests fail after the revert and pass with the reference patch, as for any feature.
A fast-forwarded feature is passed over where no such chunk comes before it, and where its branch merged the default branch into
itself, since its commits then hold the changes of the features that merge brought in. A merge titled
`Merge remote-tracking branch '...' into <branch>` is read as that, whatever the branch. The bench goes through the shipped
features newest first, until --shipped of them, 5 by default, count. For each:
- it takes the feature's change out of a copy of each side's tree, as `git apply -R` does. The plan and the project's records stay
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 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 two kinds:
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`.
@@ -177,6 +174,7 @@ import uuid
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 task_bench.rust_test_modules import tells_apart
from claude_code.reply import Claude
from task_bench.bench_folder import clear_left, held
from task_bench.runs import closed, Containers, docker_cli, fix_attempted, MEMORY_MIB, opened, ran_tests, TimedOut, TOKEN, WORK
@@ -493,7 +491,8 @@ def planted(bench: Bench, number: int, mutant: Mutant) -> Task | Failure | None:
if isinstance(sources, Failure):
return sources
bugs = bug_at_sides(mutant, diff, sources)
if bugs is None:
# The check keeps a Rust file's test modules as planted, which it can only do where it tells them apart.
if bugs is None or not all(tells_apart(mutant.path, source) for source in bugs.values()):
return None
trees: dict[Side, str] = {}
messages: dict[Side, str] = {}
+15 -1
View File
@@ -11,6 +11,7 @@ import typing
from mutate_changes.tool_process import failed, Ran
from failure import Failure
from mutate_changes.changed_lines import is_test
from task_bench.rust_test_modules import with_tests_of
from task_bench.api_proxy import PORT
MODEL = "claude-haiku-5-5"
@@ -166,7 +167,7 @@ def in_tree(containers: Containers, tree: str) -> list[str]:
def checked_tree(planted: str, copy: str, into: str) -> None:
"""Makes at `into` the tree the tests check a fix in: `planted`, the code with the bug as Haiku got it, with each file that is no
test as `copy` holds it after the fix. So a test Haiku changed, removed or added doesn't count, and neither does a file under
a `testdata` folder, where Go's tests keep the output they expect.
a `testdata` folder, where Go's tests keep the output they expect. A Rust file's `#[cfg(test)]` modules are the planted file's.
Raises OSError where a file cannot be copied."""
shutil.copytree(planted, into, symlinks=True)
@@ -184,6 +185,19 @@ def checked_tree(planted: str, copy: str, into: str) -> None:
with contextlib.suppress(FileNotFoundError):
os.unlink(target)
shutil.copy2(os.path.join(copy, path), target, follow_symlinks=False)
if path.endswith(".rs"):
keep_rust_tests(os.path.join(planted, path), target)
def keep_rust_tests(planted_file: str, target: str) -> None:
"""Puts into the Rust file at target, a copy of Haiku's, the test modules of planted_file; see `with_tests_of`. A file the planted
tree lacks, as a link or as a file, is left as it is, since it has no test to keep.
Raises OSError where a file cannot be read or written."""
if os.path.islink(planted_file) or os.path.islink(target) or not os.path.isfile(planted_file):
return
planted, copied = (pathlib.Path(file).read_bytes() for file in (planted_file, target))
pathlib.Path(target).write_bytes(with_tests_of(planted, copied))
def of_tests(path: str) -> bool:
+95
View File
@@ -0,0 +1,95 @@
"""The `#[cfg(test)]` modules of a Rust file, which stand in the file of the code they test: where each is, and a file with the modules
of another file put in place of its own. A file is bytes, since a Rust file is UTF-8 and a module is found by ASCII text alone."""
import re
# What the scan steps over or stops at. A string, a char and a comment may hold a brace.
SCAN = re.compile(
rb"""//[^\n]*"""
rb"""|/\*"""
rb"""|(?<![A-Za-z0-9_])b?r(?P<hashes>\#*)\""""
rb"""|\""""
rb"""|'(?:\\(?:u\{[0-9a-fA-F_]+\}|x[0-9a-fA-F]{2}|.)|[^\\'\n])'"""
rb"""|[{}]"""
rb"""|\#\[cfg\(test\)\]""",
re.DOTALL,
)
STRING_BODY = re.compile(rb'(?:[^"\\]|\\.)*"', re.DOTALL)
COMMENT_EDGE = re.compile(rb"/\*|\*/")
# What must follow the attribute for it to start an inline module: other attributes, a visibility, then `mod name {`.
MODULE = re.compile(rb"\s*(?:#\[[^\]]*\]\s*)*(?:pub(?:\([^)]*\))?\s+)?mod\s+(?P<name>\w+)\s*\{")
def tells_apart(path: str, source: bytes) -> bool:
"""Whether source, the file at path, is no Rust file or has test modules that `modules` tells apart."""
return not path.endswith(".rs") or modules(source) is not None
def modules(source: bytes) -> dict[bytes, tuple[int, int]] | None:
"""Each inline `#[cfg(test)] mod name { ... }` of source by its name, as the offsets from its attribute to its closing brace. A
module inside a test module is not listed. None where the modules cannot be told apart: two hold one name, or a brace, string or
comment is never closed. A `#[cfg(test)]` on anything but an inline module is not listed."""
found: dict[bytes, tuple[int, int]] = {}
depth = 0
# The module being read: its name, the offset of its attribute and the depth outside it.
inside: tuple[bytes, int, int] | None = None
position: int | None = 0
while position is not None and (match := SCAN.search(source, position)):
token, position = match.group(), match.end()
if token == b"/*":
position = after_comment(source, position)
elif token == b'"':
position = after_string(source, position)
elif match.group("hashes") is not None:
position = after_raw_string(source, position, match.group("hashes"))
elif token == b"{":
depth += 1
elif token == b"}":
depth -= 1
if inside and depth == inside[2]:
if inside[0] in found:
return None
found[inside[0]], inside = (inside[1], position), None
elif token.startswith(b"#[") and inside is None and (module := MODULE.match(source, position)):
inside, position = (module.group("name"), match.start(), depth), module.end()
depth += 1
return found if position is not None and depth == 0 and inside is None else None
def after_comment(source: bytes, position: int) -> int | None:
"""The offset after the block comment whose `/*` ends at position, None where it is never closed. Block comments nest in Rust."""
level = 1
while level and (match := COMMENT_EDGE.search(source, position)):
level += 1 if match.group() == b"/*" else -1
position = match.end()
return position if level == 0 else None
def after_string(source: bytes, position: int) -> int | None:
"""The offset after the string whose opening quote ends at position, None where it is never closed. A backslash escapes the next byte."""
closed = STRING_BODY.match(source, position)
return closed.end() if closed else None
def after_raw_string(source: bytes, position: int, hashes: bytes) -> int | None:
"""The offset after the raw string, opened by `r`, hashes and a quote, that ends at position, None where it is never closed. It has no escapes."""
closing = b'"' + hashes
found = source.find(closing, position)
return found + len(closing) if found >= 0 else None
def with_tests_of(planted: bytes, copy: bytes) -> bytes:
"""copy with each test module as planted holds it, and each test module planted lacks left out. So a test a fix changed, removed
or added doesn't count.
Where planted's modules cannot be told apart, copy is returned as it is. Where copy's cannot, or copy lacks one of planted's,
planted is returned: Haiku's file has no module to put them in."""
before, after = modules(planted), modules(copy)
if before is None:
return copy
if after is None or before.keys() - after.keys():
return planted
text, last = b"", 0
for (start, end), name in sorted((span, name) for name, span in after.items()):
text += copy[last:start] + (planted[before[name][0]:before[name][1]] if name in before else b"")
last = end
return text + copy[last:]
+16 -34
View File
@@ -5,7 +5,6 @@ is checked."""
import functools
import os
import pathlib
import re
import shutil
import typing
@@ -15,18 +14,15 @@ from branch_chunks.read import cut_with_shipped, unsupported
from failure import Failure
from git_cli.git_repo import Git
from plan.todo_table import Item, tagline_text
from branch_chunks.cut import Landing
from project_config.main import located
from task_bench.runs import of_tests
from project_config.settings import RECORDS
from task_bench.figures import Side, SIDES
# Why a feature that landed by fast-forward is passed over: no earlier chunk says where its commits start, or its branch merged
# the default branch into itself, so its commits hold what other features built.
NO_START = "its branch landed by fast-forward, and nothing earlier marks where its commits start"
MERGED_IN = "its branch landed by fast-forward after merging the default branch into itself, so its commits hold other features' changes"
# What git titles a merge of the default branch into a feature branch, other than into main or master, which git leaves out of
# the title. A person's merge of a branch into another default branch has the same title; its feature is then passed over.
SYNC_MERGE = re.compile(r"Merge (?:remote-tracking )?branch '[^']+' into (?!main$|master$)\S+")
# 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.
@@ -35,14 +31,13 @@ PLAIN_DIFF = ("--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", "-
class Shipped(typing.NamedTuple):
"""A feature the project shipped: the name the report gives it, such as `item 7`, the tagline of each item its chunk took out
of the plan, a paragraph each, and the commits its change runs between. before is None where the history doesn't say where
the change starts, and passed_over then says why."""
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 | None
before: str
tip: str
passed_over: str = ""
landing: Landing
class ShippedFeatures(typing.NamedTuple):
@@ -67,24 +62,11 @@ def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> Ship
if isinstance(cut, Failure):
return cut
branch, shipped = cut
found: list[Shipped] = []
# The oldest chunk first, so each feature knows the commit that ends the chunk before it.
marked = None
merged_in = False
for chunk, items in reversed(list(zip(branch.chunks, shipped))):
if items:
# A fast-forwarded feature's commits are a chunk each, and this chunk holds only the last. The earlier ones follow the
# commit that ends the latest earlier chunk of another feature.
starts, why = chunk.before, ""
if chunk.landing == "push":
starts, why = (None, NO_START) if marked is None else (None, MERGED_IN) if merged_in else (marked, "")
told = "\n\n".join(tagline_text(item.tagline) for item in items)
found.append(Shipped(named(items), told, starts, chunk.tip, why))
if SYNC_MERGE.fullmatch(branch.commits[chunk.tip].title):
merged_in = True
elif items or chunk.landing != "push":
marked, merged_in = chunk.tip, False
found.reverse()
found = [
Shipped(named(items), "\n\n".join(tagline_text(item.tagline) for item in items), chunk.before, chunk.tip, chunk.landing)
for chunk, items in zip(branch.chunks, shipped)
if items and chunk.before
]
if not found:
return Failure("No chunk on the base's history took an item out of todo.md, so that history holds no shipped feature to rebuild.")
return ShippedFeatures(found, [path for path in map(config.tracked, ("plan", *RECORDS)) if path])
@@ -107,7 +89,7 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned
break
# A feature passed over leaves no folder, so the next one tried takes the same number.
folder = bench.folder / "shipped-features" / str(len(tasks) + 1)
taken_out = feature.passed_over if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", functools.partial(without, bench, feature, feature.before, shipped.records, folder))
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
@@ -135,12 +117,12 @@ class TakenOut(typing.NamedTuple):
feature: Feature
def without(bench: Bench, shipped: Shipped, before: str, records: list[str], folder: pathlib.Path) -> TakenOut | str | Failure:
"""shipped, as the commits from before to its tip, taken out of a copy of each side's tree, under folder, where its patch and its acceptance tests go too; or why it
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 = (before, shipped.tip, "--", ".", *(f":(exclude,literal){path}" for path in records))
change = (shipped.before, shipped.tip, "--", ".", *(f":(exclude,literal){path}" for path in records))
# 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):
+144
View File
@@ -0,0 +1,144 @@
"""The test modules of a Rust file: where they are, and a fixed file with the planted tests put back."""
import pathlib
import sys
import textwrap
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from task_bench import rust_test_modules
from task_bench.rust_test_modules import tells_apart
LIB = textwrap.dedent("""\
pub fn add(a: i32, b: i32) -> i32 {
a + b
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn adds() {
assert_eq!(add(1, 2), 3);
}
}
""")
def modules(source: str) -> dict[bytes, tuple[int, int]] | None:
return rust_test_modules.modules(source.encode())
def with_tests_of(planted: str, copy: str) -> str:
return rust_test_modules.with_tests_of(planted.encode(), copy.encode()).decode()
def spelt(source: str) -> dict[str, str] | None:
found = modules(source)
return None if found is None else {name.decode(): source[start:end] for name, (start, end) in found.items()}
class ModulesTest(unittest.TestCase):
def test_holds_each_test_module_from_its_attribute_to_its_closing_brace(self):
self.assertEqual(spelt(LIB), {"tests": LIB[LIB.index("#[cfg(test)]"):LIB.rindex("}") + 1]})
def test_holds_none_where_the_file_has_no_test_module(self):
self.assertEqual(modules("fn main() {}\n"), {})
def test_takes_a_module_with_a_visibility_and_another_attribute(self):
source = "#[cfg(test)]\n#[allow(dead_code)]\npub(crate) mod checks {\n}\nfn after() {}\n"
self.assertEqual(spelt(source), {"checks": source[:source.index("}") + 1]})
def test_leaves_out_what_the_attribute_is_not_on_an_inline_module(self):
self.assertEqual(modules("#[cfg(test)]\nmod tests;\n#[cfg(test)]\nuse std::fmt;\n#[cfg(test)]\nfn helper() {}\n"), {})
def test_leaves_out_a_module_inside_a_module(self):
source = "#[cfg(test)]\nmod outer {\n #[cfg(test)]\n mod inner {}\n}\n"
self.assertEqual(list(spelt(source)), ["outer"])
def test_reads_past_a_brace_in_a_string_a_char_or_a_comment(self):
source = textwrap.dedent("""\
#[cfg(test)]
mod tests {
// }
/* } /* } */ } */
const A: &str = "}\\"}";
const B: &str = r#"}"}"#;
const C: char = '}';
const D: char = '\\'';
fn lifetime<'a>(x: &'a str) -> &'a str { x }
}
fn after() {}
""")
self.assertEqual(spelt(source), {"tests": source[:source.index("}\nfn after")+1]})
def test_reads_a_raw_string_that_ends_in_a_backslash(self):
source = "#[cfg(test)]\nmod tests {\n const A: &str = r\"\\\";\n}\nfn after() {}\n"
self.assertEqual(list(spelt(source)), ["tests"])
def test_reads_a_string_that_ends_in_two_backslashes_or_in_an_escaped_quote(self):
for literal in ('"\\\\"', '"a\\""', '"\\}\\}"'):
with self.subTest(literal=literal):
source = "#[cfg(test)]\nmod tests {\n const A: &str = " + literal + ";\n}\nfn after() {}\n"
self.assertEqual(list(spelt(source)), ["tests"])
def test_leaves_out_a_module_a_comment_or_a_char_stands_before(self):
self.assertEqual(modules("// helpers\nmod util {}\nfn a() { let c = 'x'; }\nmod more {}\n"), {})
def test_lists_a_test_module_inside_a_module_that_is_no_test(self):
source = "mod outer {\n #[cfg(test)]\n mod inner {}\n fn after() {}\n}\n"
self.assertEqual(spelt(source), {"inner": "#[cfg(test)]\n mod inner {}"})
def test_cannot_tell_the_modules_apart_where_two_hold_one_name(self):
self.assertIsNone(modules("#[cfg(test)]\nmod tests {}\nfn a() { #[cfg(test)] mod tests {} }\n"))
def test_cannot_tell_the_modules_apart_where_a_brace_string_or_comment_is_never_closed(self):
for source in ("#[cfg(test)]\nmod tests {\n", "fn a() {\n", "const A: &str = \"\n", "/* open\n", "const A: &str = r#\"\n"):
with self.subTest(source=source):
self.assertIsNone(modules(source))
class TellsApartTest(unittest.TestCase):
def test_tells_a_rust_file_apart_where_its_modules_can_be(self):
self.assertEqual([tells_apart("lib.rs", b"fn a() {}"), tells_apart("lib.rs", b"fn a() {")], [True, False])
def test_takes_a_file_of_another_language_whatever_it_holds(self):
self.assertTrue(tells_apart("calc.go", b"func a() {"))
class WithTestsOfTest(unittest.TestCase):
def test_takes_the_code_as_fixed_and_the_tests_as_planted(self):
planted = LIB.replace("a + b", "a - b")
fixed = LIB.replace("assert_eq!(add(1, 2), 3);", "assert_eq!(add(1, 2), 0);")
self.assertEqual(with_tests_of(planted, fixed), LIB)
def test_takes_the_planted_tests_where_the_fix_deleted_them(self):
planted = LIB.replace("a + b", "a - b")
fixed = "pub fn add(a: i32, b: i32) -> i32 {\n a + b\n}\n"
self.assertEqual(with_tests_of(planted, fixed), planted)
def test_leaves_out_a_test_module_the_fix_added(self):
planted = "fn a() {}\n"
fixed = "fn a() {}\n#[cfg(test)]\nmod mine {}\nfn b() {}\n"
self.assertEqual(with_tests_of(planted, fixed), "fn a() {}\n\nfn b() {}\n")
def test_puts_each_planted_module_where_the_fixed_module_of_its_name_stands(self):
planted = "fn a() { 1 }\n#[cfg(test)]\nmod x { fn t() {} }\nfn b() {}\n#[cfg(test)]\nmod y { fn u() {} }\n"
fixed = "fn a() { 2 }\n#[cfg(test)]\nmod y { fn changed() {} }\n#[cfg(test)]\nmod x { fn changed() {} }\nfn c() {}\n"
self.assertEqual(with_tests_of(planted, fixed), "fn a() { 2 }\n#[cfg(test)]\nmod y { fn u() {} }\n#[cfg(test)]\nmod x { fn t() {} }\nfn c() {}\n")
def test_puts_the_planted_modules_in_where_their_names_sort_in_file_order(self):
planted = "#[cfg(test)]\nmod a { 1 }\n#[cfg(test)]\nmod b { 22 }\nfn code() {}\n"
fixed = "#[cfg(test)]\nmod a { 333 }\n#[cfg(test)]\nmod b { 4444444 }\nfn fixed() {}\n"
self.assertEqual(with_tests_of(planted, fixed), "#[cfg(test)]\nmod a { 1 }\n#[cfg(test)]\nmod b { 22 }\nfn fixed() {}\n")
def test_takes_the_file_as_fixed_where_the_planted_modules_cannot_be_told_apart(self):
self.assertEqual(with_tests_of("#[cfg(test)]\nmod tests {\n", "fixed {}"), "fixed {}")
def test_takes_the_planted_file_where_the_fixed_modules_cannot_be_told_apart(self):
self.assertEqual(with_tests_of(LIB, "fn broken() {"), LIB)
if __name__ == "__main__":
unittest.main()
+14 -85
View File
@@ -17,8 +17,8 @@ from task_bench.test_task_bench import BASE_CODE, HEAD_CODE
from failure import Failure
from git_cli.git_repo import git
from task_bench import main
from task_bench.shipped_features import MERGED_IN, read_shipped
from branch_chunks.read import READ_AT
from task_bench.shipped_features import read_shipped
HEADER = "| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves |\n|---|---|---|---|---|---|---|---|---|---|---|\n"
ROWS = {
@@ -92,35 +92,6 @@ class ShippedFeaturesCase(BenchOfTasksCase):
self.env.pop(name, None)
def fast_forwarded_item_11(self):
"""Item 11 lands as a fast-forward leaves a branch: a plan commit, the feature and the commit that takes the item out, each
with the time it was written at, so each is a chunk of its own to branch_chunks. The head branches off after them."""
self.git("checkout", "--quiet", "main")
self.plan(11)
self.landed(6, "Plan an item", written_then=True)
(self.repo / "third.go").write_text("package calc\n")
(self.repo / "third_test.go").write_text("test -e third.go\n")
self.landed(7, "Add Third", written_then=True)
self.plan()
self.landed(8, "Finish item 11 in the plan", written_then=True)
self.git("checkout", "--quiet", "-B", "item-1")
(self.repo / "calc.go").write_text(HEAD_CODE)
self.commit("Head")
def fast_forwarded_item_11_alone(self):
"""Makes the default branch a history of its own, where item 11 is the one item shipped, and it landed by fast-forward."""
self.git("checkout", "--quiet", "--orphan", "fresh")
self.git("rm", "--quiet", "-r", "-f", ".")
self.plan(11)
(self.repo / "calc_test.go").write_text("exit 0\n")
self.landed(1, "Plan an item", written_then=True)
(self.repo / "third.go").write_text("package calc\n")
self.landed(2, "Add Third", written_then=True)
self.plan()
self.landed(3, "Finish item 11 in the plan", written_then=True)
self.git("branch", "--quiet", "--force", "main", "fresh")
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()
@@ -204,22 +175,23 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase):
self.assertEqual(report.reason, "No shipped feature on the base's history counts; the lines above say why.")
self.assertIn("task-bench: passed over the shipped feature item 8: its revert doesn't apply at the head.", self.progress.getvalue().splitlines())
def test_rebuilds_a_feature_whose_branch_landed_by_fast_forward_from_the_commits_after_the_item_shipped_before_it(self):
self.fast_forwarded_item_11()
report = self.bench(**{"--shipped": "1"})
self.assertNotIsInstance(report, Failure, report)
# Nothing is passed over, and the feature has a row at each side.
self.assertEqual(report[1], "")
self.assertEqual([line[:23] for line in report if line.startswith("| 1: item 11")], ["| 1: item 11 | base | 0", "| 1: item 11 | head | 0"])
def test_passes_over_a_fast_forwarded_feature_where_no_item_shipped_before_it(self):
self.fast_forwarded_item_11_alone()
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.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 11: its branch landed by fast-forward, and nothing earlier marks where its commits start.", self.progress.getvalue().splitlines())
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")
@@ -249,41 +221,6 @@ class ReadShippedTest(ShippedFeaturesCase):
])
self.assertEqual(shipped.records, ["todo.md", "decisions.md", "score-anchors.md", "docs/comprehension-history.md", "docs/reading-cost.md", "changelog.md"])
def test_a_fast_forwarded_feature_starts_after_the_chunk_that_shipped_the_item_before_it(self):
self.fast_forwarded_item_11()
newest = self.read().found[0]
self.assertEqual((newest.name, newest.before, newest.tip), ("item 11", self.git("rev-parse", "main~3"), self.git("rev-parse", "main")))
def test_a_fast_forwarded_feature_with_no_item_shipped_before_it_has_no_start(self):
self.fast_forwarded_item_11_alone()
self.assertEqual([(feature.name, feature.before) for feature in self.read().found], [("item 11", None)])
def fast_forwarded_item_11_around_a_merge(self, title):
"""Item 11's commits, fast-forwarded, with a merge of a commit from a side branch between them under title. Returns the merge's hash."""
self.git("checkout", "--quiet", "main")
self.git("branch", "--quiet", "side")
self.git("checkout", "--quiet", "side")
(self.repo / "other.go").write_text("package calc\n")
self.landed(5, "Other work")
self.git("checkout", "--quiet", "main")
self.plan(11)
self.landed(6, "Plan an item", written_then=True)
(self.repo / "third.go").write_text("package calc\n")
self.landed(7, "Add Third", written_then=True)
self.git("merge", "--quiet", "--no-ff", "--message", title, "side")
self.plan()
self.landed(9, "Finish item 11 in the plan", written_then=True)
return self.git("rev-parse", "main~1")
def test_passes_over_a_fast_forwarded_feature_whose_branch_merged_the_default_branch_into_itself(self):
self.fast_forwarded_item_11_around_a_merge("Merge remote-tracking branch 'origin/main' into item-11")
newest = self.read().found[0]
self.assertEqual((newest.name, newest.before, newest.passed_over), ("item 11", None, MERGED_IN))
def test_a_fast_forwarded_feature_starts_after_a_chunk_that_landed_by_a_merge_and_shipped_no_item(self):
merge = self.fast_forwarded_item_11_around_a_merge("Merge pull request 'Release review' (#7) from release-review into main")
self.assertEqual(self.read().found[0].before, merge)
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)
@@ -294,14 +231,6 @@ class ReadShippedTest(ShippedFeaturesCase):
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_a_feature_that_landed_by_a_rebase_starts_at_its_own_chunk_whatever_was_fast_forwarded_before_it(self):
self.git("checkout", "--quiet", "main")
self.plan(11)
self.landed(6, "Plan an item", written_then=True)
self.plan()
self.landed(7, "Build it", "Finish item 11 in the plan")
self.assertEqual(self.read().found[0].before, self.git("rev-parse", "main~2"))
def test_an_item_a_commit_title_drops_is_not_shipped(self):
self.git("checkout", "--quiet", "main")
self.plan(8)
+24
View File
@@ -578,6 +578,11 @@ class RunOutcomesTest(unittest.TestCase):
bench = dataclasses.replace(self.bench(), trees={"base": str(self.tree), "head": str(head)})
self.assertIsNone(main.planted(bench, 1, self.MUTANT))
def test_a_rust_mutant_in_a_file_whose_test_module_cannot_be_told_apart_is_passed_over(self):
(self.tree / "lib.rs").write_text("pub fn add(a: i32, b: i32) -> i32 {\n a + b\n}\n#[cfg(test)]\nmod tests {\n")
mutant = Mutant("lib.rs", 2, "lib.rs:2:7 replace + with -", (b" a + b",), (b" a - b",))
self.assertIsNone(main.planted(self.bench(), 1, mutant))
class ContainersTest(unittest.TestCase):
IN_TREE = ["--memory", "512m", "--memory-swap", "512m", "--user", "1000:1000", "--env", "HOME=/tmp", "--volume", "/tree:/work", "--workdir", "/work"]
@@ -718,6 +723,25 @@ class CheckedTreeTest(unittest.TestCase):
checked_tree(planted, copy, str(self.root / "check"))
self.assertEqual(self.held("check"), {"calc.go": "fixed", "sub/testdata/gone.golden": "4", "testdata.go": "fixed", "testdata/want.golden": "3"})
def test_takes_a_rust_files_test_module_as_planted_and_the_rest_as_fixed(self):
planted = self.tree("planted", {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() { a() } }\n", "src/other.rs": "fn b() { 1 }\n"})
copy = self.tree("copy", {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests {}\n", "src/other.rs": "fn b() { 2 }\n", "src/new.rs": "#[cfg(test)]\nmod mine {}\nfn c() {}\n"})
checked_tree(planted, copy, str(self.root / "check"))
self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests { fn t() { a() } }\n", "src/other.rs": "fn b() { 2 }\n", "src/new.rs": "#[cfg(test)]\nmod mine {}\nfn c() {}\n"})
def test_takes_the_planted_rust_file_where_the_fix_deleted_its_test_module(self):
planted = self.tree("planted", {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() {} }\n"})
copy = self.tree("copy", {"src/lib.rs": "fn a() { 2 }\n"})
checked_tree(planted, copy, str(self.root / "check"))
self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() {} }\n"})
def test_leaves_a_rust_link_as_a_link_whatever_it_points_at(self):
planted = self.tree("planted", {"z.rs": "fn a() {}\n#[cfg(test)]\nmod tests {}\n", "a.txt": "text"})
copy = self.tree("copy", {"a.txt": "text"})
os.symlink("a.txt", os.path.join(copy, "z.rs"))
checked_tree(planted, copy, str(self.root / "check"))
self.assertEqual((os.readlink(self.root / "check/z.rs"), self.held("check")["a.txt"]), ("a.txt", "text"))
def test_copies_a_link_as_a_link(self):
planted = self.tree("planted", {"calc.go": "bug"})
copy = self.tree("copy", {"calc.go": "fixed"})
+1 -3
View File
@@ -364,7 +364,7 @@ Valid while no published standard sets either number, the reading-cost window st
2026-10-08, lilleman. Serves goal 1.4: run beside the full scan, `/security-review` started seconds apart from it each round and returned a near-identical report. Valid while the full scan covers what `/security-review` reports.
## review: a fix for a 🔴 reruns the pass that found it, unless that pass is at its cap, and each pass whose row in `larv-review` §3's re-entry table the fix meets; from round 2 a pass reviews only the answers to its last round's findings and any other pass's fix that re-entered it; a fix for a 🟢 or a ❓ doesn't rerun any pass, nor does one for a prose finding unless it rewrites a claim a command or a source file can check, which reruns prose once, and a fix for a 🟡 reruns the pass that raised it only when the fix weakens, skips or guards a test; the stability pass doesn't rerun on a round's fixes where every 🔴 and 🟡 of that round asked only that a named mutant be killed or a named failing test pass, and the tests and the mutation command run clean on the fixes
## review: a fix for a 🔴 reruns the pass that found it, unless that pass is at its cap, and each pass whose row in `larv-review` §3's re-entry table the fix meets; from round 2 a pass reviews only the answers to its last round's findings and any other pass's fix that re-entered it; a fix for a 🟢, a ❓ or a prose finding doesn't rerun any pass, and a fix for a 🟡 reruns the pass that raised it only when the fix weakens, skips or guards a test; the stability pass doesn't rerun on a round's fixes where every 🔴 and 🟡 of that round asked only that a named mutant be killed or a named failing test pass, and the tests and the mutation command run clean on the fixes
2026-10-08, lilleman. Serves goal 1.4. An audit of the four costliest archived chunks found nearly every finding that mattered in a pass's first round; when every fix, a nit's included, re-entered review, later rounds mostly re-checked the last fix, reworded what an earlier round wrote, or contradicted another round on the same line. A round 2 caught real bugs only where a fix changed behaviour, so stability still reruns on every fix that does, and security on every fix that opens an untrusted-input boundary or touches authn/authz, secrets or crypto. Valid while round-2 reviews of nit and prose fixes change only what a user wouldn't notice.
@@ -376,8 +376,6 @@ Valid while no published standard sets either number, the reading-cost window st
2026-11-18, lilleman through todo item 399. Serves goals 1.1 and 1.4. The 2026-10-29 entry's validity condition broke once. In a client project's pull request, stability round 1 raised a 🟡: an end-to-end payroll test passes on a used database. It proposed asserting the created row counts. The answer commit added that assertion behind a `test.skip` that runs when every count is zero. A broken payroll also creates zero rows, so a regression became a skip. The gate and the mutation run don't catch it, since a skipped test counts as passing; only the forge's auto-reviewer did. So a 🟡 fix that removes or loosens an assertion, changes an expected value, or skips, deletes or guards a test or assertion reruns the pass that raised it, as a 🔴 fix does. A 🟡 fix that only kills a named mutant or makes a named failing test pass doesn't, since the tests and the mutation command check it, and a skipped test kills no mutant. Every other 🟡 fix keeps the 2026-10-29 rule: the 2026-10-08 audit found that reruns of fixes to minor findings mostly re-checked wording. The rerun reviews only the answers, and the cap of two rounds still ends the pass. Valid while fixes of this kind are a small share of 🟡 fixes, so the extra round stays cheap.
2026-11-25, lilleman through todo item 540. Serves goals 1.1 and 1.4. The 2026-10-08 entry's validity condition broke once, in one chunk. A prose reviewer flagged a doc's claim about generated output as false, the rewrite was still false, and only the outside auto-reviewer caught it, after the PR was ready. A credit sentence also left out the licence link and the notice of changes that the source's licence file lists. So a prose fix that rewrites a checkable claim, such as generated output, a number or a licence term, reruns the prose pass as its second and last round. The reviewer gets each rewritten claim and looks for a counter-example, then checks it against the source the claim names. A fix that rewords a claim without changing what it says reruns no pass. The other direction, having the reviewer test each rewrite before accepting it, needs a round that sees the rewrite anyway. Valid while a second prose round finds a false rewrite in more than a few of the chunks it runs in.
## review: a comment is prose in any file; a branch changing only Markdown no agent follows runs only the prose pass and, for README or docs an outside reader lands on, the product-owner pass; plan rows a chunk files from a finding, re-scores or moves get no review
2026-10-29, lilleman. Serves goals 1.4 and 1.5. One project's chunk on 2026-10-29 changed a README paragraph, `todo.md` and three lines of `gate.yml`, and the principles, security and stability passes all ran on it, each twice: 6 of the chunk's 10 rounds. A change to config is one that changes what runs, so a comment in it fires only the prose pass, as a comment in code already did. A branch that changes only Markdown no agent follows changes no code, config or tests, so no pass that reads those runs on it. A plan row a chunk files from a finding, re-scores or moves is read by the chunk that ships it, so reviewing it at filing reviewed it twice: that chunk spent a prose round of 4 minutes on its plan change. Markdown an agent follows, such as a skill, is config, since a change there changes what agents do. Valid while defects in prose-only chunks stay rare in later chunks' fixes.
-14
View File
@@ -3587,17 +3587,3 @@ Read most (opens and searches):
- `bin/task_bench/plant.py` 1
- `bin/task_bench/planted_mutant.py` 1
- `bin/task_bench/python_bugs.py` 1
## Reading cost, chunk ba67f0a271e0, finished 2026-11-25T22:59:03Z
77868 new input tokens before the first commit.
Read most (opens and searches):
- `bin/task_bench/test_shipped_features.py` 5
- `bin/branch_chunks/cut.py` 4
- `README.md` 2
- `bin/task_bench/main.py` 2
- `bin/task_bench/shipped_features.py` 2
- `bin/branch_chunks/read.py` 1
- `docs/decisions.md` 1
+4 -5
View File
@@ -52,7 +52,7 @@ A pass is one kind of review, a row of the table, named by its first column. Its
| Overrides | override-reviewer | `~/.claude/bin/rule-hook overrides`, run in the chunk's worktree, prints a line no round of this pass has ruled on |
| Stability | stability-reviewer | changes code, config or tests |
| Product-owner | product-owner-reviewer | changes an external surface or contract: API routes and request/response shapes, events, webhooks, published file formats, CLI flags and exit codes, UI, error or deprecation text a consumer reads, README and docs an outside reader lands on |
| Prose | prose-reviewer | changes prose a reader reads, such as docs, comments, help or error text, or the plan's text for an item the chunk ships, splits or answers; one round, and a second after a fix for a prose finding that rewrites a claim a command or a source file can check ("Re-entry") |
| Prose | prose-reviewer | changes prose a reader reads, such as docs, comments, help or error text, or the plan's text for an item the chunk ships, splits or answers; one round |
The table's first two columns are also code: `PASS_AGENTS` in `bin/review_rules/review_passes.py`, which `bin/repo_checks/test_reviewer_launches.py` holds to the table. Change a row in both.
@@ -99,7 +99,7 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h
- **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or settled in the PR summary per "Comprehension check" → "Places", or, for the prose pass and a pass at its cap, fixed. A stability pass whose round's fixes skip the next round per "Re-entry" → "Mechanical answers" is done once that rule's run is clean. Resolve that round's 🟢s and ❓s per "Findings" too.
- **Cap.** A pass takes at most two rounds per chunk, and the release review's architecture and principles passes five; don't ask the user for more. Answer its last round's findings per "Findings": those fixes merge once the gate passes, unreviewed by that pass. rule-hook's `round-cap` refuses a round commit that would take a pass past its cap, and no override waives it. A review the auto-reviewer posts after its second isn't a round: fix none of it and rerun no pass for it, but file a security finding it raises per `~/.claude/CLAUDE.md` → "Working loop", and any other 🔴 in `todo.md`.
**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢 or a ❓ doesn't rerun any pass, whatever it changes. A fix for a 🟡 of a pass other than prose meets only the 🟡 row below, and a fix for a prose finding, of any severity, only the last row. A round's fixes for 🔴 findings, its 🟡 fixes that meet that row, and its prose fixes that meet the last row, re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" → "Cap").
**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢, a ❓ or a prose finding doesn't rerun any pass, whatever it changes. A fix for a 🟡 meets only the 🟡 row below. A round's fixes for 🔴 findings, and its 🟡 fixes that meet that row, re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" → "Cap").
| The fix | Reruns |
|---------|--------|
@@ -110,9 +110,8 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h
| opens an untrusted-input boundary or touches authn/authz, secrets or crypto | Security, unless the full scan reruns on it |
| made rule-hook log an override | Overrides |
| changes behaviour: what the code or its tests do | Stability |
| answers a prose finding by rewriting what a claim says, where a command or a source file can check the claim, such as what generated output holds, a number or a licence term; rewording that keeps what it says doesn't count | Prose, as its second and last round |
A fix meets every row it fits, except the two fixes named above, each of which meets only its one row. Such a fix meets no row once §2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"); a skipped test kills no mutant. A comment or doc edit inside a fix for another pass's finding doesn't rerun any pass. Example: a fix for a stability 🔴 that changes code and a comment reruns Principles and Stability.
A fix meets every row it fits, except that a fix for a 🟡 meets only the 🟡 row. Such a fix meets no row once §2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"); a skipped test kills no mutant. Prose has no row, so a comment or doc edit inside a fix doesn't rerun any pass. Example: a fix for a stability 🔴 that changes code and a comment reruns Principles and Stability.
**Mechanical answers.** A stability round's fixes may skip the next stability round. That holds where the round reported a 🔴, and each of its 🔴 and 🟡 findings asked only that a named mutant be killed or a named failing test pass. Run §2's tests and mutation command on the fixes, and fix again per §2 until they leave no failing test and no surviving mutant that changes behaviour. Each named failing test must pass as the round found it, not edited or deleted. Then the stability pass doesn't run again, and the round's answer commit title ends `; tests and mutants clean at <commit>`. The fixes still rerun each other pass whose row they meet. Where the run can't be made clean, or a fix edits a named failing test, the stability pass runs again as the table says.
@@ -208,7 +207,7 @@ Launch the reviewer with the change — stability-reviewer also with the places
### Prose
Launch prose-reviewer with what the diff touched and every section this review cited — a reviewer's finding, your decline or the implementer's decision quoted it — each with the code it governs, and say whether the chunk is a release review. In round 2, hand it each claim that round 1's fixes rewrote, with the source the claim names, such as a licence file. Fix what the chunk touched. A finding on a cited section the chunk did not touch, or on any other prose file, is outside the chunk. A split or index bigger than the chunk is filed as a `todo.md` item naming the section and how long a reader searches it.
Launch prose-reviewer with what the diff touched and every section this review cited — a reviewer's finding, your decline or the implementer's decision quoted it — each with the code it governs, and say whether the chunk is a release review. Fix what the chunk touched. A finding on a cited section the chunk did not touch, or on any other prose file, is outside the chunk. A split or index bigger than the chunk is filed as a `todo.md` item naming the section and how long a reader searches it.
## 4. Gate
+10 -19
View File
@@ -6,13 +6,13 @@
`Bar = 0.1`
`Next ID = 542`
`Next ID = 539`
## Items
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 539 | 0.16.0 | | defect | **Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find.** | 1 | 2 | 3 | 4 | 2 | 1.5 by 3 | 1.1 |
| 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 |
| 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 |
| 532 | 0.16.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a Rust test that stands in the file of the code it tests.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 |
| 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 |
@@ -23,7 +23,6 @@
| 523 | 0.17.0 | | | **Make the security pass and stability-reviewer check that a new secret's docs name its scope and its reach, such as the other repositories its account can use.** | 1 | 1 | 2 | 2 | 1 | 1.1 by 2 | 0.9 |
| 537 | 0.17.0 | | | **Flag regexes that use `$` to validate a whole input, since `$` also matches before a final newline.** | 1 | 2 | 2 | 3 | 1 | 1.1 by 2 | 0.9 |
| 538 | 0.17.0 | | | **Flag validation that checks a value other than the one the code goes on to use, such as before trimming, stripping or converting it.** | 1 | 2 | 2 | 3 | 1 | 1.1 by 2 | 0.9 |
| 541 | 0.17.0 | | | **Find a Gitea pull request by its branch and head however many pull requests are newer, so `chunk-pr clean`, `chunk-pr merge` and `chunk-preflight` see an older one.** | 2 | 2 | 3 | 5 | 2 | 1 by 2 | 0.8 |
| 480 | 0.18.0 | | owner | **Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 3, code health by 3 | 2.4 |
| 481 | 0.18.0 | 480 | owner | **Put the release's tools on `PATH` for every session the loop starts and every hook it runs, name them bare in the prose in place of `~/.claude/bin/<tool>`, and refuse the old spelling in new prose.** | 3 | 2 | 3 | 6 | 6 | 1.4 by 2, code health by 2 | 1.6 |
| 482 | 0.19.0 | 478, 481 | owner | **Install the setup with `uv tool install` from a release tag, with `do-release` and `do-epic` on `PATH`, and replace `deploy-release` with `do-release self-update`.** | 3 | 2 | 3 | 6 | 7 | 1.6 by 4, 1.3 by 3 | 1.3 |
@@ -113,15 +112,18 @@
## Details
### 539. Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find.
### 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 `session_open` in `bin/claude_code/session.py` counts a session as open wherever its `<session id>.jsonl` exists. On 2026-11-24 a run left item-532's transcript as a 0-byte file, with an archive folder whose transcript and outcomes were empty too. On 2026-11-25 every rerun of item-532 called `claude --resume <id>`. Each got "No conversation found with session ID …" and exited 1. The window stopped after three failures and waited for the human, who had to move the file away by hand.
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.
Count an empty transcript as no session. Before the worker starts that session with `--session-id`, remove the empty file, so claude doesn't refuse the id. Leave a non-empty transcript to resume as today. The worker's start, in `bin/agent_cycle/run.py` → `worker_start`, and a chunk's start, in `bin/loop_claude/loop/chunk_start.py`, both read `session_open`, so the fix holds for both.
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/claude_code/session.py`: `session_open` (small)
- `bin/claude_code/test_claude_code.py`
- `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)
### 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.
@@ -213,17 +215,6 @@ An outside human reviewer found input validation that checked the value the clie
Touches:
- `agents/stability-reviewer.md`: `### 5. Edge Cases & Input Validation` (small)
### 541. Find a Gitea pull request by its branch and head however many pull requests are newer, so `chunk-pr clean`, `chunk-pr merge` and `chunk-preflight` see an older one.
Today `pull_at` in `bin/forge/pulls.py` reads only Gitea's first page of 50 pull requests, open or closed, and looks for the branch among them. A pull request with 50 newer ones in that state is missed. PR #652 here merged after 50+ newer PRs had closed, and `chunk-pr clean` then said "no merged pull request from filing-prose-reentry", leaving the worktree and branch to remove by hand. The same lookup serves `open_pull`, so `ready` and `merge` miss an old open one too, and `chunk-preflight` misses a merged chunk's worktree.
Look the pull request up so its age doesn't matter: page through the list until one matches or a page comes back short, or ask Gitea by base and head (`GET /repos/{owner}/{repo}/pulls/{base}/{head}`) where its version answers that call. Keep matching on the head's label, since Gitea reports a deleted branch's ref as `refs/pull/<N>/head`. Test it with a fake forge holding more than 50 newer pull requests.
Touches:
- `bin/forge/pulls.py`: `pull_at`
- `bin/forge/test_forge.py`
### 480. Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.
Part of the standalone-install plan lilleman approved on 2026-11-20. `do-release` and `do-epic` stand for the names item 478 picks. Today about 160 references in some 40 modules name `~/.claude`; `bin/loop_state/paths.py` holds a few. This item changes no behaviour.