Answer architecture round 1: 0 🔴, 6 🟡 (0 misread); count a release review only where it names the next release, split task_bench into bugs, features and figures, group README's packages
CI / tests (pull_request) Successful in 4m55s

This commit is contained in:
2026-11-27 11:23:08 +01:00
parent d1b01c76c8
commit b563a597f1
55 changed files with 293 additions and 198 deletions
+6 -4
View File
@@ -29,10 +29,12 @@ and prints that the release reviews and the cuts are the human's to call. It pri
Where nothing is cut, it is the earliest release todo.md has ever named, less those renamed, so a
release whose items are all done still reads as next.
Where the next release holds no item, it says so, naming it where todo.md named it since the cut:
its release review due where changes are unreleased (the ## Unreleased entries, or else the
commits since the cut) and no commit titled `Release review of <release>` followed the tag,
finished and ready to cut once one did, and else to be planned first. On a branch with no tag,
such a commit counts only where its <release> is after the version under the dated heading.
to be planned first where no change is unreleased (the ## Unreleased entries, or else the
commits since the cut), else its release review due, and finished and ready to cut once that
review has landed. The review has landed once a commit titled `Release review of <release>`,
naming exactly the next release, is on the default branch after the newest v* tag, or anywhere
on a branch with no tag. A review of any other release doesn't count. Where todo.md named no
next release, a review of any release after the last cut counts.
Where todo.md files items under x.y.z or earlier, someone cut a release that still held them:
they count as the next release, the earliest after x.y.z that todo.md names or has named
since the cut, and a line says to move them there. Where there is no such release, it says todo.md files items under a release
+4 -2
View File
@@ -705,7 +705,9 @@ class Plans(unittest.TestCase):
def test_names_the_start_as_the_last_cut_where_nothing_is_cut(self):
said = planned(EMPTY, LastCut(None, "", 4, [TODO]), "origin/main", BRANCH).why
self.assertIn("release 0.2.0, the next after the start, since no release is cut yet,", said)
self.assertIn("has landed yet.", said)
self.assertIn("no commit titled `Release review of 0.2.0` has landed yet.", said)
self.assertIn("`chunk-preflight --help`", said)
self.assertIn("`Release review of <release>` has landed since the cut.", planned(EMPTY, LastCut("v0.1.0", "", 4, [EMPTY]), "origin/main", BRANCH).why, "todo.md named no release since the cut")
self.assertIn("since the cut.", planned(EMPTY, LastCut(None, "## 0.1.0 - 2026-10-03\n", 4, [TODO]), "origin/main", BRANCH).why)
def test_finds_the_release_after_the_last_cut_finished_or_to_be_planned_where_the_plan_holds_no_item_for_it(self):
@@ -722,7 +724,7 @@ class Plans(unittest.TestCase):
)
for todo, commits, todos, reviewed, fact, release in cases:
with self.subTest(todo=todo, commits=commits, todos=todos, reviewed=reviewed):
why = planned(todo, LastCut("v0.1.0", "", commits, todos, reviewed), "origin/main", BRANCH).why
why = planned(todo, LastCut("v0.1.0", "", commits, todos, frozenset({(0, 2, 0)} if reviewed else ())), "origin/main", BRANCH).why
self.assertIn(fact, why)
self.assertIn(release, why)
+4 -1
View File
@@ -37,12 +37,15 @@ def cut(clone: str, checkout: str, sleep: typing.Callable[[float], None]) -> str
ref = default_ref(cwd=clone)
if isinstance(ref, Failure):
return ref
release = ready_release(clone, ref)
# The patch refusal comes before the review's: a patch takes no release review, so "hasn't landed" would send the human the wrong way.
release = ready_release(clone, ref, review=False)
if isinstance(release, Failure):
return release
named = version(release)
if isinstance(patched := patch_refusal(clone, ref, release), Failure):
return patched
if isinstance(reviewed := ready_release(clone, ref), Failure):
return reviewed
title, tag, branch = f"Cut release {named}", f"v{named}", f"release-{named}"
merged = commit_titled(title, ref, clone)
if merged is None:
+1 -1
View File
@@ -18,7 +18,7 @@ memory, stay as they are.
--cut runs in the development clone, and refuses where that clone's origin isn't <checkout>'s. It cuts the next release, as chunk-preflight works it out, and
refuses without changing anything, unless that release holds no item in todo.md, its release review has
landed and changes are unreleased. The release names the version; the tool doesn't choose one. It also refuses a
landed, as chunk-preflight --help counts one, and changes are unreleased. The release names the version; the tool doesn't choose one. It also refuses a
release that is a patch of the newest tag, such as 0.15.2 after v0.15.1, since it would ship all of main: cut that
with --cut-patch.
1. On a fresh origin/main, it renames ## Unreleased in CHANGELOG.md to the version, commits that
+35 -18
View File
@@ -104,33 +104,50 @@ class Poll:
def resumed_news(poll: Poll, on: str, shown: str | None) -> str | Stop:
"""Reads the gate of the parked chunk every POLL_SECONDS until its worker has something to do and a running slot is free, then removes its file: what to tell that worker. on is the gate the chunk's file says it is parked on, and shown what its window's name says it awaits, None where nothing yet. A gate that cannot be read leaves the chunk parked as it was."""
# The last reason said for staying parked.
said = None
told = Told(poll, shown)
while True:
now = poll.gate()
if isinstance(now, gates.Gate):
awaits, stays = now.on, None
if isinstance(now, gates.Open):
full = resumed(poll.repo, poll.loop, poll.epic)
if full is None:
return unparked(poll, on, now)
told.tell(parked.SLOT, f"{now.news}, but the chunk stays parked: {full}")
elif isinstance(now, Failure):
told.tell(told.awaits or on, f"cannot read the gate: {now.reason}")
else:
if now.on != on:
if failed := poll.record(now):
return Stop(1, failed.reason)
on = now.on
elif isinstance(now, Failure):
awaits, stays = shown or on, f"cannot read the gate: {now.reason}"
else:
full = resumed(poll.repo, poll.loop, poll.epic)
if full is None:
failed = parked.unpark(poll.folder, poll.key)
return Stop(1, failed.reason) if failed is not None else f"{DRIVER_PARKED} its pull request awaited {"a person's merge" if on == gates.MERGE else on}. It resumes now: {now.news}."
awaits, stays = parked.SLOT, f"{now.news}, but the chunk stays parked: {full}"
if awaits != shown:
tmux.park(poll.loop.window, awaits, poll.epic.effects.tmux)
shown = awaits
if stays is not None and stays != said:
say(f"{stays}; trying again every {POLL_SECONDS} seconds", poll.epic.effects, stdout=True)
said = stays
told.tell(now.on, None)
poll.epic.effects.sleep(POLL_SECONDS)
@dataclasses.dataclass
class Told:
"""What the human has been told of a parked chunk, so that each read of its gate tells only what changed: what its window's name says it awaits, None where nothing yet, and the last reason said for staying parked."""
poll: Poll
awaits: str | None
reason: str | None = None
def tell(self, awaits: str, reason: str | None) -> None:
"""Names the window after what the chunk awaits, and says the reason it stays parked, None where the gate says it all. It skips what it told last."""
if awaits != self.awaits:
tmux.park(self.poll.loop.window, awaits, self.poll.epic.effects.tmux)
self.awaits = awaits
if reason is not None and reason != self.reason:
say(f"{reason}; trying again every {POLL_SECONDS} seconds", self.poll.epic.effects, stdout=True)
self.reason = reason
def unparked(poll: Poll, on: str, now: gates.Open) -> str | Stop:
"""Removes the file of the chunk that was parked on the gate on: what to tell its worker, which now says why it resumes."""
failed = parked.unpark(poll.folder, poll.key)
if failed is not None:
return Stop(1, failed.reason)
return f"{DRIVER_PARKED} its pull request awaited {"a person's merge" if on == gates.MERGE else on}. It resumes now: {now.news}."
def resumed(repo: str, loop: Loop, epic: EpicRun) -> str | None:
"""scheduler.resume for the parked chunk in loop's window, whose work is in the repo called repo, on the epic's cap and repos read afresh: None once it holds a running slot, else why it stays parked."""
# A chunk that resumes starts no other, so it needs no start order.
+21 -9
View File
@@ -230,6 +230,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo
formula, bar = values.get(JIRA_SCORE_FORMULA), values.get(JIRA_SCORE_BAR)
scoring = JiraScoring(formula, bar_value) if isinstance(formula, str) and (bar_value := bar_of(bar)) is not None else None
faults = [
# First what is wrong with a setting by itself, then with the settings together, then with the two that score a plan in Jira.
*(f"`{name}` is missing" for name in SETTINGS if name not in values),
*(f"`{name}` is not a setting" for name in values if name not in (*SETTINGS, *OPTIONAL)),
*(f"`{scalar.name}` is {values[scalar.name]!r}, {read.reason}" for scalar, read in scalars.items() if isinstance(read, Unfit)),
@@ -238,7 +239,26 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo
*(f"`{name}` is {values[name]!r}, not {SPELLING}, or {PAGE_SPELLING}" for name in RECORDS if name in values and paths[name] is None and name not in pages),
*([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not {OUTSIDE}"] if misplaced else []),
*([f"`{CODING_CONVENTIONS}` is {values[CODING_CONVENTIONS]!r}, not a list of paths, each {SPELLING}"] if conventions is None else []),
# Each setting that reaches a service needs the file that holds its credentials.
*combination_faults(values, epics, pages),
*([f"`{JIRA_SCORE_FORMULA}` is {formula!r}: {fault}"] if JIRA_SCORE_FORMULA in values and (fault := formula_fault(formula)) else []),
*([f"`{JIRA_SCORE_BAR}` is {bar!r}, not a bare number, such as `{JIRA_SCORE_BAR} = 1`"] if JIRA_SCORE_BAR in values and bar_of(bar) is None else []),
]
if faults:
return Failure(f"{file}: {'; '.join(faults)}. The settings are {', '.join(SETTINGS)}, and optionally {', '.join(OPTIONAL[:-1])} and {OPTIONAL[-1]}.")
# faults names a formula or bar a plan in Jira lacks or misspells.
assert scoring is not None or not epics["plan"]
defaulted = ProjectConfig(file.parent.name, file.parent, top, {name: path for name, path in paths.items() if path}, env_file, epic=epics["plan"], goals_epic=epics["goals-and-audience"], jira_finish=finish_of(values), jira_scoring=scoring, pages=pages, coding_conventions=conventions or ())
return dataclasses.replace(defaulted, **{scalar.field: read for scalar, read in scalars.items()})
def combination_faults(values: dict[str, object], epics: dict[str, Epic | None], pages: dict[str, Page]) -> list[str]:
"""Which of a config's settings may not stand together, as `project-config --help` says of each. values is the config, epics the Jira epic each of EPIC_SPELLINGS names, None where it names none, and pages the Confluence page of each record kept on one.
Three rules, in the order of the faults:
- a setting that reaches a service needs `env-file`;
- the goals in a Jira epic, a ranked record on a Confluence page and each of JIRA_PLAN_ONLY need `plan` to name a Jira epic, and such a plan needs both of JIRA_SCORE;
- the two JIRA_FINISH settings come together, and `review-request-comment` needs `epic-branch`."""
return [
*(f"`{name}` names a Jira epic, so `{ENV_FILE}` must name the file that holds its credentials" for name, epic in epics.items() if epic and ENV_FILE not in values),
*(f"`{name}` names a Confluence page, so `{ENV_FILE}` must name the file that holds its credentials" for name in pages if ENV_FILE not in values),
*([f"`{NOTIFIER}` names a notifier, so `{ENV_FILE}` must name the file that holds its credentials"] if NOTIFIER in values and ENV_FILE not in values else []),
@@ -249,15 +269,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo
*(f"`plan` names a Jira epic, so `{name}` must be set, as `project-config --help` shows" for name in JIRA_SCORE if epics["plan"] and name not in values),
*finish_faults(values),
*([f"`{REVIEW_REQUEST_COMMENT}` is set, so `{EPIC_BRANCH}` must be set: the comment goes on pull requests into that branch"] if REVIEW_REQUEST_COMMENT in values and EPIC_BRANCH not in values else []),
*([f"`{JIRA_SCORE_FORMULA}` is {formula!r}: {fault}"] if JIRA_SCORE_FORMULA in values and (fault := formula_fault(formula)) else []),
*([f"`{JIRA_SCORE_BAR}` is {bar!r}, not a bare number, such as `{JIRA_SCORE_BAR} = 1`"] if JIRA_SCORE_BAR in values and bar_of(bar) is None else []),
]
if faults:
return Failure(f"{file}: {'; '.join(faults)}. The settings are {', '.join(SETTINGS)}, and optionally {', '.join(OPTIONAL[:-1])} and {OPTIONAL[-1]}.")
# faults names a formula or bar a plan in Jira lacks or misspells.
assert scoring is not None or not epics["plan"]
defaulted = ProjectConfig(file.parent.name, file.parent, top, {name: path for name, path in paths.items() if path}, env_file, epic=epics["plan"], goals_epic=epics["goals-and-audience"], jira_finish=finish_of(values), jira_scoring=scoring, pages=pages, coding_conventions=conventions or ())
return dataclasses.replace(defaulted, **{scalar.field: read for scalar, read in scalars.items()})
@dataclasses.dataclass(frozen=True)
+2 -1
View File
@@ -78,7 +78,8 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi
if isinstance(pick, ReadyToCut | ReviewDue | Unplanned):
upcoming = f"release {version(pick.release)}, the next after {last_cut}" if pick.release else f"the next release after {last_cut}"
if isinstance(pick, ReviewDue):
return NoItem(f"{where} holds no item for {upcoming}, and changes are unreleased, so that release's release review is due: no commit titled `Release review of <release>` has landed {'since the cut' if named is not None else 'yet'}. This chunk is that review, as `~/.claude/skills/larv-review/SKILL.md` → \"Release review\" says; once it merges and the release holds no item, the release is ready to cut.")
awaited = version(pick.release) if pick.release else "<release>"
return NoItem(f"{where} holds no item for {upcoming}, and changes are unreleased, so that release's release review is due: no commit titled `Release review of {awaited}` has landed {'since the cut' if named is not None else 'yet'}. `chunk-preflight --help` says which commit counts. This chunk is that review, as `~/.claude/skills/larv-review/SKILL.md` → \"Release review\" says; once it merges and the release holds no item, the release is ready to cut.")
if isinstance(pick, ReadyToCut):
return NoItem(f"{where} holds no item for {upcoming}, and changes are unreleased, and its release review has landed, so that release is finished and ready to cut. The working loop stops here. If todo.md renamed that release instead, add `- <old release> renamed to <new release>` to todo.md's `## Renamed` section.")
return NoItem(f"{where} holds no item for {upcoming}, and no change is unreleased, so that release is to be planned first.")
+15 -13
View File
@@ -31,8 +31,8 @@ class LastCut:
commits: int | Failure
# todo.md's text at the tag and at each later commit that changed it, oldest first, as named_releases reads them; where the branch has no tag, at each commit that changed it. Empty where the tags cannot be read, and where no commit holds the plan.
todos_since: list[str] | Failure
# Whether a release review has landed since the tag, as release_reviewed reads it.
reviewed: bool | Failure = False
# The releases whose release review has landed since the cut, as reviewed_releases reads them.
reviews: frozenset[Release] | Failure = frozenset()
@dataclasses.dataclass(frozen=True)
@@ -70,7 +70,7 @@ class ReadyToCut:
@dataclasses.dataclass(frozen=True)
class ReviewDue:
"""The next release holds no item and work has landed towards it, but no release review has landed since the cut: `~/.claude/skills/larv-review/SKILL.md` → "Release review"."""
"""The next release holds no item and work has landed towards it, but its release review has not landed, as pick_from reads it: `~/.claude/skills/larv-review/SKILL.md` → "Release review"."""
# The next release, None where todo.md has named none since the cut.
release: Release | None
@@ -122,8 +122,8 @@ def default_plan(root: str, ref: str, plan: plans.PlanStore, changelog: stores.R
after = dated_cut(tag, changes)
since = tag if after is None else heading_commit(after, ref, changelog, root, run)
commits = since if isinstance(since, Failure) else commits_since(since, ref, root, run)
reviewed = tag if isinstance(tag, Failure) else release_reviewed(tag, ref, root, titles, after, run)
return DefaultPlan(plan_stores.held_at(ref, plan, root, run), LastCut(tag, changes, commits, todos_since(tag, ref, plan.tracked, root, run), reviewed))
reviews = tag if isinstance(tag, Failure) else reviewed_releases(tag, ref, root, titles, after, run)
return DefaultPlan(plan_stores.held_at(ref, plan, root, run), LastCut(tag, changes, commits, todos_since(tag, ref, plan.tracked, root, run), reviews))
def heading_commit(release: Release, ref: str, changelog: stores.RecordStore, cwd: str, run: Git = git) -> str | None | Failure:
@@ -135,10 +135,10 @@ def heading_commit(release: Release, ref: str, changelog: stores.RecordStore, cw
return added if isinstance(added, Failure) else next(iter(added.split()), None)
def release_reviewed(tag: str | None, ref: str, cwd: str, titles: templates.Titles, after: Release | None = None, run: Git = git) -> bool | Failure:
"""Whether ref holds a commit titled as a release review opens, `Release review of <release>`: after tag, or anywhere where tag is None. A title that names no version, such as an epic's `Release review of ABC-12` (do_epic/finish.py), reviews no release.
def reviewed_releases(tag: str | None, ref: str, cwd: str, titles: templates.Titles, after: Release | None = None, run: Git = git) -> frozenset[Release] | Failure:
"""LastCut.reviews: each release that a commit on ref names in its title, as a release review opens, `Release review of <release>`. The commits read are those after tag, or all of them where tag is None. A title that names no version, such as an epic's `Release review of ABC-12` (do_epic/finish.py), reviews no release.
titles holds the project's title templates, and each commit title is read as the summary they give. after is the version a branch with no tag counts as cut, or None. A title counts only where its release is later than after, or than tag's version where after is None. A patch release cut beside the default branch and merged back leaves on ref, after its tag, the review of that patch, which reviews no later release.
titles holds the project's title templates, and each commit title is read as the summary they give. after is the version a branch with no tag counts as cut, or None. A release counts only where it is later than after, or than tag's version where after is None. A patch release cut beside the default branch and merged back leaves on ref, after its tag, the review of that patch, which reviews no later release. pick_from needs that where the next release has no name.
"""
log = run("log", "--format=%s", f"{tag}..{ref}" if tag else ref, cwd=cwd)
if isinstance(log, Failure):
@@ -146,7 +146,7 @@ def release_reviewed(tag: str | None, ref: str, cwd: str, titles: templates.Titl
summaries = [titles.summary(line) for line in log.splitlines()]
reviews = [summary.removeprefix("Release review of ") for summary in summaries if summary.startswith("Release review of ")]
floor = after if after is not None else tagged(tag)
return any((named := parsed(review)) is not None and (floor is None or named > floor) for review in reviews)
return frozenset(named for review in reviews if (named := parsed(review)) is not None and (floor is None or named > floor))
def todos_since(tag: str | None | Failure, ref: str, plan: str | None, cwd: str, run: Git = git) -> list[str] | Failure:
@@ -200,7 +200,7 @@ def chunk_item(found: list[Item], cut: LastCut) -> Pick:
def picked(weighed: Standing, cut: LastCut) -> Pick:
"""chunk_item's pick, from the plan's items already weighed against cut."""
upcoming = next_release(weighed, cut)
return pick_from(upcoming, next_item(weighed.carried), cut.reviewed) if isinstance(upcoming, Upcoming) else upcoming
return pick_from(upcoming, next_item(weighed.carried), cut.reviews) if isinstance(upcoming, Upcoming) else upcoming
def next_release(weighed: Standing, cut: LastCut) -> Upcoming | Cut | Unknown:
@@ -249,9 +249,10 @@ def has_unreleased(cut: LastCut) -> bool | Failure:
return changes if isinstance(changes, Failure) else changes > 0
def pick_from(upcoming: Upcoming, first: Item | None, reviewed: bool | Failure) -> Next | ReadyToCut | ReviewDue | Unplanned | Unknown:
"""How the plan stands to upcoming, the next release. first is next_item's pick, which the pick holds where it is Next.
def pick_from(upcoming: Upcoming, first: Item | None, reviews: frozenset[Release] | Failure) -> Next | ReadyToCut | ReviewDue | Unplanned | Unknown:
"""How the plan stands to upcoming, the next release. first is next_item's pick, which the pick holds where it is Next. reviews is LastCut.reviews.
The next release's review has landed where reviews holds that release. Where the next release has no name, no title can name it, so a review of any release in reviews counts.
Unknown where the next release holds no item and the unreleased changes cannot be counted, or work has landed and git cannot say whether a release review has.
"""
if upcoming.plan_is_current:
@@ -260,8 +261,9 @@ def pick_from(upcoming: Upcoming, first: Item | None, reviewed: bool | Failure)
return Unknown()
if not upcoming.unreleased:
return Unplanned(upcoming.release)
if isinstance(reviewed, Failure):
if isinstance(reviews, Failure):
return Unknown()
reviewed = bool(reviews) if upcoming.release is None else upcoming.release in reviews
return ReadyToCut(upcoming.release) if reviewed else ReviewDue(upcoming.release)
+59 -32
View File
@@ -145,16 +145,22 @@ class ChunkItem(unittest.TestCase):
)
for tag, changes, earliest, named, stands in cases:
with self.subTest(tag=tag, changes=changes, earliest=earliest, named=named):
self.assertEqual(release_standing.chunk_item(plan_under(earliest), release_standing.LastCut(tag, "", changes, naming(named), reviewed=True)), stands)
self.assertEqual(release_standing.chunk_item(plan_under(earliest), release_standing.LastCut(tag, "", changes, naming(named), frozenset({(0, 9, 3), (1, 2, 4), (1, 3, 0)}))), stands)
def test_calls_a_release_review_due_where_the_next_release_holds_no_item_and_none_landed_since_the_cut(self):
cut = lambda reviewed: release_standing.LastCut("v1.2.3", "", 4, naming({(1, 3, 0)}), reviewed)
self.assertEqual(release_standing.chunk_item([], cut(False)), release_standing.ReviewDue((1, 3, 0)))
self.assertEqual(release_standing.chunk_item([], cut(True)), release_standing.ReadyToCut((1, 3, 0)))
cut = lambda reviews: release_standing.LastCut("v1.2.3", "", 4, naming({(1, 3, 0)}), reviews)
self.assertEqual(release_standing.chunk_item([], cut(frozenset())), release_standing.ReviewDue((1, 3, 0)))
self.assertEqual(release_standing.chunk_item([], cut(frozenset({(1, 3, 0)}))), release_standing.ReadyToCut((1, 3, 0)))
self.assertEqual(release_standing.chunk_item([], cut(frozenset({(1, 2, 4), (1, 4, 0)}))), release_standing.ReviewDue((1, 3, 0)), "a review of another release reviews none of 1.3.0")
self.assertEqual(release_standing.chunk_item([], cut(Failure("log unreadable"))), release_standing.Unknown())
self.assertEqual(release_standing.chunk_item(plan_under((1, 3, 0)), cut(False)), release_standing.Next((1, 3, 0), one((1, 3, 0))), "a review matters only once the release's items run out")
self.assertEqual(release_standing.chunk_item(plan_under((1, 3, 0)), cut(frozenset())), release_standing.Next((1, 3, 0), one((1, 3, 0))), "a review matters only once the release's items run out")
self.assertEqual(release_standing.chunk_item([], release_standing.LastCut("v1.2.3", "", 0, naming({(1, 3, 0)}))), release_standing.Unplanned((1, 3, 0)))
def test_counts_any_later_release_review_where_the_next_release_has_no_name(self):
cut = lambda reviews: release_standing.LastCut("v1.2.3", "", 4, [], reviews)
self.assertEqual(release_standing.chunk_item([], cut(frozenset())), release_standing.ReviewDue(None))
self.assertEqual(release_standing.chunk_item([], cut(frozenset({(1, 3, 0)}))), release_standing.ReadyToCut(None))
def test_takes_an_item_of_any_release_on_a_branch_with_no_tag(self):
for release in ((0, 0, 0), (0, 0, 1), (0, 1, 0)):
with self.subTest(release=release):
@@ -166,10 +172,11 @@ class ChunkItem(unittest.TestCase):
def test_calls_a_release_that_never_had_a_tag_finished_once_the_plan_files_no_item_under_it(self):
history = [HEADER + ROW.format(id=1, release="0.1.0") + ROW.format(id=2, release="0.1.1"), HEADER + ROW.format(id=2, release="0.1.1")]
cut = lambda reviewed: release_standing.LastCut(None, "", 4, history, reviewed)
self.assertEqual(release_standing.chunk_item(plan_under((0, 1, 1)), cut(False)), release_standing.ReviewDue((0, 1, 0)))
self.assertEqual(release_standing.chunk_item(plan_under((0, 1, 1)), cut(True)), release_standing.ReadyToCut((0, 1, 0)))
self.assertEqual(release_standing.chunk_item(plan_under((0, 1, 0)), cut(False)), release_standing.Next((0, 1, 0), one((0, 1, 0))))
cut = lambda reviews: release_standing.LastCut(None, "", 4, history, reviews)
self.assertEqual(release_standing.chunk_item(plan_under((0, 1, 1)), cut(frozenset())), release_standing.ReviewDue((0, 1, 0)))
self.assertEqual(release_standing.chunk_item(plan_under((0, 1, 1)), cut(frozenset({(0, 1, 1)}))), release_standing.ReviewDue((0, 1, 0)))
self.assertEqual(release_standing.chunk_item(plan_under((0, 1, 1)), cut(frozenset({(0, 1, 0)}))), release_standing.ReadyToCut((0, 1, 0)))
self.assertEqual(release_standing.chunk_item(plan_under((0, 1, 0)), cut(frozenset())), release_standing.Next((0, 1, 0), one((0, 1, 0))))
def test_counts_a_dated_changelog_heading_as_cut_on_a_branch_with_no_tag(self):
changelog = "# Changelog\n\n## Unreleased\n\n## 0.0.1 - 2026-10-03\n\n- Shipped.\n"
@@ -211,30 +218,30 @@ class ChunkItem(unittest.TestCase):
run = lambda *args: subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, cwd=repo, env=isolated_env(), text=True)
run("init", "-q", "-b", "main")
run("commit", "-q", "--allow-empty", "-m", "Release review of ABC-12")
self.assertIs(release_standing.release_reviewed(None, "main", repo, BARE), False, "an epic's review reviews no release")
self.assertEqual(release_standing.reviewed_releases(None, "main", repo, BARE), frozenset(), "an epic's review reviews no release")
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.1.0")
run("tag", "v0.1.0")
run("commit", "-q", "--allow-empty", "-m", "Ship item 4")
self.assertIs(release_standing.release_reviewed("v0.1.0", "main", repo, BARE), False, "a review before the cut reviewed that release")
self.assertEqual(release_standing.reviewed_releases("v0.1.0", "main", repo, BARE), frozenset(), "a review before the cut reviewed that release")
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.2.0")
run("commit", "-q", "--allow-empty", "-m", "Answer architecture round 1: 0 🔴, 1 🟡 (0 misread); split loader")
self.assertIs(release_standing.release_reviewed("v0.1.0", "main", repo, BARE), True)
self.assertIs(release_standing.release_reviewed(None, "main", repo, BARE), True)
self.assertEqual(release_standing.reviewed_releases("v0.1.0", "main", repo, BARE), frozenset({(0, 2, 0)}))
self.assertEqual(release_standing.reviewed_releases(None, "main", repo, BARE), frozenset({(0, 1, 0), (0, 2, 0)}))
run("commit", "-q", "--allow-empty", "-m", "Release review of ABC-12")
self.assertIs(release_standing.release_reviewed("v0.1.0", "main", repo, BARE), True)
self.assertIsInstance(release_standing.release_reviewed("v9.9.9", "main", repo, BARE), Failure)
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.reviewed, True)
self.assertEqual(release_standing.reviewed_releases("v0.1.0", "main", repo, BARE), frozenset({(0, 2, 0)}))
self.assertIsInstance(release_standing.reviewed_releases("v9.9.9", "main", repo, BARE), Failure)
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.reviews, frozenset({(0, 2, 0)}))
run("tag", "v0.2.0")
run("commit", "-q", "--allow-empty", "-m", "PAY-9 - Release review of 0.3.0")
self.assertIs(release_standing.release_reviewed("v0.2.0", "main", repo, BARE), False)
self.assertIs(release_standing.release_reviewed("v0.2.0", "main", repo, Titles("PAY-{id} - {summary}", "{summary}")), True)
self.assertIs(release_standing.release_reviewed("v0.2.0", "main", repo, Titles("{summary}", "PAY-{id} - {summary}")), True, "a squash merge titles the commit as the pull request")
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), Titles("PAY-{id} - {summary}", "{summary}")).cut.reviewed, True)
self.assertEqual(release_standing.reviewed_releases("v0.2.0", "main", repo, BARE), frozenset())
self.assertEqual(release_standing.reviewed_releases("v0.2.0", "main", repo, Titles("PAY-{id} - {summary}", "{summary}")), frozenset({(0, 3, 0)}))
self.assertEqual(release_standing.reviewed_releases("v0.2.0", "main", repo, Titles("{summary}", "PAY-{id} - {summary}")), frozenset({(0, 3, 0)}), "a squash merge titles the commit as the pull request")
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), Titles("PAY-{id} - {summary}", "{summary}")).cut.reviews, frozenset({(0, 3, 0)}))
paths = {setting: pathlib.Path(repo, setting) for setting in SETTINGS} | {"plan": pathlib.Path(repo, "todo.md"), "changelog": pathlib.Path(repo, "CHANGELOG.md")}
config = ProjectConfig("acme", pathlib.Path(repo, "folder"), pathlib.Path(repo), paths)
self.assertIs(release_standing.project_plan(config, "main", repo).cut.reviewed, False)
self.assertIs(release_standing.project_plan(dataclasses.replace(config, commit_title="PAY-{id} - {summary}"), "main", repo).cut.reviewed, True)
self.assertIs(release_standing.project_plan(dataclasses.replace(config, pull_request_title="PAY-{id} - {summary}"), "main", repo).cut.reviewed, True)
self.assertEqual(release_standing.project_plan(config, "main", repo).cut.reviews, frozenset())
self.assertEqual(release_standing.project_plan(dataclasses.replace(config, commit_title="PAY-{id} - {summary}"), "main", repo).cut.reviews, frozenset({(0, 3, 0)}))
self.assertEqual(release_standing.project_plan(dataclasses.replace(config, pull_request_title="PAY-{id} - {summary}"), "main", repo).cut.reviews, frozenset({(0, 3, 0)}))
def test_counts_no_release_review_of_the_patch_release_cut_beside_main_as_a_review_of_the_next(self):
repo = tempfile.mkdtemp()
@@ -250,9 +257,29 @@ class ChunkItem(unittest.TestCase):
run("switch", "-q", "main")
run("merge", "-q", "--strategy", "ours", "--no-ff", "-m", "Merge release 0.15.2 into main", "v0.15.2")
# v0.15.2..main holds the review, which reviewed 0.15.2 itself, so 0.16.0 still waits for its own.
self.assertIs(release_standing.release_reviewed("v0.15.2", "main", repo, BARE), False)
self.assertEqual(release_standing.reviewed_releases("v0.15.2", "main", repo, BARE), frozenset())
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.16.0")
self.assertIs(release_standing.release_reviewed("v0.15.2", "main", repo, BARE), True)
self.assertEqual(release_standing.reviewed_releases("v0.15.2", "main", repo, BARE), frozenset({(0, 16, 0)}))
def test_counts_a_release_review_only_where_it_names_the_next_release(self):
repo = tempfile.mkdtemp()
self.addCleanup(subprocess.run, ["rm", "-rf", repo])
run = lambda *args: subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, cwd=repo, env=isolated_env(), text=True)
run("init", "-q", "-b", "main")
pathlib.Path(repo, "todo.md").write_text(HEADER + ROW.format(id=1, release="0.16.0"))
run("add", "todo.md")
run("commit", "-q", "-m", "Cut release 0.15.1")
run("tag", "v0.15.1")
pathlib.Path(repo, "todo.md").write_text(HEADER)
run("commit", "-q", "-a", "-m", "Ship item 1")
pick = lambda: release_standing.chunk_item([], release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut)
self.assertEqual(pick(), release_standing.ReviewDue((0, 16, 0)))
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.15.1")
self.assertEqual(pick(), release_standing.ReviewDue((0, 16, 0)), "a review opened before todo.md renamed the release names the cut one")
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.17.0")
self.assertEqual(pick(), release_standing.ReviewDue((0, 16, 0)), "a review of 0.17.0 reviews none of 0.16.0")
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.16.0")
self.assertEqual(pick(), release_standing.ReadyToCut((0, 16, 0)))
def test_counts_no_release_review_of_a_release_cut_under_a_dated_heading_on_a_branch_with_no_tag(self):
repo = tempfile.mkdtemp()
@@ -263,13 +290,13 @@ class ChunkItem(unittest.TestCase):
pathlib.Path(repo, "CHANGELOG.md").write_text("# Changelog\n\n## 0.0.1 - 2026-10-03\n")
run("add", "CHANGELOG.md")
run("commit", "-q", "-m", "Cut 0.0.1")
self.assertIs(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.reviewed, False, "that review reviewed 0.0.1, which is cut")
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.reviews, frozenset(), "that review reviewed 0.0.1, which is cut")
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.commits, 0, "no commit follows the one that cut 0.0.1")
self.assertEqual(release_standing.chunk_item([], release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut), release_standing.Unplanned(None))
run("commit", "-q", "--allow-empty", "-m", "Ship item 2")
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.commits, 1)
run("commit", "-q", "--allow-empty", "-m", "Release review of 0.1.0")
self.assertIs(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.reviewed, True)
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut.reviews, frozenset({(0, 1, 0)}))
def test_counts_from_the_commit_on_the_named_branch_that_first_added_the_dated_heading_to_changelog_md(self):
repo = tempfile.mkdtemp()
@@ -319,14 +346,14 @@ class ChunkItem(unittest.TestCase):
pathlib.Path(repo, "todo.md").write_text(HEADER + ROW.format(id=1, release="0.2.0"))
run("add", "todo.md")
run("commit", "-q", "-m", "Plan")
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut, release_standing.LastCut(None, "", 1, [HEADER + ROW.format(id=1, release="0.2.0")], False))
self.assertEqual(release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE).cut, release_standing.LastCut(None, "", 1, [HEADER + ROW.format(id=1, release="0.2.0")], frozenset()))
run("tag", "v0.1.0")
pathlib.Path(repo, "CHANGELOG.md").write_text("# Changelog\n\n## 0.2.0 - 2026-10-03\n")
run("add", "CHANGELOG.md")
run("commit", "-q", "-m", "Date 0.2.0")
held = release_standing.default_plan(repo, "main", plan_in(repo), changelog_of(repo), BARE)
self.assertEqual(held.plan, plan_of(HEADER + ROW.format(id=1, release="0.2.0")))
self.assertEqual(held.cut, release_standing.LastCut("v0.1.0", "# Changelog\n\n## 0.2.0 - 2026-10-03\n", 1, [HEADER + ROW.format(id=1, release="0.2.0")], False))
self.assertEqual(held.cut, release_standing.LastCut("v0.1.0", "# Changelog\n\n## 0.2.0 - 2026-10-03\n", 1, [HEADER + ROW.format(id=1, release="0.2.0")], frozenset()))
self.assertEqual(release_standing.chunk_item(plan_under((0, 2, 0)), held.cut), release_standing.Next((0, 2, 0), one((0, 2, 0))))
def test_reads_a_plan_and_a_changelog_outside_the_checkout_as_they_stand(self):
@@ -339,13 +366,13 @@ class ChunkItem(unittest.TestCase):
run("commit", "-q", "-m", "A todo.md the project's owners keep")
held = release_standing.default_plan(repo, "main", plan_at(folder / "todo.md", None), FileStore(folder / "CHANGELOG.md", None), BARE)
self.assertIsInstance(held.plan, NoItemsTable, "neither file exists yet")
self.assertEqual(held.cut, release_standing.LastCut(None, "", 1, [], False))
self.assertEqual(held.cut, release_standing.LastCut(None, "", 1, [], frozenset()))
plan = HEADER + ROW.format(id=2, release="0.2.0")
(folder / "todo.md").write_text(plan)
(folder / "CHANGELOG.md").write_text("# Changelog\n\n## 0.1.0 - 2026-10-03\n")
held = release_standing.default_plan(repo, "main", plan_at(folder / "todo.md", None), FileStore(folder / "CHANGELOG.md", None), BARE)
self.assertEqual(held.plan, plan_of(plan))
self.assertEqual(held.cut, release_standing.LastCut(None, "# Changelog\n\n## 0.1.0 - 2026-10-03\n", 1, [], False), "no commit holds an earlier plan")
self.assertEqual(held.cut, release_standing.LastCut(None, "# Changelog\n\n## 0.1.0 - 2026-10-03\n", 1, [], frozenset()), "no commit holds an earlier plan")
(folder / "todo.md").write_bytes(b"\xff")
unreadable = release_standing.default_plan(repo, "main", plan_at(folder / "todo.md", None), changelog_of(repo), BARE)
self.assertEqual((unreadable.plan, unreadable.cut.todos_since), (Failure(f"{folder}/todo.md: not UTF-8"), []))
@@ -363,7 +390,7 @@ class ChunkItem(unittest.TestCase):
# Only this git knows where the checkout is, so a read that goes round it fails.
there = lambda *args, cwd: release_standing.git(*args, cwd=repo)
held = release_standing.default_plan("/nowhere", "main", plan_in("/nowhere"), changelog_of("/nowhere"), BARE, there)
self.assertEqual(held, release_standing.DefaultPlan(plan_of(plan), release_standing.LastCut(None, "# Changelog\n\n## 0.1.0 - 2026-10-03\n", 0, [plan], False)))
self.assertEqual(held, release_standing.DefaultPlan(plan_of(plan), release_standing.LastCut(None, "# Changelog\n\n## 0.1.0 - 2026-10-03\n", 0, [plan], frozenset())))
def test_counts_the_changes_unreleased_since_the_last_cut_by_unreleased_entries_and_else_by_commits(self):
changelog = "# Changelog\n\n## Unreleased\n\n- One.\n - A nested line.\n- Two.\n\n## 0.1.0\n\n- Old.\n"
View File
@@ -7,7 +7,7 @@ import re
from failure import Failure
from mutate_changes import in_diff_tools
from mutate_changes.changed_lines import is_test
from task_bench.planted_mutant import Mutant
from task_bench.bugs.planted_mutant import Mutant
from mutate_changes.tool_process import Run
# What each of Gremlins v0.6.0's mutators writes in place of a token: `tokenMutations` in its internal/engine/mappings.go, under the
@@ -7,8 +7,8 @@ import re
from mutate_changes.tool_process import failed, remove, Run
from failure import Failure
from mutate_changes import in_diff_tools
from task_bench.planted_mutant import Mutant
from task_bench.scratch_copy import scratch_copy
from task_bench.bugs.planted_mutant import Mutant
from task_bench.bugs.scratch_copy import scratch_copy
# Where Infection writes its JSON log, from the copy's top.
LOG = "infection-log.json"
@@ -6,9 +6,9 @@ import re
import typing
from failure import Failure
from task_bench import go_bugs, php_bugs, python_bugs, rust_bugs, typescript_bugs
from task_bench.bugs import go_bugs, php_bugs, python_bugs, rust_bugs, typescript_bugs
from mutate_changes.changed_lines import is_test, STRYKER
from task_bench.planted_mutant import Mutant
from task_bench.bugs.planted_mutant import Mutant
from mutate_changes.tool_process import Run
# A place as `larv-review places` prints it: `<path>:<line>` in backticks.
@@ -2,7 +2,7 @@
import re
import typing
from task_bench.figures import Side
from task_bench.figures.figures import Side
HUNK = re.compile(r"^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@", re.MULTILINE)
@@ -4,7 +4,7 @@ import re
from failure import Failure
from mutate_changes.mutmut_tool import killed_by_mutmut
from task_bench.planted_mutant import Mutant
from task_bench.bugs.planted_mutant import Mutant
from mutate_changes.tool_process import Run
# pytest's report of the failed tests, in its default form or with --tb=short: under this heading, a section per test.
@@ -5,7 +5,7 @@ import re
from failure import Failure
from mutate_changes import in_diff_tools
from task_bench.planted_mutant import Mutant
from task_bench.bugs.planted_mutant import Mutant
from mutate_changes.tool_process import remove, Run, scratch_folder
# What cargo-mutants 27.1.0 writes after the code it put in, as in `sum -= /* ~ changed by cargo-mutants ~ */ item;`. A planted
@@ -5,12 +5,12 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from failure import Failure
from task_bench.go_bugs import go_files, killed_mutants, reapplied, task_text
from task_bench.bugs.go_bugs import go_files, killed_mutants, reapplied, task_text
from mutate_changes import in_diff_tools
from task_bench.planted_mutant import Mutant
from task_bench.bugs.planted_mutant import Mutant
from mutate_changes.tool_process import Ran
# go test's report of an assertion that failed in a subtest, then of one whose message runs over two lines.
@@ -8,11 +8,11 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.php_bugs import changed, killed_mutants, task_text
from task_bench.bugs.php_bugs import changed, killed_mutants, task_text
from failure import Failure
from task_bench.planted_mutant import Mutant, mutated
from task_bench.bugs.planted_mutant import Mutant, mutated
from mutate_changes.tool_process import Ran
PICK = """<?php
@@ -3,11 +3,11 @@ import pathlib
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.plant import drawn, killed_mutants, Language, LANGUAGES, place_files, task_text
from task_bench.bugs.plant import drawn, killed_mutants, Language, LANGUAGES, place_files, task_text
from failure import Failure
from task_bench.planted_mutant import Mutant
from task_bench.bugs.planted_mutant import Mutant
PLACES = """## 2026-11-19T22:33:15Z, PR #646 at a357cc7b
@@ -3,9 +3,9 @@ import pathlib
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.planted_mutant import bug_at_sides, line_at_head, Mutant, mutated
from task_bench.bugs.planted_mutant import bug_at_sides, line_at_head, Mutant, mutated
class MutatedTest(unittest.TestCase):
@@ -4,11 +4,11 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from failure import Failure
from task_bench.python_bugs import killed_mutants, task_text
from task_bench.planted_mutant import Mutant, mutated
from task_bench.bugs.python_bugs import killed_mutants, task_text
from task_bench.bugs.planted_mutant import Mutant, mutated
from mutate_changes.tool_process import Ran
CALC = "def double(n):\n\treturn n * 2\n\n\ndef triple(n):\n\treturn (\n\t\tn * 3\n\t)\n"
@@ -8,11 +8,11 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.rust_bugs import changed, killed_mutants, task_text
from task_bench.bugs.rust_bugs import changed, killed_mutants, task_text
from failure import Failure
from task_bench.planted_mutant import Mutant, mutated
from task_bench.bugs.planted_mutant import Mutant, mutated
from mutate_changes.tool_process import Ran
PICK = b"""pub fn first(items: &[i32]) -> Option<i32> {
@@ -4,10 +4,10 @@ import sys
import textwrap
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench import rust_test_modules
from task_bench.rust_test_modules import tells_apart
from task_bench.bugs import rust_test_modules
from task_bench.bugs.rust_test_modules import tells_apart
LIB = textwrap.dedent("""\
pub fn add(a: i32, b: i32) -> i32 {
@@ -6,10 +6,10 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from failure import Failure
from task_bench.scratch_copy import scratch_copy
from task_bench.bugs.scratch_copy import scratch_copy
class ScratchCopyTest(unittest.TestCase):
@@ -9,11 +9,11 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.typescript_bugs import changed, killed_mutants, task_text
from task_bench.bugs.typescript_bugs import changed, killed_mutants, task_text
from failure import Failure
from task_bench.planted_mutant import Mutant, mutated
from task_bench.bugs.planted_mutant import Mutant, mutated
from mutate_changes.tool_process import Ran
PICK = """export function pick(items: number[], floor: number): number {
@@ -7,8 +7,8 @@ import re
from mutate_changes.tool_process import failed, remove, Run
from failure import Failure
from mutate_changes import in_diff_tools
from task_bench.planted_mutant import Mutant
from task_bench.scratch_copy import scratch_copy
from task_bench.bugs.planted_mutant import Mutant
from task_bench.bugs.scratch_copy import scratch_copy
# Where Stryker 10.1.1's json reporter writes, from the folder it runs in. Only the project's own Stryker config can set another
# path, so the planter reads this one.
View File
@@ -3,7 +3,7 @@ that builds it, and acceptance tests Haiku never sees. A feature counts at the t
at both before it is built, and pass at both with the reference patch.
A data source Haiku adds is such a folder too, with a `generate-register` beside the three parts: the script that writes the
register Haiku imports, as task_bench.registers runs it. It counts as a feature does, in trees that hold its register."""
register Haiku imports, as task_bench.features.registers runs it. It counts as a feature does, in trees that hold its register."""
import itertools
import os
import pathlib
@@ -13,11 +13,11 @@ import typing
from task_bench.tasks import Bench, check_made, committed, DATA_SOURCE, FEATURE, Kind, on_disk, Planned, Task
from project_config.settings import BENCH_TASKS, CONFIG
from failure import Failure
from task_bench.registers import GENERATE, NotGenerated, registered_trees
from task_bench.features.registers import GENERATE, NotGenerated, registered_trees
from project_config.main import located
from mutate_changes.tool_process import Ran
from task_bench.runs import ran_tests, TimedOut
from task_bench.figures import Side, SIDES
from task_bench.figures.figures import Side, SIDES
SPEC = "spec.md"
PATCH = "reference.patch"
@@ -8,7 +8,7 @@ import shutil
from task_bench.tasks import Bench, committed, on_disk
from task_bench.runs import Containers, entries, in_tree, NotStarted, run_in_image, TimedOut
from failure import Failure
from task_bench.figures import Side, SIDES
from task_bench.figures.figures import Side, SIDES
# A panel of three readers, seated as the README's audience, picked the name on 2026-11-23: each had it first or second, over
# `register`, which reads as a data file, and `generate-source`, which two read as generating source code.
@@ -1,6 +1,6 @@
"""The features task-bench has Haiku rebuild: those the project shipped, read from its history. A shipped feature is a chunk on
the base's first-parent line that took an item out of the plan, as branch_chunks cuts that line. Once its change is out of each
side's tree, it is a feature as task_bench.feature_tasks has it. `task-bench --help` says what Haiku is told and how a rebuild
side's tree, it is a feature as task_bench.features.feature_tasks has it. `task-bench --help` says what Haiku is told and how a rebuild
is checked."""
import functools
import os
@@ -9,7 +9,7 @@ import re
import shutil
import typing
from task_bench.feature_tasks import ACCEPTANCE, Feature, PATCH, why_passed_over
from task_bench.features.feature_tasks import ACCEPTANCE, Feature, PATCH, why_passed_over
from task_bench.tasks import Bench, committed, on_disk, Planned, Task
from branch_chunks.read import cut_with_shipped, unsupported
from failure import Failure
@@ -18,7 +18,7 @@ from plan.todo_table import Item, tagline_text
from project_config.main import located
from task_bench.runs import of_tests
from project_config.settings import RECORDS
from task_bench.figures import Side, SIDES
from task_bench.figures.figures import Side, SIDES
# Why a feature that landed by fast-forward is passed over: no earlier chunk says where its commits start, or its branch merged
# the default branch into itself, so its commits hold what other features built.
@@ -12,13 +12,13 @@ import tempfile
import textwrap
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.tasks import Asked, Bench, FEATURE
from task_bench.test_task_bench import BASE_CODE, DOCKER, HEAD_CODE, InTurn, TESTS
from task_bench.runs import Containers, TimedOut
from failure import Failure
from task_bench.feature_tasks import Feature, features, why_passed_over
from task_bench.features.feature_tasks import Feature, features, why_passed_over
from test_env import isolated_env
from task_bench import main
from mutate_changes.tool_process import Ran
@@ -8,14 +8,14 @@ import tempfile
import textwrap
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.test_feature_tasks import added, BenchOfTasksCase, feature
from task_bench.features.test_feature_tasks import added, BenchOfTasksCase, feature
from task_bench.tasks import Asked, Bench, DATA_SOURCE
from task_bench.runs import Containers, TimedOut
from failure import Failure
from task_bench.feature_tasks import features
from task_bench.registers import generated, NotGenerated, registered_trees
from task_bench.features.feature_tasks import features
from task_bench.features.registers import generated, NotGenerated, registered_trees
from task_bench import main
from mutate_changes.tool_process import Ran
@@ -10,14 +10,14 @@ import subprocess
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.test_feature_tasks import ACCEPTANCE, BenchOfTasksCase
from task_bench.features.test_feature_tasks import ACCEPTANCE, BenchOfTasksCase
from task_bench.test_task_bench import BASE_CODE, HEAD_CODE
from failure import Failure
from git_cli.git_repo import git
from task_bench import main
from task_bench.shipped_features import MERGED_IN, read_shipped
from task_bench.features.shipped_features import MERGED_IN, read_shipped
from branch_chunks.read import READ_AT
HEADER = "| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves |\n|---|---|---|---|---|---|---|---|---|---|---|\n"
View File
@@ -8,7 +8,7 @@ import typing
from claude_code.entries import AssistantTurn, Entry, Text, tool_calls, ToolCall, ToolResult, ToolResults
from task_bench.runs import HOME, WORK
from reading_cost.measure import reads_of
from task_bench.figures import Side
from task_bench.figures.figures import Side
# A trace keeps the first TEXT_LINES lines of the model's text between two calls, and the first TEXT_WIDTH characters of each.
TEXT_LINES = 3
@@ -5,7 +5,7 @@ import typing
from review_rules.comprehension_history import appended
from task_bench.tasks import BUG, KINDS
from task_bench.gather import DIGEST
from task_bench.figures.gather import DIGEST
from failure import Failure
from git_cli.git_repo import Git
from record_store.held import Held
@@ -15,10 +15,10 @@ from text_files.utc_stamp import utc
# The digest's line that names the commits, as task_bench.digest.digest writes it.
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.
# How the table's three rows over every task open, as task_bench.figures.figures.table writes them: the base, the head and the head's change.
OVER_ALL = "| All |"
COMMIT_LENGTH = 8
# What a bench's name says its tasks are, by how its table's header opens, as task_bench.figures.table writes it. A bench of
# What a bench's name says its tasks are, by how its table's header opens, as task_bench.figures.figures.table writes it. 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}
@@ -4,9 +4,9 @@ import pathlib
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.digest import decoys, digest, Run, TaskRuns, trace
from task_bench.figures.digest import decoys, digest, Run, TaskRuns, trace
from claude_code.entries import entries_of, Entry
@@ -4,11 +4,11 @@ import pathlib
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench import figures as bench_figures
from task_bench.figures import figures as bench_figures
from failure import Failure
from task_bench.figures import Figures, Result, table
from task_bench.figures.figures import Figures, Result, table
from claude_code.entries import json_objects
from claude_code.tokens import Tokens
@@ -9,10 +9,10 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from failure import Failure
from task_bench.gather import gather, PROMPT
from task_bench.figures.gather import gather, PROMPT
from test_env import isolated_env
from task_bench import main
@@ -6,9 +6,9 @@ import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from task_bench.record_figures import bench_appended, bench_entry, recorded_bench
from task_bench.figures.record_figures import bench_appended, bench_entry, recorded_bench
from review_rules.comprehension_history import entries
from failure import Failure
from record_store.held import Held
+10 -10
View File
@@ -159,7 +159,7 @@ features the heading reads `task-bench features of <branch>: ...` instead, for o
of <branch>: ...`, and for one of shipped features `task-bench shipped-features of <branch>: ...`. No tool reads the entry as a ruling or a scoring run. The bench's last line says where the entry went. A bench that fails or stops doesn't record anything.
`task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the
cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in gather-prompt.md beside this file.
cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in bin/task_bench/figures/gather-prompt.md.
That claude files an item with `todo-item add` for each place the runs show to be hard, and leaves the plan's file uncommitted.
gather prints that claude's answer and removes the bench's folder. Where claude fails, the folder stays, for another try.
@@ -197,27 +197,27 @@ import typing
import uuid
from task_bench.tasks import Asked, Bench, BUG, check_made, committed, Kind, KINDS, on_disk, Planned, SHIPPED, Task, tests_in_copy
from task_bench.planted_mutant import bug_at_sides, Mutant
from task_bench.bugs.planted_mutant import bug_at_sides, Mutant
from claude_code.reply import Claude
from task_bench.bench_folder import clear_left, held
from task_bench.runs import closed, Containers, docker_cli, fix_attempted, MEMORY_MIB, opened, ran_tests, TimedOut, TOKEN, WORK
from task_bench.digest import counted, digest, Run, TaskRuns
from task_bench.figures.digest import counted, digest, Run, TaskRuns
from machine_load.slots import CPUS_PER_SLOT
from git_cli.git_repo import default_ref, Git, top
from task_bench.gather import DIGEST, gather, run_claude
from task_bench.plant import drawn, killed_mutants, place_files, task_text
from task_bench.figures.gather import DIGEST, gather, run_claude
from task_bench.bugs.plant import drawn, killed_mutants, place_files, task_text
from claude_code.entries import entry_from, json_objects
from mutate_changes.tool_process import failed, Ran, run_tool
from failure import Failure
from task_bench.feature_tasks import feature_tasks, Features, read_features
from task_bench.figures import figures, Result, Side, SIDES, table
from task_bench.features.feature_tasks import feature_tasks, Features, read_features
from task_bench.figures.figures import figures, Result, Side, SIDES, table
from git_cli import git_repo
from review_rules.review_folder import made_review_folder, REPORTS
from larv_review.history_commands import read_places
from task_bench.shipped_features import read_shipped, shipped_tasks, ShippedFeatures
from task_bench.record_figures import recorded_bench
from task_bench.features.shipped_features import read_shipped, shipped_tasks, ShippedFeatures
from task_bench.figures.record_figures import recorded_bench
from run_heavy.capped_docker import SHARE_VARIABLE
from task_bench.rust_test_modules import tells_apart
from task_bench.bugs.rust_test_modules import tells_apart
USAGE = "usage: task-bench --image <image> --test <shell text> [--base <ref>] [--head <ref>] [--prefix <shell text>] [--seed <n>] [--bugs <n>] [--runs <n>] [--record-figures], or task-bench --tasks features|data-sources --image <image> --test <shell text> [--base <ref>] [--head <ref>] [--runs <n>] [--record-figures], or task-bench --tasks shipped-features --image <image> --test <shell text> [--base <ref>] [--head <ref>] [--shipped <n>] [--runs <n>] [--record-figures], or task-bench gather"
# A panel of three readers, seated as the README's audience, picked these options on 2026-11-21, each 3 to 0.
+1 -1
View File
@@ -12,7 +12,7 @@ from mutate_changes.tool_process import failed, Ran
from failure import Failure
from mutate_changes.changed_lines import is_test
from task_bench.api_proxy import PORT
from task_bench.rust_test_modules import with_tests_of
from task_bench.bugs.rust_test_modules import with_tests_of
MODEL = "claude-haiku-5-5"
# Where each run's container mounts its copy of the code, and its home folder: the paths in a run's stream start there.
+1 -1
View File
@@ -9,7 +9,7 @@ from task_bench.runs import checked_tree, Containers, ran_tests
from failure import Failure
from git_cli.git_repo import Git
from mutate_changes.tool_process import Ran
from task_bench.figures import Side
from task_bench.figures.figures import Side
# The one commit of a task's tree doesn't name anyone, and neither a hook nor a signing key of the caller's reaches it.
COMMIT = ["-c", "user.name=task-bench", "-c", "user.email=task-bench@localhost", "-c", "commit.gpgsign=false", "-c", "core.hooksPath=/dev/null", "commit", "--quiet", "--message", "Import"]
+3 -3
View File
@@ -18,11 +18,11 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from task_bench import api_proxy, bench_folder, main, runs
from test_env import assert_not_root, isolated_env
from task_bench.runs import checked_tree, closed, Containers, docker_cli, fix_attempted, opened, ran_tests, TimedOut
from task_bench.plant import drawn
from task_bench.bugs.plant import drawn
from claude_code.entries import Entry, entry_from
from failure import Failure
from task_bench.figures import Figures, Result
from task_bench.planted_mutant import Mutant
from task_bench.figures.figures import Figures, Result
from task_bench.bugs.planted_mutant import Mutant
from mutate_changes.tool_process import Ran
from claude_code.tokens import Tokens