Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s

This commit is contained in:
2026-12-03 18:56:28 +01:00
parent 20c83f861f
commit 1ca2c8efe0
142 changed files with 1095 additions and 933 deletions
+5 -5
View File
@@ -23,23 +23,23 @@ COMMIT_LENGTH = 8
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:
def recorded_bench(run: typing.Callable[[], list[str] | Failure], folder: pathlib.Path, git: Git, home: pathlib.Path, env: typing.Mapping[str, str], now: typing.Callable[[], float]) -> list[str] | Failure:
"""The report of the bench that run runs in folder, plus the line that says where its figures went. It refuses before the bench where the history cannot be read, since a bench takes hours. A bench that fails or stops records nothing."""
branch = git("rev-parse", "--abbrev-ref", "HEAD")
if isinstance(branch, Failure):
return branch
if isinstance(unreadable := held_history(home), Failure):
if isinstance(unreadable := held_history(home, env), Failure):
return unreadable
report = run()
if isinstance(report, Failure):
return report
recorded = record_figures(folder, branch.strip(), home, now())
recorded = record_figures(folder, branch.strip(), home, env, now())
if isinstance(recorded, Failure):
return Failure(f"the bench finished and {folder} holds its results, but its figures are not recorded: {recorded.reason}")
return [*report, recorded]
def record_figures(folder: pathlib.Path, branch: str, home: pathlib.Path, now: float) -> str | Failure:
def record_figures(folder: pathlib.Path, branch: str, home: pathlib.Path, env: typing.Mapping[str, str], now: float) -> str | Failure:
"""Appends the entry of the bench whose digest folder holds, stamped with now, and returns the line the tool prints."""
try:
digest = (folder / DIGEST).read_text(encoding="utf-8")
@@ -48,7 +48,7 @@ def record_figures(folder: pathlib.Path, branch: str, home: pathlib.Path, now: f
entry = bench_entry(digest, branch, now)
if entry is None:
return Failure(f"{folder / DIGEST} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows")
read = held_history(home)
read = held_history(home, env)
return read if isinstance(read, Failure) else bench_appended(*read, *entry)