Bench adding a data source in task-bench, from a register a seeded script generates
This commit is contained in:
@@ -47,11 +47,12 @@ def digest(sides: dict[Side, str], table: list[str], tasks: list[TaskRuns], is_f
|
||||
which the digest calls by noun. is_file says whether a path in the project names a file."""
|
||||
line = " A bug's name gives its line at the base." if noun == "bug" else ""
|
||||
code = f"Base {sides['base']}, head {sides['head']}.{line} Each side's code without the {noun}s is in `trees/base` and `trees/head` in the bench's folder."
|
||||
return "\n".join(["# task-bench digest", "", code, "", *table, *(line for task in tasks for line in ["", *told(task, is_file)])]) + "\n"
|
||||
return "\n".join(["# task-bench digest", "", code, "", *table, *(line for task in tasks for line in ["", *told(task, is_file, noun)])]) + "\n"
|
||||
|
||||
|
||||
def told(task: TaskRuns, is_file: typing.Callable[[str], bool]) -> list[str]:
|
||||
"""The digest's section on task, a bug where it names the bug's file and a feature otherwise."""
|
||||
def told(task: TaskRuns, is_file: typing.Callable[[str], bool], noun: str) -> list[str]:
|
||||
"""The digest's section on task, which its heading calls by noun: a bug where it names the bug's file, and a feature or a
|
||||
data source otherwise."""
|
||||
passing, failing = [run for run in task.runs if run.passed], [run for run in task.runs if not run.passed]
|
||||
passed = f"{len(passing)} of the {len(task.runs)} runs passed." if failing else f"The {counted(len(task.runs), 'run')} passed."
|
||||
# Only a bug has a file of its own. A feature has none, so no file a run read counts as a decoy.
|
||||
@@ -76,7 +77,7 @@ def told(task: TaskRuns, is_file: typing.Callable[[str], bool]) -> list[str]:
|
||||
median = finished[(len(finished) - 1) // 2]
|
||||
shown.append((median, f"the passing run with the median tokens, {median.tokens} tokens"))
|
||||
return [
|
||||
f"## {'Bug' if task.file else 'Feature'} {task.named}",
|
||||
f"## {noun.capitalize()} {task.named}",
|
||||
"",
|
||||
"The failing test printed, at the base:" if task.file else "The spec Haiku was told:",
|
||||
"",
|
||||
|
||||
Reference in New Issue
Block a user