Plant task-bench's bugs in TypeScript and PHP, from Stryker's and Infection's killed mutants
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-26 10:39:36 +01:00
parent 48270c0439
commit ffe2048b73
11 changed files with 765 additions and 24 deletions
+6 -4
View File
@@ -12,6 +12,9 @@ from git_cli.git_repo import Git
# cargo-mutants' exit codes for a run that finished: every mutant caught, some missed, and some timed out.
CARGO_FINISHED = frozenset({0, 2, 3})
CARGO_OUTCOMES = ("caught", "missed", "timeout", "unviable")
INFECTION = "vendor/bin/infection" # the project's own, as Composer installs it
# npx runs the project's own @stryker-mutator/core, else one an earlier npx run cached, and installs none.
STRYKER = ["npx", "--no", "--package=@stryker-mutator/core", "stryker", "run"]
GREMLINS_UNKILLED = frozenset({"LIVED", "NOT COVERED"})
# What Gremlins v0.6.0 needs of the diff it reads from git: one run of lines per hunk is all it mutates, so a hunk holds the changed
# lines and none around them, nor a neighbouring change; it takes each file's path after a b/; and it reads no colour codes. A user's git
@@ -118,8 +121,7 @@ def run_stryker(top: str, changed: dict[str, frozenset[int]], run: Run, jobs: in
"""For each folder Stryker runs in, a line naming it, then Stryker's own report of the mutants on the changed lines. Last, a line
naming the files with no package.json above them, if any.
Stryker runs in the nearest folder above each file that holds a package.json. npx runs the project's own @stryker-mutator/core, else
one an earlier npx run cached, and installs none."""
Stryker runs in the nearest folder above each file that holds a package.json."""
report: list[str] = []
unplaced: list[str] = []
for folder, files in sorted(by_folder(top, changed, ("package.json",)).items()):
@@ -128,7 +130,7 @@ def run_stryker(top: str, changed: dict[str, frozenset[int]], run: Run, jobs: in
unplaced = sorted(files)
continue
mutate = ",".join(f"{path}:{first}-{last}" for path, lines in sorted(files.items()) for first, last in runs(lines))
ran = run(["npx", "--no", "--package=@stryker-mutator/core", "stryker", "run", "--mutate", mutate, "--concurrency", str(jobs), "--reporters", "clear-text"], os.path.join(top, folder))
ran = run([*STRYKER, "--mutate", mutate, "--concurrency", str(jobs), "--reporters", "clear-text"], os.path.join(top, folder))
if isinstance(ran, Failure) or ran.code:
return ran if isinstance(ran, Failure) else whole_output(f"Stryker in {label(folder)}", ran)
report.extend([f"Stryker in {label(folder)}:", *ran.output.splitlines()])
@@ -137,7 +139,7 @@ def run_stryker(top: str, changed: dict[str, frozenset[int]], run: Run, jobs: in
def run_infection(top: str, base: str, run: Run, jobs: int) -> list[str] | Failure:
"""A line naming where Infection ran, top, then its own report of the mutants on the lines the branch changes since base."""
ran = run(["vendor/bin/infection", "--git-diff-lines", f"--git-diff-base={base}", f"--threads={jobs}", "--show-mutations=max", "--no-progress"], top)
ran = run([INFECTION, "--git-diff-lines", f"--git-diff-base={base}", f"--threads={jobs}", "--show-mutations=max", "--no-progress"], top)
if isinstance(ran, Failure) or ran.code:
return ran if isinstance(ran, Failure) else whole_output("Infection", ran)
return ["Infection in the checkout's top:", *ran.output.splitlines()]