Answer prose round 1: 0 🔴, 12 🟡 (0 misread); keep a {} line as an entry, point handed_on and parked_through at the docstrings that hold their rules, split news_after's two kinds of news, say what each parameter is, reword item 517's way out, and report a .tar left behind as its own failure
This commit is contained in:
@@ -30,7 +30,7 @@ class Figures:
|
||||
|
||||
class Result(typing.NamedTuple):
|
||||
"""One run of a task at a side. figures is None where its claude ended without a result, as when it ran out of time. entries
|
||||
holds what its stream tells, for the digest."""
|
||||
holds the entries of its stream, which the digest quotes."""
|
||||
|
||||
task: int
|
||||
side: Side
|
||||
@@ -63,7 +63,7 @@ HEADINGS = ["Bug", "Side", "Passed", *(column.heading for column in COLUMNS)]
|
||||
|
||||
|
||||
def figures(events: list[dict], bug_file: str) -> Figures | None | Failure:
|
||||
"""The figures of the run whose claude printed events, its stream's JSON lines, with bug_file the bug's file as the run's
|
||||
"""The figures of the run whose claude printed events, the objects parsed from its stream's lines, with bug_file the bug's file as the run's
|
||||
container names it.
|
||||
|
||||
None where the stream holds no result. A Failure where the API refused the run, as on a token it doesn't take: such a run
|
||||
|
||||
@@ -61,7 +61,7 @@ Each bench empties its own folder first, and removes the folder every earlier be
|
||||
not, unless a bench or a gather is using it. So gather a bench before the next one starts.
|
||||
|
||||
Exit 1, saying why, on an unknown or repeated argument, a missing --image or --test, a --seed, --bugs or --runs that is no whole
|
||||
number from 1, or no token; and where git, docker or Gremlins fails, the seats' places name no Go file, the tests fail at a side
|
||||
number from 1, or no token; and where git, docker or Gremlins fails, the seats' places don't name any Go file, the tests fail at a side
|
||||
without a bug, or no mutant becomes a bug. Where the API refuses a run, the bench stops there and exits 1 too, after the table of
|
||||
the runs that finished.
|
||||
gather exits 1, saying why, outside a checkout, without a digest, where loop-claude has saved no model for the project or the
|
||||
@@ -237,7 +237,7 @@ def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[st
|
||||
trees[side] = tree
|
||||
files = [path for path in place_files(places) if pathlib.Path(trees["base"], path).is_file()]
|
||||
if not files:
|
||||
return Failure("The places the seats found hard name no Go file that the base holds, so there is nowhere to plant a bug.")
|
||||
return Failure("The places the seats found hard don't name any Go file that the base holds, so there is nowhere to plant a bug.")
|
||||
run = functools.partial(run_tool, prefix=given.get("--prefix"), env=env, killpg=os.killpg)
|
||||
mutants = killed_mutants(trees["base"], files, run, CPUS_PER_SLOT)
|
||||
if isinstance(mutants, Failure):
|
||||
@@ -274,10 +274,10 @@ def archived(commit: str, into: pathlib.Path, checkout: str, git: Git) -> str |
|
||||
try:
|
||||
with tarfile.open(archive) as held:
|
||||
held.extractall(into, filter="tar")
|
||||
archive.unlink()
|
||||
except (tarfile.TarError, OSError) as failure:
|
||||
return Failure(f"could not unpack the tree at {commit}: {failure}")
|
||||
return str(into)
|
||||
removed = on_disk(f"remove {archive}", archive.unlink)
|
||||
return removed if isinstance(removed, Failure) else str(into)
|
||||
|
||||
|
||||
def benched(bench: Bench, mutants: list[Mutant]) -> list[str] | Failure:
|
||||
@@ -300,7 +300,7 @@ def benched(bench: Bench, mutants: list[Mutant]) -> list[str] | Failure:
|
||||
|
||||
|
||||
def baseline_failure(bench: Bench) -> Failure | None:
|
||||
"""Why a side's tests don't pass without a planted bug; None where both sides' pass."""
|
||||
"""Why a side's tests don't pass without a planted bug; None where they pass at both sides."""
|
||||
for side, tree in bench.trees.items():
|
||||
ran = tests_in_copy(bench.containers, tree, bench.folder)
|
||||
if isinstance(ran, Failure) or ran.code:
|
||||
@@ -336,7 +336,7 @@ def ran_fixes(bench: Bench, tasks: list[Task], total: int) -> Fixes:
|
||||
|
||||
|
||||
def kept(bench: Bench, tasks: list[Task], names: dict[int, str], results: list[Result]) -> Failure | None:
|
||||
"""Writes results.json and the digest into the bench's folder, with names the bugs' names by number."""
|
||||
"""Writes results.json and the digest into the bench's folder. names holds each bug's name by its number."""
|
||||
in_a_tree = lambda path: any(pathlib.Path(tree, path).is_file() for tree in bench.trees.values())
|
||||
recorded_runs = json.dumps({"sides": bench.sides, "seed": bench.asked.seed, "bugs": names, "runs": [recorded(result) for result in results]}, indent="\t") + "\n"
|
||||
digest_text = digest(bench.sides, table(results, names), [digested(task, results, bench.folder) for task in tasks], in_a_tree)
|
||||
|
||||
@@ -88,8 +88,10 @@ def mutated(source: bytes, mutant: Mutant) -> bytes | None:
|
||||
|
||||
|
||||
def bug_at_sides(mutant: Mutant, diff: str, sources: dict[Side, bytes | None]) -> dict[Side, bytes] | None:
|
||||
"""The file of mutant with the bug in it, at the base and at the head, from the file at each side, None where the side has
|
||||
none, and the diff of it from base to head. None where the mutant doesn't become a bug at one side or the other.
|
||||
"""The file of mutant with the bug in it, at the base and at the head. None where the mutant doesn't become a bug at one side
|
||||
or the other.
|
||||
|
||||
sources holds the file at each side, None where the side lacks it; diff is the file's diff from base to head.
|
||||
|
||||
The bug is the same change to the same line at both sides, so only the code around it differs between them."""
|
||||
at_head = line_at_head(diff, mutant.line)
|
||||
|
||||
@@ -170,7 +170,7 @@ class BugAtSidesTest(unittest.TestCase):
|
||||
def test_a_line_the_head_changed_holds_no_bug(self):
|
||||
self.assertIsNone(bug_at_sides(self.MUTANT, "@@ -3 +3 @@\n-\treturn a + b\n+\treturn b + a\n", {"base": self.BASE, "head": self.BASE}))
|
||||
|
||||
def test_a_side_without_the_file_or_without_the_token_holds_no_bug(self):
|
||||
def test_a_side_without_the_file_or_without_the_operator_the_mutant_changes_holds_no_bug(self):
|
||||
self.assertIsNone(bug_at_sides(self.MUTANT, "", {"base": self.BASE, "head": None}))
|
||||
self.assertIsNone(bug_at_sides(self.MUTANT, "", {"base": self.BASE, "head": b"package calc\n\n\treturn sum(a, b)\n"}))
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ class BenchTest(unittest.TestCase):
|
||||
|
||||
def test_the_command_line_fails_with_the_reason_where_the_places_or_the_bench_fail(self):
|
||||
argv = [part for name, value in self.given.items() for part in (name, value)]
|
||||
for places, said in ((Failure("no history"), "no history\n"), ("- `gone.go:1` `Gone`: removed\n", "The places the seats found hard name no Go file that the base holds, so there is nowhere to plant a bug.\n")):
|
||||
for places, said in ((Failure("no history"), "no history\n"), ("- `gone.go:1` `Gone`: removed\n", "The places the seats found hard don't name any Go file that the base holds, so there is nowhere to plant a bug.\n")):
|
||||
with contextlib.redirect_stdout(io.StringIO()) as out, contextlib.redirect_stderr(io.StringIO()) as errors:
|
||||
self.assertEqual(main.main(argv, self.env, lambda home: places), 1)
|
||||
self.assertEqual((out.getvalue(), errors.getvalue().splitlines(keepends=True)[-1]), ("", said))
|
||||
@@ -302,7 +302,7 @@ class BenchTest(unittest.TestCase):
|
||||
def test_fails_where_the_places_name_no_go_file_of_the_base(self):
|
||||
with contextlib.redirect_stderr(io.StringIO()):
|
||||
found = main.bench({**self.given, "--base": "main"}, self.env, "- `gone.go:1` `Gone`: removed\n- `README.md:1` `Calc`: thin\n", self.home)
|
||||
self.assertEqual(found, Failure("The places the seats found hard name no Go file that the base holds, so there is nowhere to plant a bug."))
|
||||
self.assertEqual(found, Failure("The places the seats found hard don't name any Go file that the base holds, so there is nowhere to plant a bug."))
|
||||
self.assertFalse(self.log.exists())
|
||||
|
||||
def test_fails_where_the_tests_fail_without_a_bug(self):
|
||||
@@ -500,7 +500,7 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
task = dataclasses.replace(self.task, trees={"base": str(self.folder / "gone"), "head": str(self.tree)})
|
||||
self.assertFailsWith(main.fixed(task, "base", 1, self.containers(), self.folder), "could not copy bug 1's tree at the base: ")
|
||||
|
||||
def test_a_tree_that_checks_a_fix_that_cannot_be_made_fails_the_bench_naming_the_bug_and_side(self):
|
||||
def test_failing_to_make_the_tree_that_checks_a_fix_fails_the_bench_naming_the_bug_and_side(self):
|
||||
(self.folder / "check").mkdir()
|
||||
self.assertFailsWith(main.fixed(self.task, "base", 1, self.containers(Ran(0, "")), self.folder), "could not make the tree that checks bug 1's fix at the base: ")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user