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 -1
View File
@@ -81,6 +81,11 @@ a tool that needs one fails naming the setting. It is printed with the others on
where `touch-predictions record` appends what each chunk was predicted to touch beside what it touched.
Left out, the project keeps no such record. It is printed with the others only where it is set.
`bench-tasks` is an optional setting, a path spelt as the others are: the folder of the features that
`task-bench --tasks features` has Haiku build, such as `bench-tasks = "checkout:bench-tasks"`. `task-bench
--help` says what the folder holds. Left out, the project has no features to bench. It is printed with
the others only where it is set.
`coding-conventions` is an optional setting, a list of paths spelt as the others are: the files in
which the project's team wrote its own coding conventions, such as
`coding-conventions = ["checkout:CONVENTIONS.md"]`. Each reviewer agent larv-review launches reads
@@ -171,7 +176,7 @@ without `env-file`, sets `jira-finish-transition` or `jira-finish-status` to any
without a `plan` in Jira, names a Jira `plan` and leaves out `jira-score-formula` or `jira-score-bar`, sets
one of those two without a `plan` in Jira, sets the formula to one that doesn't parse or the bar to anything
but a number, sets `readability-floor` to anything but a number
from 1 to 10, sets `parallel-chunks` to anything but a whole number of 1 or more, or sets `jira-finding-type` to anything but a name or without a `plan` in Jira, and where `coding-conventions`, `env-file`, `epic-branch`, `jira-finish-transition`, `jira-finish-status`, `notifier`, `review-request-comment` or `touch-predictions` is asked for and not set. No path setting has a default.
from 1 to 10, sets `parallel-chunks` to anything but a whole number of 1 or more, or sets `jira-finding-type` to anything but a name or without a `plan` in Jira, and where `bench-tasks`, `coding-conventions`, `env-file`, `epic-branch`, `jira-finish-transition`, `jira-finish-status`, `notifier`, `review-request-comment` or `touch-predictions` is asked for and not set. No path setting has a default.
"""
import pathlib
import sys
+8 -4
View File
@@ -55,6 +55,10 @@ EPIC_BRANCH = "epic-branch"
REVIEW_REQUEST_COMMENT = "review-request-comment"
# An optional path setting: main's help says what it places.
TOUCH_PREDICTIONS = "touch-predictions"
# An optional path setting: the folder of the features `task-bench --tasks features` has Haiku build, whose help says what a feature's folder holds. The plan item that added it named the setting.
BENCH_TASKS = "bench-tasks"
# The path settings a project may leave out, in the order `places` prints them after SETTINGS.
OPTIONAL_PATHS = (TOUCH_PREDICTIONS, BENCH_TASKS)
# An optional setting: a list of paths, each spelt as SPELLING says, to the files that hold the team's own coding conventions, which each reviewer agent larv-review launches reads. Three readers, seated as the human who writes a client's config, picked the spelling 2-1 from four candidates, over a bare `conventions`, which they confused with `principles` and `working-rules`.
CODING_CONVENTIONS = "coding-conventions"
# Two optional settings, each a name, set together and only where `plan` names a Jira epic: the name of the workflow transition that finishes an item, and of the status it must lead to. Three readers, seated as the human who writes a client's config, picked the spelling from four candidates: two flat keys, as the other settings are, with a prefix that says what they apply to.
@@ -177,9 +181,9 @@ class ProjectConfig:
@property
def places(self) -> dict[str, str]:
"""Where each of SETTINGS is kept, in SETTINGS' order, then TOUCH_PREDICTIONS where the config sets it: a path, or the epic or page as the config spells it."""
"""Where each of SETTINGS is kept, in SETTINGS' order, then each of OPTIONAL_PATHS the config sets: a path, or the epic or page as the config spells it."""
spelt = {name: kept.spelling for name, kept in {"plan": self.epic, "goals-and-audience": self.goals_epic, **self.pages}.items() if kept}
return {name: spelt[name] if name in spelt else str(self.paths[name]) for name in (*SETTINGS, TOUCH_PREDICTIONS) if name in spelt or name in self.paths}
return {name: spelt[name] if name in spelt else str(self.paths[name]) for name in (*SETTINGS, *OPTIONAL_PATHS) if name in spelt or name in self.paths}
@property
def texts(self) -> dict[str, str]:
@@ -216,7 +220,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo
if len(named) > 1:
return Failure(f"{' and '.join(str(file) for file, _ in named)} each name the checkout {main}; only one config may")
file, values = named[0]
paths = {name: placed(values[name], top, file.parent, home) for name in (*SETTINGS, TOUCH_PREDICTIONS) if name in values}
paths = {name: placed(values[name], top, file.parent, home) for name in (*SETTINGS, *OPTIONAL_PATHS) if name in values}
epics = {name: epic_of(values.get(name)) for name in EPIC_SPELLINGS}
pages = {name: page for name in RECORDS if (page := page_of(values.get(name)))}
conventions = conventions_of(values.get(CODING_CONVENTIONS, []), top, file.parent, home)
@@ -388,7 +392,7 @@ SCALARS = (
Scalar(REVIEW_REQUEST_COMMENT, "review_request_comment", text_read(comment_fault)),
Scalar(JIRA_FINDING_TYPE, "jira_finding_type", text_read(type_fault)),
)
OPTIONAL = tuple(sorted({CODING_CONVENTIONS, ENV_FILE, TOUCH_PREDICTIONS, *JIRA_PLAN_ONLY, *(scalar.name for scalar in SCALARS)}))
OPTIONAL = tuple(sorted({CODING_CONVENTIONS, ENV_FILE, *OPTIONAL_PATHS, *JIRA_PLAN_ONLY, *(scalar.name for scalar in SCALARS)}))
def lies_in(path: pathlib.Path, *places: pathlib.Path) -> bool:
+14 -1
View File
@@ -399,6 +399,19 @@ class LoadTest(ConfigCase):
assert isinstance(found, Failure), found
self.assertIn("`env-file`", found.reason)
def test_bench_tasks_is_an_optional_path_listed_last_only_where_set(self) -> None:
folder = self.write("acme", CLIENT)
left_out = load(self.checkout, self.checkout, self.home)
assert isinstance(left_out, ProjectConfig)
self.assertNotIn("bench-tasks", left_out.places)
(folder / "config.toml").write_text(CLIENT + 'bench-tasks = "checkout:bench-tasks"\ntouch-predictions = "folder:docs/touch-predictions.md"\n', encoding="utf-8")
found = load(self.checkout, self.checkout, self.home)
assert isinstance(found, ProjectConfig)
self.assertEqual(list(found.places)[-3:], ["standards", "touch-predictions", "bench-tasks"])
self.assertEqual(found.paths["bench-tasks"], self.checkout / "bench-tasks")
(folder / "config.toml").write_text(CLIENT + 'bench-tasks = "bench-tasks"\n', encoding="utf-8")
self.assertIn("`bench-tasks` is 'bench-tasks', not \"checkout:<path>\"", self.failure())
def test_touch_predictions_is_an_optional_path_listed_after_the_others_only_where_set(self) -> None:
folder = self.write("acme", CLIENT)
left_out = load(self.checkout, self.checkout, self.home)
@@ -567,7 +580,7 @@ class LoadTest(ConfigCase):
def test_the_failure_for_a_misplaced_env_file_and_a_missing_setting_names_both_and_lists_every_setting(self) -> None:
folder = self.write("acme", "".join(line + "\n" for line in CLIENT.splitlines() if not line.startswith("plan")) + 'env-file = "checkout:.env"\n')
self.assertEqual(self.failure(), f"{folder / 'config.toml'}: `plan` is missing; `env-file` is 'checkout:.env', not {OUTSIDE}. The settings are {', '.join(SETTINGS)}, and optionally branch, coding-conventions, commit-title, env-file, epic-branch, jira-finding-type, jira-finish-status, jira-finish-transition, jira-score-bar, jira-score-formula, language, merge, notifier, parallel-chunks, pull-request-title, readability-floor, review-request-comment, tooling-on-host, touch-predictions and wait-for-approval.")
self.assertEqual(self.failure(), f"{folder / 'config.toml'}: `plan` is missing; `env-file` is 'checkout:.env', not {OUTSIDE}. The settings are {', '.join(SETTINGS)}, and optionally bench-tasks, branch, coding-conventions, commit-title, env-file, epic-branch, jira-finding-type, jira-finish-status, jira-finish-transition, jira-score-bar, jira-score-formula, language, merge, notifier, parallel-chunks, pull-request-title, readability-floor, review-request-comment, tooling-on-host, touch-predictions and wait-for-approval.")
def test_two_configs_naming_one_checkout_fail_naming_both(self) -> None:
self.write("acme", CLIENT)