Bench adding a data source in task-bench, from a register a seeded script generates
This commit is contained in:
@@ -5,6 +5,7 @@ import typing
|
||||
|
||||
from review_rules.comprehension_history import appended
|
||||
from task_bench.gather import DIGEST
|
||||
from task_bench.tasks import BUG, KINDS
|
||||
from failure import Failure
|
||||
from git_cli.git_repo import Git
|
||||
from record_store.held import Held
|
||||
@@ -17,8 +18,9 @@ SIDES = re.compile(r"^Base ([0-9a-f]{7,40}), head ([0-9a-f]{7,40})\.", re.M)
|
||||
# How the table's three rows over every task open, as task_bench.figures.table writes them: the base, the head and the head's change.
|
||||
OVER_ALL = "| All |"
|
||||
COMMIT_LENGTH = 8
|
||||
# How the table's header opens in a bench of features, as task_bench.figures.table writes it.
|
||||
OF_FEATURES = "| Feature |"
|
||||
# By how the table's header opens, as task_bench.figures.table writes it, what a bench's name says its tasks are. A bench of bugs
|
||||
# has the bare name.
|
||||
TASKS_NAMED = {f"| {kind.noun.capitalize()} |": f" {tasks}" for tasks, kind in KINDS.items() if kind is not BUG}
|
||||
|
||||
|
||||
def recorded_bench(run: typing.Callable[[], list[str] | Failure], folder: pathlib.Path, git: Git, home: pathlib.Path, now: typing.Callable[[], float]) -> list[str] | Failure:
|
||||
@@ -59,7 +61,7 @@ def bench_appended(history: RecordStore, held: Held, name: str, entry: str) -> s
|
||||
|
||||
|
||||
def bench_entry(digest: str, branch: str, now: float) -> tuple[str, str] | None:
|
||||
"""A bench's name in the history and its entry there, stamped with now: the digest's table header and its three rows over every task. The name says where the bench built features, so the history holds it beside a bench of bugs at the same commits. branch is the branch the bench ran on. None where digest is no task-bench digest."""
|
||||
"""A bench's name in the history and its entry there, stamped with now: the digest's table header and its three rows over every task. The name says where the bench built features or added data sources, so the history holds it beside a bench of bugs at the same commits. branch is the branch the bench ran on. None where digest is no task-bench digest."""
|
||||
sides = SIDES.search(digest)
|
||||
table = [line for line in digest.splitlines() if line.startswith("|")]
|
||||
rows = [line for line in table if line.startswith(OVER_ALL)]
|
||||
@@ -67,5 +69,5 @@ def bench_entry(digest: str, branch: str, now: float) -> tuple[str, str] | None:
|
||||
return None
|
||||
base, head = (commit[:COMMIT_LENGTH] for commit in sides.groups())
|
||||
# A panel of three readers, seated as the README's audience, picked this wording on 2026-11-23. Two of the three wanted the bench's name before the commits.
|
||||
name = f"task-bench{' features' if table[0].startswith(OF_FEATURES) else ''} of {branch}: head {head} against base {base}"
|
||||
name = f"task-bench{next((named for opening, named in TASKS_NAMED.items() if table[0].startswith(opening)), '')} of {branch}: head {head} against base {base}"
|
||||
return name, "\n".join([f"## {utc(now)}, {name}", "", *table[:2], *rows]) + "\n"
|
||||
|
||||
Reference in New Issue
Block a user