Bench features in task-bench with --tasks features, from the folder the config names as bench-tasks
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-23 16:31:27 +01:00
parent 28537b5aa3
commit cdeb66bf6e
17 changed files with 735 additions and 199 deletions
+6 -6
View File
@@ -6,7 +6,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from task_bench.digest import Bug, decoys, digest, Run, trace
from task_bench.digest import decoys, digest, Run, TaskRuns, trace
from claude_code.entries import entries_of, Entry
@@ -109,7 +109,7 @@ class DigestTest(unittest.TestCase):
]
def test_holds_the_figures_and_per_bug_its_decoys_and_two_traces_picked_by_rule(self):
held = digest(SIDES, ["| Bug | Side |", "|---|---|"], [Bug("1: calc.go:4:11 ARITHMETIC_BASE", "calc.go", "Add(1, 2) = -1, want 3", self.runs())], lambda path: True)
held = digest(SIDES, ["| Bug | Side |", "|---|---|"], [TaskRuns("1: calc.go:4:11 ARITHMETIC_BASE", "calc.go", "Add(1, 2) = -1, want 3", self.runs())], lambda path: True)
self.assertEqual(held.splitlines(), [
"# task-bench digest",
"",
@@ -140,22 +140,22 @@ class DigestTest(unittest.TestCase):
])
def test_a_bug_every_run_fixed_has_no_decoys_and_one_trace(self):
held = digest(SIDES, [], [Bug("2: a.go:1:1 X", "a.go", "boom", [Run("bug-2-base-1", True, 10, reading("a.go"))])], lambda path: True)
held = digest(SIDES, [], [TaskRuns("2: a.go:1:1 X", "a.go", "boom", [Run("bug-2-base-1", True, 10, reading("a.go"))])], lambda path: True)
self.assertIn("The 1 run passed. No run failed, so the bug has no decoys.", held.splitlines())
self.assertNotIn("failing run that", held)
self.assertIn("### bug-2-base-1, the passing run with the median tokens, 10 tokens", held.splitlines())
def test_the_median_is_by_tokens_whatever_the_order_the_runs_ran_in(self):
runs = [Run("bug-2-base-1", True, 20, []), Run("bug-2-head-1", True, 10, []), Run("bug-2-base-2", True, 30, [])]
self.assertEqual(digest(SIDES, [], [Bug("2: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()[-2:], ["### bug-2-base-1, the passing run with the median tokens, 20 tokens", ""])
self.assertEqual(digest(SIDES, [], [TaskRuns("2: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()[-2:], ["### bug-2-base-1, the passing run with the median tokens, 20 tokens", ""])
def test_a_run_that_did_not_finish_is_the_failing_trace_and_is_left_out_of_the_median(self):
runs = [Run("bug-4-base-1", False, 900, []), Run("bug-4-head-1", False, None, []), Run("bug-4-base-2", True, None, []), Run("bug-4-head-2", True, 60, [])]
held = digest(SIDES, [], [Bug("4: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()
held = digest(SIDES, [], [TaskRuns("4: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()
self.assertEqual([line for line in held if line.startswith("###")], ["### bug-4-head-1, a failing run that didn't finish", "### bug-4-head-2, the passing run with the median tokens, 60 tokens"])
def test_a_bug_no_run_fixed_shows_the_failing_trace_alone_and_says_where_no_file_misled(self):
held = digest(SIDES, [], [Bug("3: a.go:1:1 X", "a.go", "boom\nat line 2", [Run("bug-3-base-1", False, 10, reading("a.go")), Run("bug-3-head-1", False, 10, reading("a.go"))])], lambda path: True)
held = digest(SIDES, [], [TaskRuns("3: a.go:1:1 X", "a.go", "boom\nat line 2", [Run("bug-3-base-1", False, 10, reading("a.go")), Run("bug-3-head-1", False, 10, reading("a.go"))])], lambda path: True)
self.assertEqual(held.splitlines()[12:16], ["0 of the 2 runs passed. No decoys: no file but the one the bug is in was read by more than half the 2 failing runs.", "", "### bug-3-base-1, the failing run that spent the most tokens, 10 tokens", ""])
self.assertIn(" at line 2", held.splitlines())
# Of two failing runs that spent the same, the first.