Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb9ca7757b | |||
| 001dfcfc85 | |||
| eb2c54ec94 | |||
| b1becdc866 | |||
| 86edf81d28 | |||
| 4a4a8526af | |||
| 2d6275295e | |||
| 49d93e8dab | |||
| d24782eb8d | |||
| 7ea4b415d4 | |||
| 6ca674ccb5 | |||
| 60ac3a8116 |
@@ -2,6 +2,7 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- larv-review's claimed-output step runs each claim in a fresh clone, without the ignored files earlier runs wrote, and checks claims about what a command writes.
|
||||
- stability-reviewer now flags a regex that validates a whole input with `$`, which also matches before a final newline.
|
||||
- stability-reviewer checks that a guard on whether a file, row or record exists looks at every place the thing passes through.
|
||||
- stability-reviewer checks that a validation rule holds for the value the code uses after it trims, strips or converts the input.
|
||||
|
||||
@@ -45,7 +45,7 @@ Before anything else, **read the technical principles** in the folder your promp
|
||||
|
||||
6. **Assess reasonableness of usage paths**: Are there paths that exist but no real persona would use?
|
||||
|
||||
7. **Check each claim about output against its run.** A changed doc line that says what a command, flag or error prints is true only if the real output says so. Where your prompt has a `Claimed output:` line, that file holds each such claim's command and real output. Report a claim the output doesn't bear out, such as an error said to name the fix that doesn't, and name the missing words. Never settle one by reading code. A claim marked `not run`, or one you find that the prompt doesn't hand you a run of, is a ❓ naming the command that would run it.
|
||||
7. **Check each claim about output against its run.** A changed doc line that says what a command, flag or error prints, or what a command writes, is true only if the real output or the written file says so. Where your prompt has a `Claimed output:` line, that file holds each such claim's command and real output, or the lines it wrote. Report a claim the output or the written lines don't bear out, such as an error said to name the fix that doesn't, and name the missing words. Never settle one by reading code. A claim marked `not run`, or one you find that the prompt doesn't hand you a run of, is a ❓ naming the command that would run it.
|
||||
|
||||
## Your Output Format
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ Also report a list whose order carries no meaning and is not sorted (the technic
|
||||
|
||||
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.
|
||||
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 or writes. 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
-3
@@ -42,8 +42,10 @@ No model judges anything: the bench runs programs, and reads Haiku's own stream.
|
||||
inline `#[cfg(test)]` module stands as the planted file has it, and the rest is as Haiku left it. Where the planted file has such
|
||||
modules and Haiku's file lacks one of them, or its modules cannot be told apart, the planted file stands whole; where the planted
|
||||
file has none, or its modules cannot be told apart, Haiku's stands. A Rust mutant whose file's modules cannot be told apart, as where two share a name or a brace, string or comment
|
||||
is never closed, is passed over. A Rust test in a file of its own, as `#[cfg(test)] mod tests;` names, counts, since the bench
|
||||
tells no such file from code.
|
||||
is never closed, is passed over. A Rust file that a `#[cfg(test)] mod name;` in another file of the planted tree names, as
|
||||
`src/name.rs` or `src/name/mod.rs` beside a `lib.rs`, `main.rs` or `mod.rs`, or in the folder of any other file's name, is a
|
||||
test: it stands as the planted tree has it, and no mutant is planted in it. A Rust mutant in a tree where such a declaration
|
||||
names no file there, as one that `#[path]` moves does, is passed over.
|
||||
|
||||
--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
|
||||
@@ -200,7 +202,7 @@ from task_bench.tasks import Asked, Bench, BUG, check_made, committed, DATA_SOUR
|
||||
from task_bench.bugs.planted_mutant import bug_at_sides, Mutant
|
||||
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
|
||||
from task_bench.runs import closed, Containers, docker_cli, fix_attempted, MEMORY_MIB, opened, ran_tests, rust_test_files, TimedOut, TOKEN, WORK
|
||||
from task_bench.figures.digest import counted, digest, Run, TaskRuns
|
||||
from machine_load.slots import CPUS_PER_SLOT
|
||||
from git_cli.git_repo import default_ref, Git, top
|
||||
@@ -588,6 +590,13 @@ def planted(bench: Bench, number: int, mutant: Mutant) -> Task | Failure | 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
|
||||
# ... and a Rust test in a file of its own, which it can only keep where it finds each such file.
|
||||
if mutant.path.endswith(".rs"):
|
||||
standing = on_disk(f"find the Rust test files beside {mutant.path}", lambda: [rust_test_files(tree) for tree in bench.trees.values()])
|
||||
if isinstance(standing, Failure):
|
||||
return standing
|
||||
if any(tests is None or mutant.path in tests for tests in standing):
|
||||
return None
|
||||
trees: dict[Side, str] = {}
|
||||
messages: dict[Side, str] = {}
|
||||
for side, changed in bugs.items():
|
||||
|
||||
+30
-6
@@ -8,11 +8,11 @@ import shutil
|
||||
import subprocess
|
||||
import typing
|
||||
|
||||
from task_bench.rust_test_modules import declared, homes, with_tests_of
|
||||
from mutate_changes.tool_process import failed, Ran
|
||||
from failure import Failure
|
||||
from mutate_changes.changed_lines import is_test
|
||||
from task_bench.api_proxy import PORT
|
||||
from task_bench.rust_test_modules import with_tests_of
|
||||
|
||||
MODEL = "claude-haiku-5-5"
|
||||
# Where each run's container mounts its copy of the code, and its home folder: the paths in a run's stream start there.
|
||||
@@ -168,19 +168,21 @@ def checked_tree(planted: str, copy: str, into: str, rust_tests_planted: bool =
|
||||
"""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. Where rust_tests_planted, a Rust file's inline `#[cfg(test)]`
|
||||
modules stand as the planted file has them too, as `with_tests_of` says.
|
||||
modules stand as the planted file has them too, as `with_tests_of` says, and so does each Rust file that `rust_test_files` finds.
|
||||
|
||||
Raises OSError where a file cannot be copied."""
|
||||
shutil.copytree(planted, into, symlinks=True)
|
||||
# `rust_test_files` is None for a tree whose declarations it cannot resolve, which the bench passes over where it plants the bug.
|
||||
rust_tests = (rust_test_files(planted) or set()) if rust_tests_planted else set()
|
||||
before, after = set(entries(planted)), set(entries(copy))
|
||||
for path in before - after:
|
||||
if not of_tests(path):
|
||||
if not of_tests(path, rust_tests):
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
os.unlink(os.path.join(into, path))
|
||||
for path in sorted(after):
|
||||
target = os.path.join(into, path)
|
||||
# A link is copied as a link, never followed; and one that would stand in for a folder of the planted tree is left out.
|
||||
if of_tests(path) or (os.path.isdir(target) and not os.path.islink(target)):
|
||||
if of_tests(path, rust_tests) or (os.path.isdir(target) and not os.path.islink(target)):
|
||||
continue
|
||||
os.makedirs(os.path.dirname(target), exist_ok=True)
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
@@ -201,8 +203,30 @@ def keep_rust_tests(planted_file: str, target: str) -> None:
|
||||
pathlib.Path(target).write_bytes(with_tests_of(planted, pathlib.Path(target).read_bytes()))
|
||||
|
||||
|
||||
def of_tests(path: str) -> bool:
|
||||
return is_test(path) or "testdata" in pathlib.PurePath(path).parts
|
||||
def of_tests(path: str, rust_tests: typing.AbstractSet[str] = frozenset()) -> bool:
|
||||
"""Whether path is a test by its path alone, or one of rust_tests."""
|
||||
return is_test(path) or "testdata" in pathlib.PurePath(path).parts or path in rust_tests
|
||||
|
||||
|
||||
def rust_test_files(tree: str) -> set[str] | None:
|
||||
"""The Rust files under tree that a `#[cfg(test)] mod name;` declaration names, by their paths from tree. None where a
|
||||
declaration names no file there, or `declared` cannot tell a file's declarations.
|
||||
|
||||
Raises OSError where a file cannot be read."""
|
||||
files = set(entries(tree))
|
||||
found = set()
|
||||
for path in sorted(files):
|
||||
if not path.endswith(".rs") or os.path.islink(os.path.join(tree, path)):
|
||||
continue
|
||||
names = declared(pathlib.Path(tree, path).read_bytes())
|
||||
if names is None:
|
||||
return None
|
||||
for name in names:
|
||||
standing = [home for home in homes(path, name) if home in files]
|
||||
if not standing:
|
||||
return None
|
||||
found.add(standing[0])
|
||||
return found
|
||||
|
||||
|
||||
def entries(top: str) -> list[str]:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""The `#[cfg(test)]` modules of a Rust file, which stand in the file of the code they test. Here are where each is, and a file with
|
||||
the modules of another file put in place of its own. A file is bytes: a Rust file is UTF-8, and a module is found by ASCII text alone."""
|
||||
"""The `#[cfg(test)]` modules of a Rust file, which stand in the file of the code they test or, as `mod name;` declares, in a file of
|
||||
their own. Here are where each inline one is, which files hold the others, and a file with the modules of another file put in place
|
||||
of its own. A file is bytes: a Rust file is UTF-8, and a module is found by ASCII text alone."""
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
# What the scan steps over or stops at. A string, a char and a comment may hold a brace.
|
||||
@@ -17,6 +19,10 @@ STRING_BODY = re.compile(rb'(?:[^"\\]|\\.)*"', re.DOTALL)
|
||||
COMMENT_EDGE = re.compile(rb"/\*|\*/")
|
||||
# What follows the attribute that starts an inline module: any other attributes, an optional visibility, then `mod name {`.
|
||||
MODULE = re.compile(rb"\s*(?:#\[[^\]]*\]\s*)*(?:pub(?:\([^)]*\))?\s+)?mod\s+(?P<name>\w+)\s*\{")
|
||||
# What follows the attribute that starts a module kept in a file of its own: any other attributes, an optional visibility, then `mod name;`.
|
||||
DECLARATION = re.compile(rb"\s*(?P<attributes>(?:#\[[^\]]*\]\s*)*)(?:pub(?:\([^)]*\))?\s+)?mod\s+(?P<name>\w+)\s*;")
|
||||
PATH_ATTRIBUTE = re.compile(rb"#\[\s*path\b")
|
||||
KEEP_BESIDE = ("lib.rs", "main.rs", "mod.rs")
|
||||
|
||||
|
||||
def tells_apart(path: str, source: bytes) -> bool:
|
||||
@@ -32,16 +38,13 @@ def modules(source: bytes) -> dict[bytes, tuple[int, int]] | None:
|
||||
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"{":
|
||||
position = 0
|
||||
while match := SCAN.search(source, position):
|
||||
token = match.group()
|
||||
if (after := after_token(source, match)) is None:
|
||||
return None
|
||||
position = after
|
||||
if token == b"{":
|
||||
depth += 1
|
||||
elif token == b"}":
|
||||
depth -= 1
|
||||
@@ -52,7 +55,42 @@ def modules(source: bytes) -> dict[bytes, tuple[int, int]] | 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
|
||||
return found if depth == 0 and inside is None else None
|
||||
|
||||
|
||||
def declared(source: bytes) -> list[str] | None:
|
||||
"""The name of each `#[cfg(test)] mod name;` of source, a test module kept in a file of its own, in the order they stand.
|
||||
None where a `#[path]` attribute moves such a file, or a string or comment is never closed."""
|
||||
names = []
|
||||
position = 0
|
||||
while match := SCAN.search(source, position):
|
||||
if (after := after_token(source, match)) is None:
|
||||
return None
|
||||
position = after
|
||||
if match.group() == b"#[cfg(test)]" and (declaration := DECLARATION.match(source, position)):
|
||||
if PATH_ATTRIBUTE.search(declaration.group("attributes")):
|
||||
return None
|
||||
names.append(declaration.group("name").decode())
|
||||
return names
|
||||
|
||||
|
||||
def homes(path: str, name: str) -> list[str]:
|
||||
"""Where the file of the module `name`, declared in the Rust file at path, may stand, by its path from the same top. A crate root
|
||||
(`lib.rs`, `main.rs`) and a `mod.rs` keep their modules beside them; any other file keeps them in a folder of its own name."""
|
||||
declaring = pathlib.PurePosixPath(path)
|
||||
folder = declaring.parent if declaring.name in KEEP_BESIDE else declaring.parent / declaring.stem
|
||||
return [str(folder / f"{name}.rs"), str(folder / name / "mod.rs")]
|
||||
|
||||
|
||||
def after_token(source: bytes, match: re.Match[bytes]) -> int | None:
|
||||
"""The offset after match, or after the comment, string or raw string that match opens; None where that is never closed."""
|
||||
if match.group() == b"/*":
|
||||
return after_comment(source, match.end())
|
||||
if match.group() == b'"':
|
||||
return after_string(source, match.end())
|
||||
if match.group("hashes") is not None:
|
||||
return after_raw_string(source, match.end(), match.group("hashes"))
|
||||
return match.end()
|
||||
|
||||
|
||||
def after_comment(source: bytes, position: int) -> int | None:
|
||||
|
||||
@@ -103,6 +103,30 @@ class ModulesTest(unittest.TestCase):
|
||||
self.assertIsNone(modules(source))
|
||||
|
||||
|
||||
def declared(source: str) -> list[str] | None:
|
||||
return rust_test_modules.declared(source.encode())
|
||||
|
||||
|
||||
class DeclaredTest(unittest.TestCase):
|
||||
def test_lists_each_test_module_the_file_declares_without_a_body(self):
|
||||
self.assertEqual(declared("#[cfg(test)]\nmod tests;\n#[cfg(test)]\n#[allow(dead_code)]\npub(crate) mod checks;\n"), ["tests", "checks"])
|
||||
|
||||
def test_leaves_out_an_inline_module_and_a_declaration_that_is_no_test_module(self):
|
||||
self.assertEqual(declared(LIB + "mod util;\n#[cfg(feature = \"x\")]\nmod extra;\n"), [])
|
||||
|
||||
def test_leaves_out_a_declaration_in_a_comment_or_a_string(self):
|
||||
source = '// #[cfg(test)]\n// mod a;\n/* #[cfg(test)] mod b; */\nconst C: &str = "#[cfg(test)] mod c;";\nconst D: &str = r#"#[cfg(test)] mod d;"#;\n'
|
||||
self.assertEqual(declared(source), [])
|
||||
|
||||
def test_cannot_tell_where_a_declaration_moves_its_file_with_a_path_attribute(self):
|
||||
self.assertIsNone(declared('#[cfg(test)]\n#[path = "elsewhere.rs"]\nmod tests;\n'))
|
||||
|
||||
def test_cannot_tell_where_a_string_or_comment_is_never_closed(self):
|
||||
for source in ("#[cfg(test)]\nmod tests;\nconst A: &str = \"\n", "/* open\n#[cfg(test)]\nmod tests;\n"):
|
||||
with self.subTest(source=source):
|
||||
self.assertIsNone(declared(source))
|
||||
|
||||
|
||||
class TellsApartTest(unittest.TestCase):
|
||||
def test_tells_the_modules_of_a_rust_file_apart_where_they_can_be(self):
|
||||
self.assertEqual([tells_apart("lib.rs", b"fn a() {}"), tells_apart("lib.rs", b"fn a() {")], [True, False])
|
||||
|
||||
@@ -17,7 +17,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from task_bench import api_proxy, bench_folder, main, runs
|
||||
from test_env import assert_not_root, isolated_env
|
||||
from task_bench.runs import checked_tree, closed, Containers, docker_cli, fix_attempted, opened, ran_tests, TimedOut
|
||||
from task_bench.runs import checked_tree, closed, Containers, docker_cli, fix_attempted, opened, ran_tests, rust_test_files, TimedOut
|
||||
from task_bench.bugs.plant import drawn
|
||||
from claude_code.entries import Entry, entry_from
|
||||
from failure import Failure
|
||||
@@ -613,6 +613,34 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
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))
|
||||
|
||||
def rust_bench(self, files: dict[str, str], *runs: Ran | Failure) -> main.Bench:
|
||||
for path, text in files.items():
|
||||
(self.tree / path).parent.mkdir(parents=True, exist_ok=True)
|
||||
(self.tree / path).write_text(text)
|
||||
return self.bench(*runs)
|
||||
|
||||
ADD = "pub fn add(a: i32, b: i32) -> i32 {\n a + b\n}\n#[cfg(test)]\nmod tests;\n"
|
||||
ADDING = Mutant("src/lib.rs", 2, "src/lib.rs:2:7 replace + with -", (b" a + b",), (b" a - b",))
|
||||
|
||||
def test_a_rust_mutant_in_a_test_file_of_its_own_is_passed_over(self):
|
||||
bench = self.rust_bench({"src/lib.rs": self.ADD, "src/tests.rs": "fn t() { assert!(1 + 1 == 2); }\n"})
|
||||
mutant = Mutant("src/tests.rs", 1, "src/tests.rs:1:20 replace + with -", (b"fn t() { assert!(1 + 1 == 2); }",), (b"fn t() { assert!(1 - 1 == 2); }",))
|
||||
self.assertIsNone(main.planted(bench, 1, mutant))
|
||||
|
||||
def test_a_rust_mutant_in_a_tree_whose_declared_test_file_is_not_found_is_passed_over(self):
|
||||
self.assertIsNone(main.planted(self.rust_bench({"src/lib.rs": self.ADD}), 1, self.ADDING))
|
||||
|
||||
def test_a_rust_mutant_in_code_beside_a_test_file_goes_on_to_the_tests(self):
|
||||
broke = Failure("docker could not start: No such file or directory")
|
||||
self.assertEqual(main.planted(self.rust_bench({"src/lib.rs": self.ADD, "src/tests.rs": ""}, broke), 1, self.ADDING), broke)
|
||||
|
||||
def test_a_rust_mutant_in_a_tree_whose_rust_file_cannot_be_read_fails_the_bench_naming_the_file(self):
|
||||
assert_not_root(self)
|
||||
bench = self.rust_bench({"src/lib.rs": self.ADD, "src/tests.rs": "", "src/other.rs": ""})
|
||||
(self.tree / "src/other.rs").chmod(0)
|
||||
self.addCleanup((self.tree / "src/other.rs").chmod, 0o644)
|
||||
self.assertFailsWith(main.planted(bench, 1, self.ADDING), "could not find the Rust test files beside src/lib.rs: ")
|
||||
|
||||
|
||||
class ContainersTest(unittest.TestCase):
|
||||
IN_TREE = ["--memory", "512m", "--memory-swap", "512m", "--user", "1000:1000", "--env", "HOME=/tmp", "--volume", "/tree:/work", "--workdir", "/work"]
|
||||
@@ -772,6 +800,60 @@ class CheckedTreeTest(unittest.TestCase):
|
||||
checked_tree(planted, copy, str(self.root / "check"))
|
||||
self.assertEqual(self.held("check")["src/new.rs"], added)
|
||||
|
||||
DECLARING = "fn a() { 1 }\n#[cfg(test)]\nmod tests;\n"
|
||||
|
||||
def test_takes_a_rust_test_in_a_file_of_its_own_as_planted_and_the_rest_as_fixed(self):
|
||||
planted = self.tree("planted", {"src/lib.rs": self.DECLARING, "src/tests.rs": "old tests", "src/other.rs": "bug"})
|
||||
copy = self.tree("copy", {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests;\n", "src/tests.rs": "rewritten", "src/other.rs": "fixed"})
|
||||
checked_tree(planted, copy, str(self.root / "check"))
|
||||
self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests;\n", "src/tests.rs": "old tests", "src/other.rs": "fixed"})
|
||||
|
||||
def test_takes_a_rust_test_file_the_fix_deleted_as_planted(self):
|
||||
planted = self.tree("planted", {"src/lib.rs": self.DECLARING, "src/tests.rs": "old tests"})
|
||||
copy = self.tree("copy", {"src/lib.rs": "fn a() { 2 }\n#[cfg(test)]\nmod tests;\n"})
|
||||
checked_tree(planted, copy, str(self.root / "check"))
|
||||
self.assertEqual(self.held("check")["src/tests.rs"], "old tests")
|
||||
|
||||
def test_takes_a_rust_test_file_the_fix_added_as_fixed_since_the_planted_tree_declares_none(self):
|
||||
planted = self.tree("planted", {"src/lib.rs": "fn a() { 1 }\n"})
|
||||
copy = self.tree("copy", {"src/lib.rs": "fn a() { 2 }\n", "src/tests.rs": "mine"})
|
||||
checked_tree(planted, copy, str(self.root / "check"))
|
||||
self.assertEqual(self.held("check")["src/tests.rs"], "mine")
|
||||
|
||||
def test_a_task_with_acceptance_tests_takes_a_rust_test_file_as_fixed(self):
|
||||
planted = self.tree("planted", {"src/lib.rs": self.DECLARING, "src/tests.rs": "old tests"})
|
||||
copy = self.tree("copy", {"src/lib.rs": self.DECLARING, "src/tests.rs": "new tests"})
|
||||
checked_tree(planted, copy, str(self.root / "check"), rust_tests_planted=False)
|
||||
self.assertEqual(self.held("check")["src/tests.rs"], "new tests")
|
||||
|
||||
def test_finds_a_rust_test_file_where_the_module_system_puts_it(self):
|
||||
cases = {
|
||||
"beside a crate root": ({"src/lib.rs": self.DECLARING, "src/tests.rs": ""}, {"src/tests.rs"}),
|
||||
"as a folder with a mod.rs": ({"src/main.rs": self.DECLARING, "src/tests/mod.rs": ""}, {"src/tests/mod.rs"}),
|
||||
"in the folder of a module file": ({"src/pick.rs": self.DECLARING, "src/pick/tests.rs": ""}, {"src/pick/tests.rs"}),
|
||||
"beside a mod.rs": ({"src/pick/mod.rs": self.DECLARING, "src/pick/tests.rs": ""}, {"src/pick/tests.rs"}),
|
||||
"declared by no file": ({"src/lib.rs": "fn a() {}\n", "src/tests.rs": ""}, set()),
|
||||
}
|
||||
for name, (files, found) in cases.items():
|
||||
with self.subTest(name):
|
||||
self.assertEqual(rust_test_files(self.tree(name.replace(" ", "-"), files)), found)
|
||||
|
||||
def test_leaves_a_rust_link_unread_whatever_it_points_at_when_it_looks_for_test_files(self):
|
||||
tree = self.tree("linked", {"src/lib.rs": self.DECLARING, "src/tests.rs": ""})
|
||||
os.symlink("missing.rs", os.path.join(tree, "src/ghost.rs"))
|
||||
self.assertEqual(rust_test_files(tree), {"src/tests.rs"})
|
||||
|
||||
def test_cannot_find_a_rust_test_file_that_is_not_where_its_declaration_puts_it_or_cannot_be_read_from_it(self):
|
||||
cases = {
|
||||
"missing": {"src/lib.rs": self.DECLARING},
|
||||
"beside a module file, where only a crate root has its modules": {"src/pick.rs": self.DECLARING, "src/tests.rs": ""},
|
||||
"moved by a path attribute": {"src/lib.rs": '#[cfg(test)]\n#[path = "t.rs"]\nmod tests;\n', "src/t.rs": ""},
|
||||
"in a declaring file whose string is never closed": {"src/lib.rs": '#[cfg(test)]\nmod tests;\nconst A: &str = "\n', "src/tests.rs": ""},
|
||||
}
|
||||
for name, files in cases.items():
|
||||
with self.subTest(name):
|
||||
self.assertIsNone(rust_test_files(self.tree(name.replace(" ", "-"), files)))
|
||||
|
||||
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"})
|
||||
|
||||
@@ -3711,3 +3711,33 @@ Read most (opens and searches):
|
||||
- `bin/release_plan/release_standing.py` 3
|
||||
- `CHANGELOG.md` 1
|
||||
- `bin/deploy_release/cut.py` 1
|
||||
|
||||
## Reading cost, chunk 7361c9bb3e9a, finished 2026-11-27T14:31:28Z
|
||||
|
||||
48295 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `agents/stability-reviewer.md` 3
|
||||
- `README.md` 1
|
||||
- `agents/systems-architect.md` 1
|
||||
- `skills/larv-review/SKILL.md` 1
|
||||
|
||||
## Reading cost, chunk 73ef8355db51, finished 2026-11-27T14:52:23Z
|
||||
|
||||
61386 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `agents/stability-reviewer.md` 3
|
||||
- `skills/larv-review/SKILL.md` 2
|
||||
|
||||
## Reading cost, chunk bca62e26ca73, finished 2026-11-27T15:01:02Z
|
||||
|
||||
56538 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `skills/larv-review/SKILL.md` 2
|
||||
- `agents/product-owner-reviewer.md` 1
|
||||
- `agents/prose-reviewer.md` 1
|
||||
|
||||
@@ -74,10 +74,12 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h
|
||||
|
||||
**Reports.** Run `~/.claude/bin/larv-review reviewer-header <pass>` in the chunk's worktree, and open each prompt to an agent under `~/.claude/agents/` with what it prints; then say in a few lines what the change does and which files it touches. The command makes the chunk's review folder and writes the branch diff and the plan's listing into it. The header names that diff, the reviewer's full report, `<pass>-round-<n>.md`, in the folder, the folders of technical principles and review standards the project's config sets, the files of coding conventions where it lists any, the listing, and for architecture and stability the places too. For a reviewer whose definition starts it without `CLAUDE.md`, the header's last line names the file that holds the project principles and decision titles, which the reviewer reads first. For a relaunch one rung up, add `--rerun`: the report becomes `<pass>-round-<n>-rerun.md`, and the header names the report that asked. Before you answer a 🔴 or 🟡, read its entry: Grep the report for the finding's place, with the lines after it, rather than Read the whole report. rule-hook refuses a reviewer's Edit and MultiEdit, and any Write outside `~/.local/state/larv-review/`. Keep the folder after the merge: `review-replay` replays a round from the reports its prompt names, and `compress-archives` gzips each file 30 days after it last changed.
|
||||
|
||||
**Claimed output.** Before the Product-owner or Prose pass launches in a round, find the lines the diff adds or changes that say what a command, flag or error prints, such as "the error names the fix". In round 2, take only the lines the round's fixes changed. Those reviewers have no shell, and reading code can't show that an output holds the words a line claims.
|
||||
**Claimed output.** Before the Product-owner or Prose pass launches in a round, find the lines the diff adds or changes that say what a command, flag or error prints, such as "the error names the fix", or what a command writes, such as "the diff of the regenerated file holds only X". In round 2, take only the lines the round's fixes changed. Those reviewers have no shell, and reading code can't show that an output holds the words a line claims.
|
||||
|
||||
- **Run.** Run each claim's command in the chunk's worktree, the way the project runs its tools (its container setup, unless its config sets `tooling-on-host`), with the input that triggers the output the line describes, such as the input that raises the error. Run only a command that leaves every file as it was, in the worktree and outside it, and sends no data out. List any other claim as `not run: <why>`.
|
||||
- **Hand over.** Write each claim into `claimed-output-round-<n>.md` in the chunk's review folder, `<n>` the round's number: its file and line, the command, the exit code and the real output, or `not run: <why>`. Add `Claimed output: <that path>` to the prompts of the Product-owner and Prose reviewers. With no claim, write no file and add no line.
|
||||
- **Run.** Run each claim's command in a fresh clone of the chunk's worktree at its head, with every change committed: `git clone <worktree> <folder>`, the folder in the chunk's review folder. The clone lacks the ignored build and cache files that earlier runs wrote, so a command that needs one fails there, as it does in a fresh checkout. Run the command the way the project runs its tools (its container setup, unless its config sets `tooling-on-host`), with the input that triggers the output the line describes, such as the input that raises the error.
|
||||
- **Limits.** A command may change files in the clone only. Run none that changes a file elsewhere, or sends data out; list such a claim as `not run: <why>`.
|
||||
- **Writes.** Run a claim about what a command writes like one about what it prints, and compare the file it writes with the claim, such as `git diff` in the clone against the claim about the diff. Hand over the file's relevant lines or the diff.
|
||||
- **Hand over.** Write each claim into `claimed-output-round-<n>.md` in the chunk's review folder, `<n>` the round's number: its file and line, the command, the exit code and the real output (for a claim about what a command writes, the written lines or the diff), or `not run: <why>`. Add `Claimed output: <that path>` to the prompts of the Product-owner and Prose reviewers. With no claim, write no file and add no line. Then remove the clone.
|
||||
|
||||
**Precedent, then ask** — for the full scan:
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
| 542 | 0.17.0 | | | **Make chunk-preflight report a project whose code is space-indented with no `.editorconfig` or formatter setting that says so, and narrow the tabs principle to explicit overrides.** | 2 | 2 | 3 | 5 | 4 | 1.1 by 4 | 1.2 |
|
||||
| 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 |
|
||||
| 547 | 0.17.0 | | | **Add a technical principle: tell a failure's cause from a status code or a typed error, never from a tool's message text unless the tool documents that text as unique to the cause.** | 1 | 2 | 2 | 3 | 1 | 1.1 by 2 | 0.9 |
|
||||
| 549 | 0.17.0 | | | **Run each claimed output from the state a fresh checkout leaves, without the ignored files earlier runs wrote, and check each claim about what a command writes.** | 1 | 1 | 2 | 2 | 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 |
|
||||
| 545 | 0.17.0 | | | **Have chunk-preflight name each next-release item with no `Touches:` list while others wait, and have loop-claude launch a subagent that writes the lists before it starts the next chunk.** | 3 | 2 | 3 | 6 | 6 | 1.1 by 4 | 0.6 |
|
||||
| 539 | 0.17.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a Rust test kept in a file of its own.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 |
|
||||
@@ -177,20 +176,6 @@ Touches:
|
||||
|
||||
- `principles/technical-principles.md`: `Handle errors explicitly, as values — avoid the exception path.` (small)
|
||||
|
||||
### 549. Run each claimed output from the state a fresh checkout leaves, without the ignored files earlier runs wrote, and check each claim about what a command writes.
|
||||
|
||||
Found when an outside reviewer raised two findings that our review had missed:
|
||||
|
||||
- A documented local command failed on a fresh checkout. It needed a cache file that earlier writable runs had left in an ignored folder. The implementer's claimed-output runs reused that file, so the claimed-output step showed the command working.
|
||||
- A README sentence said what a regenerated file's diff holds. The claim was about the file the command writes, not what it prints, so the step never ran it, and the sentence was wrong.
|
||||
|
||||
Change `larv-review` §3 → "Claimed output" so that:
|
||||
- each claim runs from a state like a fresh checkout's, with the ignored build and cache files that earlier runs wrote moved aside;
|
||||
- a claim about what a command writes, such as a file or a diff, is run like a claim about what it prints.
|
||||
|
||||
Touches:
|
||||
- `skills/larv-review/SKILL.md`: `**Claimed output.**` (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.
|
||||
|
||||
Reference in New Issue
Block a user