Group bin's root modules into packages named by purpose, and make rank_todo.py a launcher of release_plan/ranking.py

This commit is contained in:
2026-11-08 20:35:52 +01:00
parent 25997ba9ec
commit 8d9a39de1c
115 changed files with 915 additions and 927 deletions
+1 -3
View File
@@ -1,9 +1,7 @@
import pathlib
from failure import Failure
import git_repo
from git_cli import git_repo
def guarded_git(directory: str, *args: str) -> str | Failure:
"""What git printed in directory, stripped, run guarded: the hook runs git in a checkout the call has not yet been allowed to touch."""
ran = git_repo.git(*args, cwd=directory, guarded=True)
+2 -2
View File
@@ -1,6 +1,6 @@
"""Whether a simple command is a heavy one, for the `run-heavy` rule: a docker build, or a run of a mutation tool."""
from docker_command import docker_subcommand
from shell_command import launched, tool_name
from command_lines.docker_command import docker_subcommand
from command_lines.shell_command import launched, tool_name
# Each mutation tool, and the words that make its call a mutation run when one of them follows it within two words; where the set is empty, every call is one.
MUTATORS = {"cargo": {"mutants"}, "infection": set(), "mutmut": {"run"}, "stryker": {"run"}}
+2 -2
View File
@@ -38,14 +38,14 @@ import typing
from rule_hook.call import applied, Call, FILE_TOOLS, parsed_call, text
from rule_hook.rules import Breach, check, Checked, command_breaches, file_breaches, rules_help
from git_command import commits
from git_cli.git_command import commits
from failure import Failure
from rule_hook.override_log import Log, log_path, logged, print_overrides, write_override
from rule_hook.repeat_read import read_breaches
from rule_hook.reviewer_report import report_breaches
from rule_hook.reviewer_rung import reviewer_breaches, skill_breaches
from rule_hook.round_cap import round_cap_breaches
from shell_command import simple_commands
from command_lines.shell_command import simple_commands
from rule_hook.todo_check import todo_breaches
+2 -2
View File
@@ -6,10 +6,10 @@ import sys
import typing
from rule_hook.rules import Breach
from git_repo import default_ref
from git_cli.git_repo import default_ref
from rule_hook.git import existing, guarded_git
from failure import Failure
from utc_stamp import utc
from records.utc_stamp import utc
LOG = "rule-overrides.tsv"
+1 -1
View File
@@ -14,7 +14,7 @@ from rule_hook.call import Call, FILE_TOOLS, text
from claude_code.transcript import current_thread, read_transcript
from failure import Failure
from claude_code.entries import parts, tool_call, tool_result, tool_use_id
from shell_command import resolved, simple_commands
from command_lines.shell_command import resolved, simple_commands
# The lines a Read without a limit returns.
READ_LIMIT = 2000
+1 -1
View File
@@ -4,7 +4,7 @@ import pathlib
from rule_hook.rules import Breach
from rule_hook.call import Call
from review_folder import REPORTS
from review_rules.review_folder import REPORTS
# Each agent under agents/, read from the folder, so an agent the routing tables miss is still confined.
AGENT_FILES = frozenset(path.stem for path in (pathlib.Path(__file__).resolve().parents[2] / "agents").glob("*.md"))
+2 -2
View File
@@ -5,11 +5,11 @@ from rule_hook.rules import Breach
from rule_hook.call import Call, text
from claude_code.entries import content
from failure import Failure
import git_repo
from git_cli import git_repo
from rule_hook.git import guarded_git
from model_routing.worker_rungs import handed
from model_routing.ladder import position, review_rung, ReviewKind, Rung
from review_passes import prose, REVIEWERS
from review_rules.review_passes import prose, REVIEWERS
from claude_code.transcript import read_transcript
# The pass each agent under agents/ reviews.
+4 -4
View File
@@ -1,9 +1,9 @@
from rule_hook.rules import Breach
from round_titles import cap, past_cap, round_counts, round_pass
from git_command import CommitCall
from review_rules.round_titles import cap, past_cap, round_counts, round_pass
from git_cli.git_command import CommitCall
from failure import Failure
import git_repo
from review_passes import PASSES
from git_cli import git_repo
from review_rules.review_passes import PASSES
def round_cap_breaches(commit: CommitCall) -> list[Breach]:
+5 -5
View File
@@ -3,13 +3,13 @@ import posixpath
import re
import typing
from round_titles import CAP, lacks_counts, RELEASE_REVIEW_CAP
from git_command import commits
from review_rules.round_titles import CAP, lacks_counts, RELEASE_REVIEW_CAP
from git_cli.git_command import commits
from run_heavy.capped_docker import finds_this_docker
from rule_hook.heavy_command import heavy
from shell_command import launched, Simple
from review_folder import REPORTS
from docker_command import unlimited
from command_lines.shell_command import launched, Simple
from review_rules.review_folder import REPORTS
from command_lines.docker_command import unlimited
RuleName = typing.Literal["action-pin", "commit-one-line", "docker-run-memory", "ignorefile-sorted", "image-pin", "no-ai-attribution", "repeat-read", "reviewer-report", "reviewer-rung", "round-cap", "round-title-counts", "run-heavy", "todo-rank-check"]
+3 -3
View File
@@ -15,13 +15,13 @@ from rule_hook.repeat_read import Asked, modified, read_breaches, result_lines
from rule_hook.rules import blocks, Breach, check, command_breaches, file_breaches, overrides
from rule_hook.main import breaches_of
from rule_hook.call import Call, parsed_call
from git_command import commit_message, CommitCall, commits
from test_rank_todo import DECISIONS, README, TODO
from git_cli.git_command import commit_message, CommitCall, commits
from release_plan.test_ranking import DECISIONS, README, TODO
from rule_hook.git import guarded_git
from test_env import isolated_env
from rule_hook.override_log import LogLine, parsed_entry, this_chunks
from rule_hook.reviewer_rung import reviewer_breaches, skill_breaches
from shell_command import segments, simple_commands
from command_lines.shell_command import segments, simple_commands
HOOK = pathlib.Path(__file__).resolve().parents[1] / "rule-hook"
# Built from parts, so this file carries no attribution of its own.
+2 -4
View File
@@ -4,15 +4,13 @@ import pathlib
from rule_hook.rules import Breach
from failure import Failure
from rule_hook.git import guarded_git
import rank_todo
from release_plan import ranking
def todo_breaches(directory: str) -> list[Breach]:
top = guarded_git(directory, "rev-parse", "--show-toplevel")
if isinstance(top, Failure) or not (pathlib.Path(top) / "todo.md").is_file():
return []
todo = pathlib.Path(top) / "todo.md"
return [Breach("todo-rank-check", line, top) for line in rank_todo.check_failures(todo)] if changed(top, todo) else []
return [Breach("todo-rank-check", line, top) for line in ranking.check_failures(todo)] if changed(top, todo) else []
def changed(top: str, todo: pathlib.Path) -> bool: