diff --git a/.gitignore b/.gitignore index 729fb625..ca350af0 100644 --- a/.gitignore +++ b/.gitignore @@ -157,8 +157,9 @@ !bin/subagent_rung/*.py !bin/task-bench !bin/task_bench/ -!bin/task_bench/*.py -!bin/task_bench/gather-prompt.md +!bin/task_bench/**/ +!bin/task_bench/**/*.py +!bin/task_bench/figures/gather-prompt.md !bin/test_*.py !bin/text_files/ !bin/text_files/*.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aa1d128..bf14af88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - task-bench leaves out of a fix a change Haiku makes to a Rust test module that stands in the file of the code it tests, and passes over a Rust mutant whose test modules it cannot tell apart. - loop-claude starts a chunk on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find, which failed three times and waited for the human. - larv-review's prose pass takes a second round after a fix that rewrites a claim a command or a source file can check, such as generated output, a number or a licence term. -- `deploy-release --cut-patch ` cuts the newest tag's next patch release, such as 0.15.2 after v0.15.1, holding only the commits named, for a fix that must ship before main's other unreleased work. It runs `ci.sh` on the patch, tags and pushes it, merges the tag back into main through a pull request, and moves `~/.claude` to it. Plain `--cut` now refuses a patch release, and a release review counts only for a release later than the last cut. +- `deploy-release --cut-patch ` cuts the newest tag's next patch release, such as 0.15.2 after v0.15.1, holding only the commits named, for a fix that must ship before main's other unreleased work. It runs `ci.sh` on the patch, tags and pushes it, merges the tag back into main through a pull request, and moves `~/.claude` to it. Plain `--cut` now refuses a patch release, and a release review counts only for the release its title names: `Release review of 0.16.0` reviews 0.16.0 and no other. - `task-bench` plants bugs in Rust files too, from the mutants cargo-mutants catches, and tells Haiku the panic message `cargo test` prints. - `task-bench --tasks shipped-features` benches rebuilding features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of its plan item, and checks the build with the tests that change holds. `--shipped ` sets how many it takes, and a feature whose branch landed by fast-forward starts after the latest earlier chunk that shipped an item or landed by a merge or a rebase, and is passed over where none comes before it or its branch merged the default branch into itself. - `task-bench` plants a Python mutant in a file whose lines end in CRLF, which it could not re-apply before, and a Go mutant there keeps applying. diff --git a/README.md b/README.md index 0af7783e..7a884dae 100644 --- a/README.md +++ b/README.md @@ -243,15 +243,12 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a ### Packages under `bin/` -`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests. Beside the packages, `bin/`'s root holds only the launchers, the tools of one file with their tests, `test_env.py`, `failure.py` and `setup.cfg`. `failure.py`'s `Failure`, which modules across `bin/` return for a failed step, belongs to no single package. `agent_cycle/`, `atlassian/`, `branch_chunks/`, `chunk_driver/`, `claude_code/`, `command_lines/`, `forge/`, `git_cli/`, `loop_effects/`, `loop_state/`, `machine_load/`, `model_routing/`, `notifier/`, `plan/`, `plan_store/`, `record_store/`, `release_plan/`, `review_rules/`, `rung_replay/`, `text_files/` and `transcript_archive/` serve more than one tool. No package imports one that imports it back, and a package's `doubles.py` holds the test doubles that other packages' tests use, so no module imports a `test_*` module of another package; `repo_checks/test_package_cycles.py` checks both. No Python file of the repo, `workflow-bench/`'s included, uses `mock.patch`, which `repo_checks/test_no_patched_globals.py` checks. +`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests. Beside the packages, `bin/`'s root holds only the launchers, the tools of one file with their tests, `test_env.py`, `failure.py` and `setup.cfg`. `failure.py`'s `Failure`, which modules across `bin/` return for a failed step, belongs to no single package. `agent_cycle/`, `atlassian/`, `branch_chunks/`, `chunk_driver/`, `claude_code/`, `command_lines/`, `forge/`, `git_cli/`, `loop_effects/`, `loop_state/`, `machine_load/`, `model_routing/`, `notifier/`, `plan/`, `plan_store/`, `record_store/`, `release_plan/`, `review_rules/`, `rung_replay/`, `text_files/` and `transcript_archive/` serve more than one tool. No package imports one that imports it back, and a package's `doubles.py` holds the test doubles that other packages' tests use, so no module imports a `test_*` module of another package; `repo_checks/test_package_cycles.py` checks both. No Python file of the repo, `workflow-bench/`'s included, uses `mock.patch`, which `repo_checks/test_no_patched_globals.py` checks. The packages below are grouped by what they are for, in alphabetical order within a group. + +#### Driving chunks -- `adf_codec/` converts markdown to ADF, the rich text of Jira Cloud and Confluence, and back, in a throwaway container running a pinned `@larvit/adf-codec`. It builds the container's image inside a heavy slot. - `agent_cycle/` runs one cycle (`run.py`): a headless claude worker, then the judge of its transcript. It also holds the interrupt, the tmux window and the routing of the worker's rung. The entry point that runs the cycles supplies the prompts and file names of its own workflow (`worker_prompts.py`), and reads which items a worker took in. `loop_claude` and `do_epic` drive it; `agent_cycle` doesn't import either. -- `atlassian/` holds what the Jira and Confluence backends share (`client.py`): one Atlassian account's credentials, the request both backends send, and each service's error messages. `jira.py` holds what every reader of Jira shares: a search read page by page, the key, fields, links and property of each issue it finds, checked for their shape, and the transition that finishes an issue, for `plan_store` and `do_epic`. -- `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes`, `routing_figures` and `task_bench`. It imports `reading_cost`'s record path. - `chunk_driver/` holds what the entry points share. An entry point is a tool that drives chunks through `agent_cycle`: `loop_claude` and `do_epic` are the two. They share how a cycle starts (`cycle_start.py`) and closes (`chunk_run.py`), the claim on a checkout before a chunk starts in it (`claims.py`), the prompts every worker gets (`prompts.py`), and a checkout's premises, records and saved models (`project/`). It imports neither entry point, and `repo_checks` fails any package that imports one of the two. `agent_cycle` is the layer below it, and `repo_checks` fails `agent_cycle` where it imports `chunk_driver`, tests included. -- `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`. -- `deploy_release` imports `release_plan`'s `release_standing`. - `do_epic/` holds `do-epic`, the tool that drives one Jira epic: - `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `epic_run.py` holds what stays the same through one run of do-epic, such as its config, its Jira store and its paths, and starts the chunks that may start now. - `planning.py` settles, before the chunks start, where each open issue is worked, its scores and the order the issues start in, through `split.py`, `repo_pick.py`, `issue_scores.py` and `ranking.py`. @@ -267,29 +264,49 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking, and re-ranks the tracker's backlog to that order through `backend/`. - `backend/` reads, files and ranks the epic's issues, adds the labels `repo_pick.py` and `split.py` record, posts comments, moves a finished chunk's issue to done, and closes the epic. - `e2e/` holds `do-epic-e2e`. -- `forge/` tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (`commands.py`), finds a pull request, lists the ready ones and reads its checks, once or until they settle (`pulls.py`), and reads a pull request's review state (`reviews.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release`, `do_epic` and `larv_review`. -- `git_cli/` runs git for every tool (`git_repo.py`), reads the git calls in a shell command (`git_command.py`), and keeps an epic's working branch level with the default branch (`epic_branch.py`). -- `judge_replay` imports `agent_cycle`'s judge and verdicts, and `chunk_driver`'s premises, records and `ANSWER_DESTINATIONS`. - `loop_claude` runs `chunk-preflight` as a process of its own. - `loop_effects/` holds `Effects`: the processes, terminal, clock and git a tool reaches, injected so its tests can script them. loop-claude, do-epic, both replay tools and `reviewer-merge-trials`' driver use it. - `loop_state/` holds where loop-claude and do-epic keep their files (`paths.py`), which `rung_replay` reads too. -- `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy` and `adf_codec`, and reads the memory share that loop-claude waits for. It also gives `mutate_changes` a slot's CPU count. - `model_routing/` holds the shipped routing ladder (`routing-ladder.json`) and its steps (`ladder.py`), and reads a ladder from that file or a project's own (`ladder_file.py`), for loop-claude, `rule_hook`, `do_epic`, both replay tools and `subagent-rung`. It finds a project's config folder through `project_config`. It also holds the list prices, which `routing_figures` and `transcript_archive` read. - `notifier/` sends the human a DM through the notifier a project's config names, for `notify` and for loop-claude through `loop_effects`. Its backends are `mattermost.py` and `slack.py`. +- `transcript_archive/` stores loop-claude's transcripts. Its `project_key.py` names each project's archive folder, loop-claude session and models-file entry. + +#### The plan, the records and releases + +- `deploy_release` imports `release_plan`'s `release_standing`. - `plan/` is the plan's core, and imports neither `plan_store` nor `release_plan`. It holds an item and the items table's format (`todo_table.py`), releases (`release.py`), the ranking (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`), the paths an item's text names (`named_paths.py`), an item's `Touches:` prediction and where two overlap (`touches.py`), and `citations.py`, which holds `todo.md` and `docs/decisions.md` to each other. `goals_file.py` reads the goals file's sections, goals and goal weights, for the ranking and for `loop_claude`'s premises. - `plan_store/` reads and writes a project's plan through the store the project's config names (`stores.py`). Every backend meets `plans.py`'s `PlanStore`: a markdown file (`todo_md.py`, which also ranks and checks the file in place, with its text edits in `markdown_edits.py`) or a Jira epic (`jira_epic.py`). `scoring.py` reads the goal weights that both backends rank by. `contract.py` holds the tests every backend that writes must pass; `jira_epic.py` doesn't yet, and its own tests stand in for Jira. `fakes.py` holds a plan in memory. -- `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them. - `record_store/` reads and writes a project's records, each through the store the project's config names (`stores.py`): a markdown file, a Confluence Cloud page (`confluence_page.py`), or, for the goals, a Jira epic's description (`jira_description.py`). `contract.py` holds the tests every backend must pass, and `fakes.py` a store in memory that the tests of other tools use. - `release_plan/` says which release is next and whether it is ready to cut (`release_standing.py`), from the plan, the changelog and the tags, picks the item the next chunk takes first (`next_chunk.py`), and marks each item that a ready pull request finishes (`awaiting_merge.py`), for `chunk_preflight` and `loop_claude`. -- `repo_checks/` tests the repo itself. -- `rest_client/` sends a JSON request to a REST API and reads its credentials from an env file, for `notifier`, `atlassian` and `record_store`. - `review_rules/` holds the larv-review rules that several tools apply: its passes, its review folder, its round commit titles and the comprehension history's format. + +#### Git, forges and Atlassian + +- `adf_codec/` converts markdown to ADF, the rich text of Jira Cloud and Confluence, and back, in a throwaway container running a pinned `@larvit/adf-codec`. It builds the container's image inside a heavy slot. +- `atlassian/` holds what the Jira and Confluence backends share (`client.py`): one Atlassian account's credentials, the request both backends send, and each service's error messages. `jira.py` holds what every reader of Jira shares: a search read page by page, the key, fields, links and property of each issue it finds, checked for their shape, and the transition that finishes an issue, for `plan_store` and `do_epic`. +- `forge/` tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (`commands.py`), finds a pull request, lists the ready ones and reads its checks, once or until they settle (`pulls.py`), and reads a pull request's review state (`reviews.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release`, `do_epic` and `larv_review`. +- `git_cli/` runs git for every tool (`git_repo.py`), reads the git calls in a shell command (`git_command.py`), and keeps an epic's working branch level with the default branch (`epic_branch.py`). +- `rest_client/` sends a JSON request to a REST API and reads its credentials from an env file, for `notifier`, `atlassian` and `record_store`. + +#### Measuring and replaying + +- `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes`, `routing_figures` and `task_bench`. It imports `reading_cost`'s record path. +- `judge_replay` imports `agent_cycle`'s judge and verdicts, and `chunk_driver`'s premises, records and `ANSWER_DESTINATIONS`. - `routing_figures/` measures loop-claude's archive, and each of its projects' default branches, for loop-claude's routing calls. - `rung_replay/` holds what `judge_replay` and `review_replay` share: the parallel replay runner, the argument reader, the candidate rungs and the exits, and `judge_replay`'s rung search. It reads `agent_cycle`'s retry count and `chunk_driver`'s models file, and finds that file through `loop_state`'s paths. Its `archive.py` keeps each replay's runs and its report in a `replays/` folder of loop-claude's archive. -- `task_bench/` holds `task-bench`, which plants bugs in a project's Go, PHP, Python, Rust, TypeScript and JavaScript files, or takes the project's bench features, its data sources or the features its history shipped, and has Haiku fix, build or add them in containers. -- `test_env.py` serves the tests. +- `task_bench/` holds `task-bench`, which has Haiku fix, build or add a task in containers: a bug planted in a project's Go, PHP, Python, Rust, TypeScript and JavaScript files (`bugs/`), or one of the project's bench features, its data sources or the features its history shipped (`features/`). `figures/` measures the runs and holds `task-bench gather`. + +#### The shell, the machine and text + +- `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`. +- `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy` and `adf_codec`, and reads the memory share that loop-claude waits for. It also gives `mutate_changes` a slot's CPU count. - `text_files/` reads a Markdown file's `##` sections, quotes a passage and joins names into a list, reads the text piped into a command, stamps times in UTC, replaces a file in one step, private where it is new, and gzips a file beside its plain name, by which it reads it afterwards. -- `transcript_archive/` stores loop-claude's transcripts. Its `project_key.py` names each project's archive folder, loop-claude session and models-file entry. + +#### Tests and tools of one file + +- `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them. +- `repo_checks/` tests the repo itself. +- `test_env.py` serves the tests. ## Test diff --git a/bin/chunk_preflight/main.py b/bin/chunk_preflight/main.py index c9560eb5..aa0d5567 100644 --- a/bin/chunk_preflight/main.py +++ b/bin/chunk_preflight/main.py @@ -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 ` 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 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 `, + 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 diff --git a/bin/chunk_preflight/test_chunk_preflight.py b/bin/chunk_preflight/test_chunk_preflight.py index 2ec1ee14..ed6a98bb 100644 --- a/bin/chunk_preflight/test_chunk_preflight.py +++ b/bin/chunk_preflight/test_chunk_preflight.py @@ -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 ` 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) diff --git a/bin/deploy_release/cut.py b/bin/deploy_release/cut.py index b6f795af..13aba90e 100644 --- a/bin/deploy_release/cut.py +++ b/bin/deploy_release/cut.py @@ -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: diff --git a/bin/deploy_release/main.py b/bin/deploy_release/main.py index ff665415..5260c6ad 100644 --- a/bin/deploy_release/main.py +++ b/bin/deploy_release/main.py @@ -18,7 +18,7 @@ memory, stay as they are. --cut runs in the development clone, and refuses where that clone's origin isn't '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 diff --git a/bin/do_epic/parking.py b/bin/do_epic/parking.py index d24d529c..17926e46 100644 --- a/bin/do_epic/parking.py +++ b/bin/do_epic/parking.py @@ -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. diff --git a/bin/project_config/settings.py b/bin/project_config/settings.py index f9734396..9e615af2 100644 --- a/bin/project_config/settings.py +++ b/bin/project_config/settings.py @@ -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) diff --git a/bin/release_plan/next_chunk.py b/bin/release_plan/next_chunk.py index 5d932ff6..5107c36d 100644 --- a/bin/release_plan/next_chunk.py +++ b/bin/release_plan/next_chunk.py @@ -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 ` 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 "" + 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 `- renamed to ` 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.") diff --git a/bin/release_plan/release_standing.py b/bin/release_plan/release_standing.py index e4ef5bc8..1ca98ded 100644 --- a/bin/release_plan/release_standing.py +++ b/bin/release_plan/release_standing.py @@ -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 `: 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 `. 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) diff --git a/bin/release_plan/test_release_standing.py b/bin/release_plan/test_release_standing.py index 349f5854..fe4e477b 100644 --- a/bin/release_plan/test_release_standing.py +++ b/bin/release_plan/test_release_standing.py @@ -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" diff --git a/bin/task_bench/bugs/__init__.py b/bin/task_bench/bugs/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bin/task_bench/go_bugs.py b/bin/task_bench/bugs/go_bugs.py similarity index 99% rename from bin/task_bench/go_bugs.py rename to bin/task_bench/bugs/go_bugs.py index 714178e4..e6b6fe02 100644 --- a/bin/task_bench/go_bugs.py +++ b/bin/task_bench/bugs/go_bugs.py @@ -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 diff --git a/bin/task_bench/php_bugs.py b/bin/task_bench/bugs/php_bugs.py similarity index 98% rename from bin/task_bench/php_bugs.py rename to bin/task_bench/bugs/php_bugs.py index 5c8627bb..f72a771d 100644 --- a/bin/task_bench/php_bugs.py +++ b/bin/task_bench/bugs/php_bugs.py @@ -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" diff --git a/bin/task_bench/plant.py b/bin/task_bench/bugs/plant.py similarity index 96% rename from bin/task_bench/plant.py rename to bin/task_bench/bugs/plant.py index cb40a9b1..6474616d 100644 --- a/bin/task_bench/plant.py +++ b/bin/task_bench/bugs/plant.py @@ -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: `:` in backticks. diff --git a/bin/task_bench/planted_mutant.py b/bin/task_bench/bugs/planted_mutant.py similarity index 98% rename from bin/task_bench/planted_mutant.py rename to bin/task_bench/bugs/planted_mutant.py index 45400067..964550c8 100644 --- a/bin/task_bench/planted_mutant.py +++ b/bin/task_bench/bugs/planted_mutant.py @@ -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) diff --git a/bin/task_bench/python_bugs.py b/bin/task_bench/bugs/python_bugs.py similarity index 98% rename from bin/task_bench/python_bugs.py rename to bin/task_bench/bugs/python_bugs.py index 95ec5203..70e2895d 100644 --- a/bin/task_bench/python_bugs.py +++ b/bin/task_bench/bugs/python_bugs.py @@ -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. diff --git a/bin/task_bench/rust_bugs.py b/bin/task_bench/bugs/rust_bugs.py similarity index 99% rename from bin/task_bench/rust_bugs.py rename to bin/task_bench/bugs/rust_bugs.py index 6a1a6cd1..941e5fd9 100644 --- a/bin/task_bench/rust_bugs.py +++ b/bin/task_bench/bugs/rust_bugs.py @@ -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 diff --git a/bin/task_bench/rust_test_modules.py b/bin/task_bench/bugs/rust_test_modules.py similarity index 100% rename from bin/task_bench/rust_test_modules.py rename to bin/task_bench/bugs/rust_test_modules.py diff --git a/bin/task_bench/scratch_copy.py b/bin/task_bench/bugs/scratch_copy.py similarity index 100% rename from bin/task_bench/scratch_copy.py rename to bin/task_bench/bugs/scratch_copy.py diff --git a/bin/task_bench/test_go_bugs.py b/bin/task_bench/bugs/test_go_bugs.py similarity index 98% rename from bin/task_bench/test_go_bugs.py rename to bin/task_bench/bugs/test_go_bugs.py index 1ee49fa9..d43f378b 100644 --- a/bin/task_bench/test_go_bugs.py +++ b/bin/task_bench/bugs/test_go_bugs.py @@ -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. diff --git a/bin/task_bench/test_php_bugs.py b/bin/task_bench/bugs/test_php_bugs.py similarity index 99% rename from bin/task_bench/test_php_bugs.py rename to bin/task_bench/bugs/test_php_bugs.py index edea21b7..aaa694b7 100644 --- a/bin/task_bench/test_php_bugs.py +++ b/bin/task_bench/bugs/test_php_bugs.py @@ -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 = """ Option { diff --git a/bin/task_bench/test_rust_test_modules.py b/bin/task_bench/bugs/test_rust_test_modules.py similarity index 98% rename from bin/task_bench/test_rust_test_modules.py rename to bin/task_bench/bugs/test_rust_test_modules.py index 6db68697..35a2ba48 100644 --- a/bin/task_bench/test_rust_test_modules.py +++ b/bin/task_bench/bugs/test_rust_test_modules.py @@ -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 { diff --git a/bin/task_bench/test_scratch_copy.py b/bin/task_bench/bugs/test_scratch_copy.py similarity index 97% rename from bin/task_bench/test_scratch_copy.py rename to bin/task_bench/bugs/test_scratch_copy.py index 3d85d2cb..265fd02b 100644 --- a/bin/task_bench/test_scratch_copy.py +++ b/bin/task_bench/bugs/test_scratch_copy.py @@ -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): diff --git a/bin/task_bench/test_typescript_bugs.py b/bin/task_bench/bugs/test_typescript_bugs.py similarity index 98% rename from bin/task_bench/test_typescript_bugs.py rename to bin/task_bench/bugs/test_typescript_bugs.py index 86038c69..c0254875 100644 --- a/bin/task_bench/test_typescript_bugs.py +++ b/bin/task_bench/bugs/test_typescript_bugs.py @@ -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 { diff --git a/bin/task_bench/typescript_bugs.py b/bin/task_bench/bugs/typescript_bugs.py similarity index 98% rename from bin/task_bench/typescript_bugs.py rename to bin/task_bench/bugs/typescript_bugs.py index 762e132f..6a9c511e 100644 --- a/bin/task_bench/typescript_bugs.py +++ b/bin/task_bench/bugs/typescript_bugs.py @@ -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. diff --git a/bin/task_bench/features/__init__.py b/bin/task_bench/features/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bin/task_bench/feature_tasks.py b/bin/task_bench/features/feature_tasks.py similarity index 97% rename from bin/task_bench/feature_tasks.py rename to bin/task_bench/features/feature_tasks.py index e0392f45..0ac1f759 100644 --- a/bin/task_bench/feature_tasks.py +++ b/bin/task_bench/features/feature_tasks.py @@ -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" diff --git a/bin/task_bench/registers.py b/bin/task_bench/features/registers.py similarity index 98% rename from bin/task_bench/registers.py rename to bin/task_bench/features/registers.py index bdc9279f..60226c88 100644 --- a/bin/task_bench/registers.py +++ b/bin/task_bench/features/registers.py @@ -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. diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/features/shipped_features.py similarity index 96% rename from bin/task_bench/shipped_features.py rename to bin/task_bench/features/shipped_features.py index cabefdd4..f06cb9d4 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/features/shipped_features.py @@ -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. diff --git a/bin/task_bench/test_feature_tasks.py b/bin/task_bench/features/test_feature_tasks.py similarity index 99% rename from bin/task_bench/test_feature_tasks.py rename to bin/task_bench/features/test_feature_tasks.py index 2232fed0..8cae37cf 100644 --- a/bin/task_bench/test_feature_tasks.py +++ b/bin/task_bench/features/test_feature_tasks.py @@ -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 diff --git a/bin/task_bench/test_registers.py b/bin/task_bench/features/test_registers.py similarity index 98% rename from bin/task_bench/test_registers.py rename to bin/task_bench/features/test_registers.py index 1a3b492d..aac80402 100644 --- a/bin/task_bench/test_registers.py +++ b/bin/task_bench/features/test_registers.py @@ -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 diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/features/test_shipped_features.py similarity index 99% rename from bin/task_bench/test_shipped_features.py rename to bin/task_bench/features/test_shipped_features.py index 5e9c0555..911b42c6 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/features/test_shipped_features.py @@ -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" diff --git a/bin/task_bench/figures/__init__.py b/bin/task_bench/figures/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bin/task_bench/digest.py b/bin/task_bench/figures/digest.py similarity index 99% rename from bin/task_bench/digest.py rename to bin/task_bench/figures/digest.py index b09bbadd..6abd92e9 100644 --- a/bin/task_bench/digest.py +++ b/bin/task_bench/figures/digest.py @@ -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 diff --git a/bin/task_bench/figures.py b/bin/task_bench/figures/figures.py similarity index 100% rename from bin/task_bench/figures.py rename to bin/task_bench/figures/figures.py diff --git a/bin/task_bench/gather-prompt.md b/bin/task_bench/figures/gather-prompt.md similarity index 100% rename from bin/task_bench/gather-prompt.md rename to bin/task_bench/figures/gather-prompt.md diff --git a/bin/task_bench/gather.py b/bin/task_bench/figures/gather.py similarity index 100% rename from bin/task_bench/gather.py rename to bin/task_bench/figures/gather.py diff --git a/bin/task_bench/record_figures.py b/bin/task_bench/figures/record_figures.py similarity index 95% rename from bin/task_bench/record_figures.py rename to bin/task_bench/figures/record_figures.py index 4d8d4bea..d668fd99 100644 --- a/bin/task_bench/record_figures.py +++ b/bin/task_bench/figures/record_figures.py @@ -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} diff --git a/bin/task_bench/test_digest.py b/bin/task_bench/figures/test_digest.py similarity index 99% rename from bin/task_bench/test_digest.py rename to bin/task_bench/figures/test_digest.py index a3758a02..eed11eba 100644 --- a/bin/task_bench/test_digest.py +++ b/bin/task_bench/figures/test_digest.py @@ -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 diff --git a/bin/task_bench/test_figures.py b/bin/task_bench/figures/test_figures.py similarity index 98% rename from bin/task_bench/test_figures.py rename to bin/task_bench/figures/test_figures.py index 95fb1aa1..8a76f18a 100644 --- a/bin/task_bench/test_figures.py +++ b/bin/task_bench/figures/test_figures.py @@ -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 diff --git a/bin/task_bench/test_gather.py b/bin/task_bench/figures/test_gather.py similarity index 99% rename from bin/task_bench/test_gather.py rename to bin/task_bench/figures/test_gather.py index 0c0889b4..6728b03c 100644 --- a/bin/task_bench/test_gather.py +++ b/bin/task_bench/figures/test_gather.py @@ -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 diff --git a/bin/task_bench/test_record_figures.py b/bin/task_bench/figures/test_record_figures.py similarity index 98% rename from bin/task_bench/test_record_figures.py rename to bin/task_bench/figures/test_record_figures.py index 502c2eba..62c366b2 100644 --- a/bin/task_bench/test_record_figures.py +++ b/bin/task_bench/figures/test_record_figures.py @@ -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 diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 7b799de0..806d00b3 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -159,7 +159,7 @@ features the heading reads `task-bench features of : ...` instead, for o of : ...`, and for one of shipped features `task-bench shipped-features of : ...`. 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 --test [--base ] [--head ] [--prefix ] [--seed ] [--bugs ] [--runs ] [--record-figures], or task-bench --tasks features|data-sources --image --test [--base ] [--head ] [--runs ] [--record-figures], or task-bench --tasks shipped-features --image --test [--base ] [--head ] [--shipped ] [--runs ] [--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. diff --git a/bin/task_bench/runs.py b/bin/task_bench/runs.py index 28337af8..e359ac2b 100644 --- a/bin/task_bench/runs.py +++ b/bin/task_bench/runs.py @@ -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. diff --git a/bin/task_bench/tasks.py b/bin/task_bench/tasks.py index 541098b7..2e812a39 100644 --- a/bin/task_bench/tasks.py +++ b/bin/task_bench/tasks.py @@ -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"] diff --git a/bin/task_bench/test_task_bench.py b/bin/task_bench/test_task_bench.py index e6d60024..eba658b3 100644 --- a/bin/task_bench/test_task_bench.py +++ b/bin/task_bench/test_task_bench.py @@ -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 diff --git a/docs/decisions.md b/docs/decisions.md index 03c1d12d..2d3b64c9 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -154,7 +154,7 @@ Valid while `~/.claude` is a checkout of this repo. 2026-11-08, lilleman, todo item 271. Serves goal 1.5 and goal 2. Nobody can push to `main` on the remote, and it merges only by fast-forward, so a cut that commits on `main` and pushes no longer works. The tool cuts only the release `chunk-preflight` would call ready to cut, through `bin/release_plan/release_standing.py`, so the two never disagree on which release is next or whether it is ready; the version is that release's, never the tool's choice. It builds the cut commit in a worktree of its own, so the clone's checkout stays as it is. It finds the merged commit on `main` by its title, `Cut release `, since GitHub's nearest merge, a rebase merge, may give the commit a new hash. It takes only a pull request from origin's own branch whose head is the commit that branch points at, and has the forge merge it only while its head is still that commit, so a fork's pull request from a branch of the same name, or a push after the checks passed, is never merged and deployed. Each step first checks whether an earlier run did it, so a rerun continues. Releases stay the human's, so the human runs it, and the forge credentials stay theirs. Valid while `main` takes changes only through a pull request. -2026-11-24, lilleman, todo item 536. `deploy-release --cut-patch ` cuts the newest tag's next patch release, holding only the commits named, for a fix that must ship before `main`'s other unreleased work. Before it, 0.15.1 was cut by those steps by hand. The patch's commit has the tag as its parent, not `main`'s head, so no pull request into `main` can merge it, and CI runs only on pull requests: the tool runs `ci.sh` on it, as CI does, before it tags. Then it merges the tag back into `main` with `-s ours` through a pull request, so the tag is in `main`'s history, where the next cut and `chunk-preflight` read it, and a release review on `main` counts only for a release later than the last cut. GitHub's rebase merge would drop that merge commit, so the tool refuses a GitHub origin. A patch skips the release review: `chunk-preflight` still calls it due until the patch is cut, so cut a patch as soon as its fix merges. Plain `--cut` refuses a patch of the newest tag, since it would ship all of `main` under a patch number. A panel of three readers seated as the owner picked the spelling `--cut-patch` over `--cut --patch` and `--hotfix`: one flag that names the action, which can't be read as a plain `--cut`. +2026-11-24, lilleman, todo item 536. `deploy-release --cut-patch ` cuts the newest tag's next patch release, holding only the commits named, for a fix that must ship before `main`'s other unreleased work. Before it, 0.15.1 was cut by those steps by hand. The patch's commit has the tag as its parent, not `main`'s head, so no pull request into `main` can merge it, and CI runs only on pull requests: the tool runs `ci.sh` on it, as CI does, before it tags. Then it merges the tag back into `main` with `-s ours` through a pull request, so the tag is in `main`'s history, where the next cut and `chunk-preflight` read it. 2026-11-27, lilleman, the release review of 0.16.0: a release review on `main` counts only for the release its title names, which must be the next release exactly, as `chunk-preflight --help` states. So the patch's own review, which the merge leaves on `main` after the tag, reviews no later release, and neither does a review opened under a release name todo.md has since changed. GitHub's rebase merge would drop that merge commit, so the tool refuses a GitHub origin. A patch skips the release review: `chunk-preflight` still calls it due until the patch is cut, so cut a patch as soon as its fix merges. Plain `--cut` refuses a patch of the newest tag, since it would ship all of `main` under a patch number. A panel of three readers seated as the owner picked the spelling `--cut-patch` over `--cut --patch` and `--hotfix`: one flag that names the action, which can't be read as a plain `--cut`. ## do-epic: drives one Jira epic whose items span repos, or have none, ranked by the epic's goals, then code health, then each repo's goals, and closes the epic only once the human confirms every goal @@ -533,7 +533,7 @@ The base is the last measured commit: the default branch's newest merged change ## review: the architecture and principles passes run only in the release review, a release's last chunk, which must land before the release is ready to cut; between releases the product-owner pass reviews changes to what consumers rely on -2026-10-29, lilleman. Serves goals 1.4 and 1.5, and code health. The principles audit read the whole project on every chunk that changed code, because small changes had let a project drift; it was the costliest reviewer after the worker, and it filed findings unrelated to the chunk. A per-chunk architecture trigger needs judgment about what a change carries, which a worker knows only after the work, and a planner or worker asking for the review would pile up agents. So both passes run once, over the whole project, in the release review: the chunk that runs once a release holds no item and changes are unreleased. They may refactor boldly, five rounds each, and their fixes take the stability, security, overrides and prose passes, two rounds each. The human sets how much drift a review must catch through how big a release is. Between releases, the product-owner pass reviews changes to what consumers rely on, such as routes, file formats and CLI flags, which the architecture trigger used to cover. `chunk-preflight` reports a release review due until a commit titled `Release review of ` follows the newest `v*` tag, and only then the release ready to cut. A project that deploys every merge, as this repo does, carries drift into production until its release review; lilleman means to move such projects onto releases. Valid while drift a release's chunks leave stays small enough for one review to fix. +2026-10-29, lilleman. Serves goals 1.4 and 1.5, and code health. The principles audit read the whole project on every chunk that changed code, because small changes had let a project drift; it was the costliest reviewer after the worker, and it filed findings unrelated to the chunk. A per-chunk architecture trigger needs judgment about what a change carries, which a worker knows only after the work, and a planner or worker asking for the review would pile up agents. So both passes run once, over the whole project, in the release review: the chunk that runs once a release holds no item and changes are unreleased. They may refactor boldly, five rounds each, and their fixes take the stability, security, overrides and prose passes, two rounds each. The human sets how much drift a review must catch through how big a release is. Between releases, the product-owner pass reviews changes to what consumers rely on, such as routes, file formats and CLI flags, which the architecture trigger used to cover. `chunk-preflight` reports a release review due until that review has landed, and only then the release ready to cut; `chunk-preflight --help` says which commit counts. A project that deploys every merge, as this repo does, carries drift into production until its release review; lilleman means to move such projects onto releases. Valid while drift a release's chunks leave stays small enough for one review to fix. ## review: the principles audit runs only in the release review, and reads the project whole with one auditor checking the goals and every principles file that applies diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index b935960e..e3a491e4 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -99,20 +99,31 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h - **Done.** A pass is done when its latest round leaves no ๐Ÿ”ด or ๐ŸŸก standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or settled in the PR summary per "Comprehension check" โ†’ "Places", or, for the prose pass and a pass at its cap, fixed. A stability pass whose round's fixes skip the next round per "Re-entry" โ†’ "Mechanical answers" is done once that rule's run is clean. Resolve that round's ๐ŸŸขs and โ“s per "Findings" too. - **Cap.** A pass takes at most two rounds per chunk, and the release review's architecture and principles passes five; don't ask the user for more. Answer its last round's findings per "Findings": those fixes merge once the gate passes, unreviewed by that pass. rule-hook's `round-cap` refuses a round commit that would take a pass past its cap, and no override waives it. A review the auto-reviewer posts after its second isn't a round: fix none of it and rerun no pass for it, but file a security finding it raises per `~/.claude/CLAUDE.md` โ†’ "Working loop", and any other ๐Ÿ”ด in `todo.md`. -**Re-entry.** A fix is a change no pass has seen. A fix for a ๐ŸŸข or a โ“ doesn't rerun any pass, whatever it changes. A fix for a ๐ŸŸก of a pass other than prose meets only the ๐ŸŸก row below, and a fix for a prose finding, of any severity, only the last row. A round's fixes for ๐Ÿ”ด findings, its ๐ŸŸก fixes that meet that row, and its prose fixes that meet the last row, re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then ยง4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" โ†’ "Cap"). +**Re-entry.** A fix is a change no pass has seen. It reruns the pass of every row below that it fits in both columns: -| The fix | Reruns | -|---------|--------| -| answers a ๐Ÿ”ด of a pass other than prose | that pass | -| answers a ๐ŸŸก of a pass other than prose, and removes or loosens an assertion, changes an expected value, or skips, deletes or guards a test or assertion with a condition or a catch, unless it only kills a named mutant or makes a named failing test pass | that pass | -| carries an architectural decision, in the release review | Architecture | -| changes code, config or tests, in the release review | Principles | -| opens an untrusted-input boundary or touches authn/authz, secrets or crypto | Security, unless the full scan reruns on it | -| made rule-hook log an override | Overrides | -| changes behaviour: what the code or its tests do | Stability | -| answers a prose finding by rewriting what a claim says, where a command or a source file can check the claim, such as what generated output holds, a number or a licence term; rewording that keeps what it says doesn't count | Prose, as its second and last round | +| The fix answers | and | Reruns | +|-----------------|-----|--------| +| a ๐Ÿ”ด of a pass other than prose | changes anything | that pass | +| a ๐Ÿ”ด of a pass other than prose | carries an architectural decision, in the release review | Architecture | +| a ๐Ÿ”ด of a pass other than prose | changes code, config or tests, in the release review | Principles | +| a ๐Ÿ”ด of a pass other than prose | opens an untrusted-input boundary or touches authn/authz, secrets or crypto | Security, unless the full scan reruns on it | +| a ๐Ÿ”ด of a pass other than prose | made rule-hook log an override | Overrides | +| a ๐Ÿ”ด of a pass other than prose | changes behaviour: what the code or its tests do | Stability | +| a ๐ŸŸก of a pass other than prose | removes or loosens an assertion, changes an expected value, or skips, deletes or guards a test or assertion with a condition or a catch | that pass | +| a prose finding, of any severity | rewrites what a claim says, where a command or a source file can check the claim, such as what generated output holds, a number or a licence term | Prose, as its second and last round | -A fix meets every row it fits, except the two fixes named above, each of which meets only its one row. Such a fix meets no row once ยง2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"); a skipped test kills no mutant. A comment or doc edit inside a fix for another pass's finding doesn't rerun any pass. Example: a fix for a stability ๐Ÿ”ด that changes code and a comment reruns Principles and Stability. +Example: in the release review, a fix for a stability ๐Ÿ”ด that changes code and a comment reruns Stability and Principles. + +A fix that fits no row doesn't rerun any pass. So none of these does: + +- a fix for a ๐ŸŸข or a โ“, whatever it changes; +- a fix for a ๐ŸŸก that does none of what the ๐ŸŸก row lists; +- a fix for a prose finding that rewords a claim and keeps what it says; +- a comment or doc edit inside a fix for another pass's finding, since no row reruns Prose for it. + +One fix fits the ๐ŸŸก row and still doesn't rerun the pass: a fix that only kills a named mutant or makes a named failing test pass, once ยง2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"). A skipped test kills no mutant. + +A round's fixes re-enter together: run every pass the table names for any of them, a done pass included, in the waves of "Waves", then ยง4. "Mechanical answers" below names the one case where the fixes for a ๐Ÿ”ด don't rerun its pass. A pass at its cap doesn't run again ("Round cap" โ†’ "Cap"). **Mechanical answers.** A stability round's fixes may skip the next stability round. That holds where the round reported a ๐Ÿ”ด, and each of its ๐Ÿ”ด and ๐ŸŸก findings asked only that a named mutant be killed or a named failing test pass. Run ยง2's tests and mutation command on the fixes, and fix again per ยง2 until they leave no failing test and no surviving mutant that changes behaviour. Each named failing test must pass as the round found it, not edited or deleted. Then the stability pass doesn't run again, and the round's answer commit title ends `; tests and mutants clean at `. The fixes still rerun each other pass whose row they meet. Where the run can't be made clean, or a fix edits a named failing test, the stability pass runs again as the table says. @@ -140,7 +151,7 @@ A fix meets every row it fits, except the two fixes named above, each of which m The release review is a release's last chunk, run once the release holds no item and changes are unreleased, before it is ready to cut. It looks for the drift the release's small changes left, and fixes it. -- **When.** `chunk-preflight` reports a release review due. It counts one as landed once a commit titled `Release review of ` follows the newest `v*` tag on the default branch. +- **When.** `chunk-preflight` reports a release review due. `chunk-preflight --help` says which commit it counts as the review landed. - **Branch.** `release-review-`, off the default branch. Open it with `git commit --allow-empty -m "Release review of "`. - **Passes.** Architecture, then Principles, each over the whole project, per "Waves". Tell both to refactor boldly where the code needs it. Each takes up to five rounds. - **Their fixes** re-enter Stability, Security, Overrides and Prose per "Re-entry", each at most two rounds. diff --git a/todo.md b/todo.md index 844333f6..36bb15e7 100644 --- a/todo.md +++ b/todo.md @@ -169,17 +169,17 @@ Touches: Rust may keep its unit tests out of line: `#[cfg(test)] mod tests;` in `src/lib.rs`, the tests in `src/tests.rs`. `mutate_changes.changed_lines.is_test` tells a test by a folder named `test`, `tests` or `__tests__`, or by a file name such as `test_*.py` or `*_test.go`, so `src/tests.rs` counts as code, and `checked_tree` in `bin/task_bench/runs.py` takes it as Haiku left it. A fix that edits or deletes the failing test there passes. The help's Check paragraph says so. It holds at the base and at the head alike. -Recommended: treat as a test a `.rs` file that a `#[cfg(test)] mod ;` declaration in another file of the planted tree names (src/.rs or src//mod.rs, beside the declaring file), found with the scanner in `bin/task_bench/rust_test_modules.py`; where the file cannot be found, pass the mutant over. A product-owner / stability finding on item 532's chunk raised this. Changing `is_test` itself would change what `mutate-changes` skips, so keep the change inside task-bench. +Recommended: treat as a test a `.rs` file that a `#[cfg(test)] mod ;` declaration in another file of the planted tree names (src/.rs or src//mod.rs, beside the declaring file), found with the scanner in `bin/task_bench/bugs/rust_test_modules.py`; where the file cannot be found, pass the mutant over. A product-owner / stability finding on item 532's chunk raised this. Changing `is_test` itself would change what `mutate-changes` skips, so keep the change inside task-bench. Touches: - `bin/task_bench/runs.py`: `of_tests`, `checked_tree` (small) -- `bin/task_bench/rust_test_modules.py` +- `bin/task_bench/bugs/rust_test_modules.py` - `bin/task_bench/test_task_bench.py` - `bin/task_bench/main.py`: lines 30-37 ### 544. Leave out of a `task-bench` fix a change Haiku makes to a PHP or JavaScript test that PHPUnit or `node --test` finds by a name `is_test` does not know. -PHPUnit finds a test by `*Test.php`, wherever it stands, and `node --test` also by `*-test.js`, `*_test.js`, `test-*.js` and `test.js`, with `.ts`, `.mjs` and `.cjs` alike. `mutate_changes.changed_lines.is_test` tells a test by a folder named `test`, `tests` or `__tests__`, or by a name such as `*.test.*`, so `src/PickTest.php` and `src/pick-test.js` count as code. `checked_tree` in `bin/task_bench/runs.py` then takes such a file as Haiku left it, so a fix that edits or deletes the failing test passes, at both sides alike, and `place_files` in `bin/task_bench/plant.py` may hand the file to the mutation tool as code. The help's Check paragraph says so. +PHPUnit finds a test by `*Test.php`, wherever it stands, and `node --test` also by `*-test.js`, `*_test.js`, `test-*.js` and `test.js`, with `.ts`, `.mjs` and `.cjs` alike. `mutate_changes.changed_lines.is_test` tells a test by a folder named `test`, `tests` or `__tests__`, or by a name such as `*.test.*`, so `src/PickTest.php` and `src/pick-test.js` count as code. `checked_tree` in `bin/task_bench/runs.py` then takes such a file as Haiku left it, so a fix that edits or deletes the failing test passes, at both sides alike, and `place_files` in `bin/task_bench/bugs/plant.py` may hand the file to the mutation tool as code. The help's Check paragraph says so. Recommended: tell these names as tests inside task-bench, for a `.php` file and for the suffixes Stryker covers, and keep `is_test` as it is, since changing it would change what `mutate-changes` skips; item 539 does the same for Rust. A product-owner finding on item 527's chunk raised this. @@ -385,7 +385,7 @@ Seats launch as `general-purpose`, so they hide inside that type: $301.24 of the ### 323. Count a release review as landed once its pull request has merged, whatever its commits are titled. -`release_reviewed` in `bin/release_plan/release_standing.py` counts a release review only by a commit titled `Release review of ` on the default branch. In a replay of archived interrupts (`judge-field-trials/`), in two projects whose release review had merged, the default branch held no such commit, so `chunk-preflight` and routing read ReviewDue, and the next loop would run the release review again. `skills/larv-review/SKILL.md` opens the review's branch with an empty commit of that title, but a worker may skip it, and a rebase or squash merge, which `chunk-pr` uses where the forge allows no merge commit, may drop it. Detect the review by something every merge method keeps, and check the fix against both projects' histories. Until then the judge keeps `release_ready` (docs/decisions.md โ†’ `routing: loop-claude reads the items a chunk takes โ€ฆ`). +`reviewed_releases` in `bin/release_plan/release_standing.py` counts a release review only by a commit titled `Release review of ` on the default branch. In a replay of archived interrupts (`judge-field-trials/`), in two projects whose release review had merged, the default branch held no such commit, so `chunk-preflight` and routing read ReviewDue, and the next loop would run the release review again. `skills/larv-review/SKILL.md` opens the review's branch with an empty commit of that title, but a worker may skip it, and a rebase or squash merge, which `chunk-pr` uses where the forge allows no merge commit, may drop it. Detect the review by something every merge method keeps, and check the fix against both projects' histories. Until then the judge keeps `release_ready` (docs/decisions.md โ†’ `routing: loop-claude reads the items a chunk takes โ€ฆ`). ### 342. Research the tooling agents read, search and run commands with once more, and file an item for each tool that cuts tokens a replay shows keep quality.