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
+10 -10
View File
@@ -216,7 +216,7 @@ from failure import Failure
from task_bench.features.feature_tasks import feature_tasks, Features, read_features
from task_bench.figures.run_figures import Figures, figures, Result, table
from git_cli import git_repo
from review_rules.review_folder import made_review_folder, REPORTS
from review_rules.review_folder import made_review_folder, reports_folder
from larv_review.history_commands import read_places
from task_bench.features.shipped_features import read_shipped, shipped_tasks
from task_bench.figures.record_figures import recorded_bench
@@ -258,7 +258,7 @@ class Call(typing.NamedTuple):
and the home folder."""
given: dict[str, str]
env: typing.Mapping[str, str]
read: typing.Callable[[pathlib.Path], str | Failure]
read: typing.Callable[[pathlib.Path, typing.Mapping[str, str]], str | Failure]
home: pathlib.Path
@@ -272,7 +272,7 @@ def host_user() -> str:
return f"{os.getuid()}:{os.getgid()}"
def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[pathlib.Path], str | Failure] = read_places, claude: Claude = run_claude, name: typing.Callable[[], str] = new_name, user: typing.Callable[[], str] = host_user) -> int:
def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[pathlib.Path, typing.Mapping[str, str]], str | Failure] = read_places, claude: Claude = run_claude, name: typing.Callable[[], str] = new_name, user: typing.Callable[[], str] = host_user) -> int:
"""Runs task-bench with the arguments argv; git, docker and the mutation tool run in the environment env, `read` reads what
`larv-review places` prints for the checkout, and `claude` runs the claude that gathers. `name` names a bench's containers,
and `user` is the user they run as."""
@@ -356,7 +356,7 @@ def progress(line: str) -> None:
print(line, file=sys.stderr)
def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Callable[[pathlib.Path], str | Failure], home: pathlib.Path, name: str, user: str) -> list[str] | Failure:
def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Callable[[pathlib.Path, typing.Mapping[str, str]], str | Failure], home: pathlib.Path, name: str, user: str) -> list[str] | Failure:
"""The report of one bench of the checkout the process runs in, where `read` reads what `larv-review places` prints. Its
containers are named name and run as user. It tells its progress on stderr."""
kind = KINDS[given[TASKS]]
@@ -375,16 +375,16 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], read: typing.Cal
if isinstance(planning, Failure):
return planning
progress(f"task-bench: base {sides['base'][:12]}, head {sides['head'][:12]}.")
review = made_review_folder(checkout, home)
review = made_review_folder(checkout, home, env)
if isinstance(review, Failure):
return review
with held(review) as folder:
if isinstance(folder, Failure):
return folder
clear_left(home / REPORTS)
clear_left(reports_folder(home, env))
containers = Containers(docker_cli(env), name, given["--test"], int(env.get(SHARE_VARIABLE) or MEMORY_MIB), user)
run = functools.partial(bench_in, folder, given["--image"], containers, Asked(kind, int(given["--runs"])), planning, checkout, sides, git)
return recorded_bench(run, folder, git, home, time.time) if RECORD in given else run()
return recorded_bench(run, folder, git, home, env, time.time) if RECORD in given else run()
def bench_in(folder: pathlib.Path, image: str, containers: Containers, asked: Asked, planning: Planning, checkout: str, sides: dict[Side, str], git: Git) -> list[str] | Failure:
@@ -409,7 +409,7 @@ def bench_in(folder: pathlib.Path, image: str, containers: Containers, asked: As
def bugs_source(call: Call, kind: Kind) -> Source | Failure:
"""Reads the seats' places, the only places bugs are planted."""
places = call.read(call.home)
places = call.read(call.home, call.env)
if isinstance(places, Failure):
return places
return lambda checkout, sides, git: functools.partial(bugs_planner, call.given, call.env, places)
@@ -417,7 +417,7 @@ def bugs_source(call: Call, kind: Kind) -> Source | Failure:
def features_source(call: Call, kind: Kind) -> Source | Failure:
"""Reads the features, or the data sources where kind is DATA_SOURCE, from the project's folder."""
features = read_features(call.home, kind)
features = read_features(call.home, call.env, kind)
if isinstance(features, Failure):
return features
return lambda checkout, sides, git: functools.partial(features_planner, features, checkout)
@@ -426,7 +426,7 @@ def features_source(call: Call, kind: Kind) -> Source | Failure:
def shipped_source(call: Call, kind: Kind) -> Source:
"""Shipped features are read from the base's history, so only once the base is known."""
def source(checkout: str, sides: dict[Side, str], git: Git) -> Planning | Failure:
shipped = read_shipped(call.home, checkout, sides["base"], git)
shipped = read_shipped(call.home, call.env, checkout, sides["base"], git)
if isinstance(shipped, Failure):
return shipped
return lambda trees: functools.partial(shipped_tasks, shipped=shipped, count=int(call.given["--shipped"]))