Answer stability round 1: 0 🔴, 14 🟡 (0 misread); tests that kill the surviving mutants, with a versioned MemoryStore and appended_to, plan/named_paths.py, TakenIn's docstring and the run-heavy rule naming LAUNCHERS; three places left to item 300
CI / tests (pull_request) Successful in 3m10s

This commit is contained in:
2026-11-16 16:53:36 +01:00
parent 79e0f755e2
commit 31da587415
19 changed files with 96 additions and 19 deletions
+1 -1
View File
@@ -210,7 +210,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
- `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. - `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`, 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. - `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`, 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`. - `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`.
- `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_code.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/` 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`) 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, which `jira_epic.py` doesn't yet, since it changes no link, and `fakes.py` a plan in memory. - `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, which `jira_epic.py` doesn't yet, since it changes no link, and `fakes.py` a plan in memory.
- `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them. - `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. - `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.
+6 -3
View File
@@ -1,4 +1,5 @@
import base64 import base64
import json
import pathlib import pathlib
import sys import sys
import tempfile import tempfile
@@ -30,8 +31,8 @@ class Jira(Served):
def test_an_error_answer_fails_with_jiras_messages_and_its_status(self): def test_an_error_answer_fails_with_jiras_messages_and_its_status(self):
base = self.serve((400, b'{"errorMessages": ["One."], "errors": {"jql": "Two."}}')) base = self.serve((400, b'{"errorMessages": ["One."], "errors": {"jql": "Two."}}'))
self.assertEqual(client.jira_json("POST", f"{base}/rest/api/3/search/jql", AUTHORIZATION, {"jql": "x"}), ErrorAnswer("POST /rest/api/3/search/jql answered 400: One.; Two.", 400)) self.assertEqual(client.jira_json("POST", f"{base}/rest/api/3/search/jql", AUTHORIZATION, {"jql": "x"}), ErrorAnswer("POST /rest/api/3/search/jql answered 400: One.; Two.", 400))
[(_, _, headers, _)] = self.server.got # type: ignore[attr-defined] [(_, _, headers, body)] = self.server.got # type: ignore[attr-defined]
self.assertEqual(headers["Authorization"], AUTHORIZATION) self.assertEqual((headers["Authorization"], json.loads(body)), (AUTHORIZATION, {"jql": "x"}))
def test_reads_jiras_messages_from_an_error_answer(self): def test_reads_jiras_messages_from_an_error_answer(self):
cases = ( cases = (
@@ -49,7 +50,9 @@ class Jira(Served):
class Confluence(Served): class Confluence(Served):
def test_an_error_answer_fails_with_confluences_messages_and_its_status(self): def test_an_error_answer_fails_with_confluences_messages_and_its_status(self):
base = self.serve((409, b'{"errors": [{"status": 409, "title": "Version must be incremented"}]}')) base = self.serve((409, b'{"errors": [{"status": 409, "title": "Version must be incremented"}]}'))
self.assertEqual(client.confluence_json("PUT", f"{base}/wiki/api/v2/pages/1", AUTHORIZATION, {}), ErrorAnswer("PUT /wiki/api/v2/pages/1 answered 409: Version must be incremented", 409)) self.assertEqual(client.confluence_json("PUT", f"{base}/wiki/api/v2/pages/1", AUTHORIZATION, {"version": {"number": 2}}), ErrorAnswer("PUT /wiki/api/v2/pages/1 answered 409: Version must be incremented", 409))
[(_, _, headers, body)] = self.server.got # type: ignore[attr-defined]
self.assertEqual((headers["Authorization"], json.loads(body)), (AUTHORIZATION, {"version": {"number": 2}}))
def test_reads_confluences_messages_from_an_error_answer(self): def test_reads_confluences_messages_from_an_error_answer(self):
self.assertEqual(client.confluence_errors({"errors": [{"status": 409, "title": "Version must be incremented"}, {"title": "and more"}, "odd"]}), "Version must be incremented; and more") self.assertEqual(client.confluence_errors({"errors": [{"status": 409, "title": "Version must be incremented"}, {"title": "and more"}, "odd"]}), "Version must be incremented; and more")
+1 -1
View File
@@ -82,7 +82,7 @@ from chunk_preflight.gathered import Forge, Gathered, ItemFacts, NamedPath, Ran,
from chunk_preflight.choices import forge_of, pulls_command, worktree_add, worktree_on from chunk_preflight.choices import forge_of, pulls_command, worktree_add, worktree_on
from chunk_preflight.facts import JOINING_DETAILS, render from chunk_preflight.facts import JOINING_DETAILS, render
from project_config.main import located from project_config.main import located
from plan.named_code import named_paths from plan.named_paths import named_paths
from release_plan.next_chunk import NextChunk, NoItem, plan_name, planned from release_plan.next_chunk import NextChunk, NoItem, plan_name, planned
from release_plan.release_standing import project_plan from release_plan.release_standing import project_plan
+5 -3
View File
@@ -163,9 +163,11 @@ def held_history(home: pathlib.Path) -> tuple[RecordStore, Held] | Failure:
def append(read: str, entry: str, home: pathlib.Path) -> str | Failure: def append(read: str, entry: str, home: pathlib.Path) -> str | Failure:
"""Appends entry and returns the line the tool prints; a Failure where the history already holds an entry on what the seats read.""" """Appends entry and returns the line the tool prints; a Failure where the history already holds an entry on what the seats read."""
read_history = held_history(home) read_history = held_history(home)
if isinstance(read_history, Failure): return read_history if isinstance(read_history, Failure) else appended_to(*read_history, read, entry)
return read_history
history, held = read_history
def appended_to(history: RecordStore, held: Held, read: str, entry: str) -> str | Failure:
"""Writes entry onto held, the history as history's store read it, over held's version; the line the tool prints, or why the entry isn't written."""
if recorded(held.text, read): if recorded(held.text, read):
return Failure(f"{history.label} already holds an entry on {read}; record each ruling or run once") return Failure(f"{history.label} already holds an entry on {read}; record each ruling or run once")
written = history.write(appended(held.text, entry), held.version) written = history.write(appended(held.text, entry), held.version)
+9
View File
@@ -15,6 +15,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from larv_review.agreement import agreement_report, ruling_agreement, run_agreement from larv_review.agreement import agreement_report, ruling_agreement, run_agreement
from review_rules.comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat from review_rules.comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat
from larv_review.history_commands import appended_to
from larv_review.plan import checkout_plan, Emptied, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due from larv_review.plan import checkout_plan, Emptied, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due
from review_rules import comprehension_history from review_rules import comprehension_history
from project_config.test_project_config import configured from project_config.test_project_config import configured
@@ -25,6 +26,7 @@ from failure import Failure
from plan_store.todo_md import FilePlan from plan_store.todo_md import FilePlan
from record_store.stores import FileStore from record_store.stores import FileStore
from larv_review.scoring import floor_step, means, under_floor from larv_review.scoring import floor_step, means, under_floor
from record_store.held import Held
from test_env import isolated_env from test_env import isolated_env
from plan.todo_table import Item, items, NoItemsTable from plan.todo_table import Item, items, NoItemsTable
from release_plan.release_standing import LastCut from release_plan.release_standing import LastCut
@@ -459,6 +461,13 @@ class LandedTowards(unittest.TestCase):
self.assertEqual(landed_towards(plan, LastCut(Failure("fatal: bad object"), "", 3, [])), Failure("could not tell the next release: the default branch's tags cannot be read: fatal: bad object")) self.assertEqual(landed_towards(plan, LastCut(Failure("fatal: bad object"), "", 3, [])), Failure("could not tell the next release: the default branch's tags cannot be read: fatal: bad object"))
class AppendedTo(unittest.TestCase):
def test_writes_the_entry_over_the_version_the_history_was_read_at(self):
history = MemoryStore(label="history.md", version=5)
self.assertEqual(appended_to(history, Held("", "5"), "PR #2 at abcdef1\n", "## an entry\n"), "Appended to history.md.")
self.assertEqual(history.overs, ["5"])
class Shortfall(unittest.TestCase): class Shortfall(unittest.TestCase):
def test_skill_md_names_the_words_that_end_the_reason_a_release_empties(self): def test_skill_md_names_the_words_that_end_the_reason_a_release_empties(self):
self.assertIn(EMPTIED_WORDS, (pathlib.Path(__file__).resolve().parents[2] / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8")) self.assertIn(EMPTIED_WORDS, (pathlib.Path(__file__).resolve().parents[2] / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8"))
+16
View File
@@ -1305,6 +1305,17 @@ class TmuxCommands(unittest.TestCase):
self.assertEqual(tmux.start_window(window, "/r", {}, ["x"], True, failed), Failure("tmux could not start the window loop-proj:item-7: duplicate session: loop-proj")) self.assertEqual(tmux.start_window(window, "/r", {}, ["x"], True, failed), Failure("tmux could not start the window loop-proj:item-7: duplicate session: loop-proj"))
self.assertEqual(tmux.start_window(window, "/r", {}, ["x"], True, silent), Failure("tmux could not start the window loop-proj:item-7: it exited 2")) self.assertEqual(tmux.start_window(window, "/r", {}, ["x"], True, silent), Failure("tmux could not start the window loop-proj:item-7: it exited 2"))
def test_fails_where_it_cannot_mark_a_session_it_made_as_the_checkouts_but_not_where_remain_on_exit_fails(self):
def answering(failing: str):
def run(args):
fails = args[:1] == ["set-option"] and failing in args
return subprocess.CompletedProcess(args, 1 if fails else 0, "" if fails else "@9\n", "no such session\n" if fails else "")
return run
window = tmux.Window("loop-proj", "item-7", "")
self.assertEqual(tmux.start_window(window, "/r", {}, ["x"], True, answering(tmux.OWNER)), Failure("tmux started the session loop-proj but could not mark it as this checkout's: no such session"))
self.assertIsNone(tmux.start_window(window, "/r", {}, ["x"], True, answering("remain-on-exit")))
self.assertIsNone(tmux.start_window(window, "/r", {}, ["x"], False, answering(tmux.OWNER)))
def test_reads_the_checkout_the_session_names(self): def test_reads_the_checkout_the_session_names(self):
fake = FakeEffects(owner="/c/proj") fake = FakeEffects(owner="/c/proj")
self.assertEqual(tmux.owner("loop-proj", fake.tmux), "/c/proj") self.assertEqual(tmux.owner("loop-proj", fake.tmux), "/c/proj")
@@ -1499,6 +1510,11 @@ class StartChunks(unittest.TestCase):
fake = FakeEffects(windows="item-5\t1\t@3\n") fake = FakeEffects(windows="item-5\t1\t@3\n")
self.assertEqual(self.start(fake), ["item-5", "item-1"]) self.assertEqual(self.start(fake), ["item-5", "item-1"])
def test_a_plan_with_no_item_starts_nothing_beside_a_restarted_chunk(self):
self.limit(2)
fake = FakeEffects(windows="item-5\t1\t@3\n")
self.assertEqual(self.start(fake, plan=next_chunk.NoItem("release 1.0.0 has no items")), ["item-5"])
def test_a_finishing_chunk_leaves_a_stopped_chunk_and_its_items_to_the_human(self): def test_a_finishing_chunk_leaves_a_stopped_chunk_and_its_items_to_the_human(self):
self.limit(2) self.limit(2)
transcripts = paths.paths_from(self.home).claude_code_transcripts transcripts = paths.paths_from(self.home).claude_code_transcripts
+1 -1
View File
@@ -6,7 +6,7 @@ from claude_code.tokens import Tokens
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class TakenIn: class TakenIn:
"""The levels of the plan items the worker names on its latest `Chunk items:` line, as cycle.chunk_items reads them. The item the chunk was routed on counts only where the worker names it.""" """The highest L, and the highest E + I, among the plan items the worker names on its latest `Chunk items:` line, as cycle.chunk_items reads them. The item the chunk was routed on counts only where the worker names it."""
# The highest L among them, 0 for none: an escalation steps up from the rung that L picks, and an unfinished verdict also raises the worker to it. # The highest L among them, 0 for none: an escalation steps up from the rung that L picks, and an unfinished verdict also raises the worker to it.
highest_likelihood: int = 0 highest_likelihood: int = 0
# The highest E + I among them, 0 for none: after an unfinished verdict, it routes the next cycle's reviewers. # The highest E + I among them, 0 for none: after an unfinished verdict, it routes the next cycle's reviewers.
@@ -4,7 +4,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from plan.named_code import named_files, named_paths from plan.named_paths import named_files, named_paths
class NamedPaths(unittest.TestCase): class NamedPaths(unittest.TestCase):
+6
View File
@@ -236,6 +236,12 @@ class Located(unittest.TestCase):
class Update(unittest.TestCase): class Update(unittest.TestCase):
def test_writes_over_the_version_it_read(self):
record = MemoryStore("# Reading cost\n", version=2)
archive = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
self.assertNotIsInstance(main.update(record, archive, Checkout("/c/p", "/c/p", frozenset(), BRANCH), "/h", "2026-11-14T00:00:00Z"), Failure)
self.assertEqual(record.overs, ["2"])
def test_fails_where_the_record_refuses_the_write(self): def test_fails_where_the_record_refuses_the_write(self):
class Unwritable(MemoryStore): class Unwritable(MemoryStore):
def write(self, text: str, over: str | None) -> Held | Failure: def write(self, text: str, over: str | None) -> Held | Failure:
+9 -4
View File
@@ -7,20 +7,25 @@ from record_store.held import Held
@dataclasses.dataclass @dataclasses.dataclass
class MemoryStore: class MemoryStore:
"""A record held in memory, as a backend outside git holds one. Set fails to make every read and write fail with that reason.""" """A record held in memory, as a backend outside git holds one: versioned as a wiki page is, refusing a write over a version it no longer holds. Set fails to make every read and write fail with that reason. overs holds the version each write named, so a test can check that a caller wrote over the version it read."""
text: str = "" text: str = ""
label: str = "the record in memory" label: str = "the record in memory"
tracked: str | None = None tracked: str | None = None
fails: str | None = None fails: str | None = None
version: int = 0
overs: list[str | None] = dataclasses.field(default_factory=list)
def read(self) -> str | Failure: def read(self) -> str | Failure:
return Failure(self.fails) if self.fails else self.text return Failure(self.fails) if self.fails else self.text
def held(self) -> Held | Failure: def held(self) -> Held | Failure:
return Failure(self.fails) if self.fails else Held(self.text) return Failure(self.fails) if self.fails else Held(self.text, str(self.version))
def write(self, text: str, over: str | None) -> Held | Failure: def write(self, text: str, over: str | None) -> Held | Failure:
self.overs.append(over)
if self.fails: if self.fails:
return Failure(self.fails) return Failure(self.fails)
self.text = text if over is not None and over != str(self.version):
return Held(text) return Failure(f"someone saved {self.label} since version {over}")
self.text, self.version = text, self.version + 1
return Held(text, str(self.version))
+4
View File
@@ -190,6 +190,10 @@ class ConfluencePageTest(ConfluenceCase):
store = ConfluencePage(PAGE, self.env, lambda *_: ErrorAnswer("GET /wiki/api/v2/pages/2293761 answered 404: Not Found", 404), to_markdown, to_adf) store = ConfluencePage(PAGE, self.env, lambda *_: ErrorAnswer("GET /wiki/api/v2/pages/2293761 answered 404: Not Found", 404), to_markdown, to_adf)
self.assertEqual(store.read(), Failure(f"cannot read {PAGE.spelling}: GET /wiki/api/v2/pages/2293761 answered 404: Not Found")) self.assertEqual(store.read(), Failure(f"cannot read {PAGE.spelling}: GET /wiki/api/v2/pages/2293761 answered 404: Not Found"))
def test_a_write_handed_no_version_fails_naming_the_page_where_its_version_cannot_be_read(self) -> None:
store = ConfluencePage(PAGE, self.env, lambda *_: ErrorAnswer("GET /wiki/api/v2/pages/2293761 answered 404: Not Found", 404), to_markdown, to_adf)
self.assertEqual(store.write("text\n", None), Failure(f"cannot read {PAGE.spelling}: GET /wiki/api/v2/pages/2293761 answered 404: Not Found"))
def test_fails_without_credentials_before_any_request(self) -> None: def test_fails_without_credentials_before_any_request(self) -> None:
self.env.unlink() self.env.unlink()
read = self.new_store().read() read = self.new_store().read()
+7
View File
@@ -143,6 +143,13 @@ class LocalFile(unittest.TestCase):
self.assertIsInstance(opened, Failure) self.assertIsInstance(opened, Failure)
self.assertIn(f"cannot write {copy}: ", opened.reason) self.assertIn(f"cannot write {copy}: ", opened.reason)
def test_a_version_that_cannot_be_kept_beside_the_copy_is_a_failure_naming_its_file(self):
copy = self.folder / "decisions.md"
(self.folder / "decisions.version").mkdir()
opened = stores.local_file(MemoryStore("# Decisions\n"), copy)
assert isinstance(opened, Failure), opened
self.assertTrue(opened.reason.startswith(f"cannot write {self.folder / 'decisions.version'}: "), opened.reason)
def test_storing_a_missing_copy_fails_and_leaves_the_record(self): def test_storing_a_missing_copy_fails_and_leaves_the_record(self):
record = MemoryStore("kept\n") record = MemoryStore("kept\n")
self.assertIn("is missing or empty", stores.stored(record, self.folder / "decisions.md").reason) self.assertIn("is missing or empty", stores.stored(record, self.folder / "decisions.md").reason)
+10 -1
View File
@@ -14,8 +14,9 @@ from plan_store.todo_md import FilePlan, plan_of
from record_store.stores import FileStore from record_store.stores import FileStore
from test_env import isolated_env from test_env import isolated_env
from record_store.fakes import MemoryStore from record_store.fakes import MemoryStore
from release_plan import next_chunk, release_standing
from plan.todo_table import NoItemsTable from plan.todo_table import NoItemsTable
from release_plan import release_standing from plan_store.plans import Plan
from plan import todo_table from plan import todo_table
from plan.release import version from plan.release import version
@@ -380,3 +381,11 @@ class ChunkItem(unittest.TestCase):
def test_fails_to_name_releases_when_the_newest_plan_marks_one_in_a_form_it_cannot_read(self): def test_fails_to_name_releases_when_the_newest_plan_marks_one_in_a_form_it_cannot_read(self):
plan = "## Items\n\n| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |\n|---|---|---|---|---|---|---|---|---|---|---|---|\n| 1 | 0.3.0 | | | **Do 1.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |\n" plan = "## Items\n\n| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |\n|---|---|---|---|---|---|---|---|---|---|---|---|\n| 1 | 0.3.0 | | | **Do 1.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |\n"
self.assertIsInstance(release_standing.named_releases([plan, plan + "\n## Renamed\n\nsoon\n"]), Failure) self.assertIsInstance(release_standing.named_releases([plan, plan + "\n## Renamed\n\nsoon\n"]), Failure)
class NextChunk(unittest.TestCase):
def test_names_the_release_a_carried_item_moved_to_not_another_items(self):
later, carried, next_one = (dataclasses.replace(one(release), id=id_) for id_, release in ((9, (0, 4, 0)), (5, (0, 2, 0)), (3, (0, 3, 0))))
planned = next_chunk.planned(Plan([later, carried, next_one]), release_standing.LastCut("v0.2.0", "", 4, []), "origin/main", "item-{id}")
assert isinstance(planned, next_chunk.NextChunk), planned
self.assertEqual(planned.carried, next_chunk.CarriedOver((0, 3, 0), (5,)))
+11
View File
@@ -2,6 +2,7 @@ import ast
import graphlib import graphlib
import pathlib import pathlib
import sys import sys
import tempfile
import unittest import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
@@ -36,6 +37,16 @@ class PackageCycles(unittest.TestCase):
def test_no_package_under_bin_imports_one_that_imports_it_back(self): def test_no_package_under_bin_imports_one_that_imports_it_back(self):
self.assertEqual(cycle(package_imports(ROOT / "bin")), [], "move what both packages need into a package that imports neither") self.assertEqual(cycle(package_imports(ROOT / "bin")), [], "move what both packages need into a package that imports neither")
def test_reads_an_import_deferred_into_a_function_and_leaves_out_tests(self):
with tempfile.TemporaryDirectory() as temp:
folder = pathlib.Path(temp)
for package, source in (("a", "def f():\n\tfrom b.mod import x\n"), ("b", "import a.mod\n"), ("c", "")):
(folder / package).mkdir()
(folder / package / "__init__.py").write_text("")
(folder / package / "mod.py").write_text(source)
(folder / "c" / "test_mod.py").write_text("import a\n")
self.assertEqual(package_imports(folder), {"a": {"b"}, "b": {"a"}, "c": set()})
def test_a_cycle_through_a_deferred_import_is_found(self): def test_a_cycle_through_a_deferred_import_is_found(self):
self.assertEqual(sorted(cycle({"a": {"b"}, "b": {"a"}})[:2]), ["a", "b"]) self.assertEqual(sorted(cycle({"a": {"b"}, "b": {"a"}})[:2]), ["a", "b"])
self.assertEqual(cycle({"a": {"b"}, "b": set()}), []) self.assertEqual(cycle({"a": {"b"}, "b": set()}), [])
+2 -2
View File
@@ -7,7 +7,7 @@ from review_rules.round_titles import CAP, COUNTS, EXAMPLE, lacks_counts, OPENIN
from git_cli.git_command import CommitCall from git_cli.git_command import CommitCall
from run_heavy.capped_docker import finds_this_docker from run_heavy.capped_docker import finds_this_docker
from rule_hook.heavy_command import heavy from rule_hook.heavy_command import heavy
from command_lines.shell_command import launched, Simple from command_lines.shell_command import launched, LAUNCHERS, Simple
from review_rules.review_folder import REPORTS from review_rules.review_folder import REPORTS
from project_config import templates from project_config import templates
from command_lines.docker_command import unlimited from command_lines.docker_command import unlimited
@@ -88,7 +88,7 @@ RULES: dict[RuleName, Rule] = {
), ),
"run-heavy": Rule( "run-heavy": Rule(
"a heavy command, which loads the machine for minutes, runs under ~/.claude/bin/run-heavy, so sessions running at once cannot starve the machine", "a heavy command, which loads the machine for minutes, runs under ~/.claude/bin/run-heavy, so sessions running at once cannot starve the machine",
"a docker build, docker buildx build or docker compose build, and a run of mutate-changes, or of cargo mutants, Infection, mutmut or Stryker, the mutation tools it runs, whether direct, through a launcher such as uvx, uv run, poetry run, sudo or doas, or inside docker run, docker exec or docker compose run or exec. A gate script is not checked, since no program can tell it from a light one", "a docker build, docker buildx build or docker compose build, and a run of mutate-changes, or of cargo mutants, Infection, mutmut or Stryker, the mutation tools it runs, whether direct, through a launcher (" + ", ".join(sorted(LAUNCHERS - {"run-heavy"})) + "), or inside docker run, docker exec or docker compose run or exec. A gate script is not checked, since no program can tell it from a light one",
), ),
"todo-rank-check": Rule( "todo-rank-check": Rule(
"while todo.md has changes, staged or not, a git commit waits until rank_todo.py --check passes on it: the checkout's own bin/rank_todo.py where the checkout is of this setup's repo, else ~/.claude/bin/rank_todo.py", "while todo.md has changes, staged or not, a git commit waits until rank_todo.py --check passes on it: the checkout's own bin/rank_todo.py where the checkout is of this setup's repo, else ~/.claude/bin/rank_todo.py",
+1 -1
View File
@@ -100,7 +100,7 @@ from failure import Failure
from score_outcomes.results import file_lines, fixed_later, item_text, misreads, nearest, render, report, Result, results_of from score_outcomes.results import file_lines, fixed_later, item_text, misreads, nearest, render, report, Result, results_of
from plan.todo_table import item_details, LEVELS, risk, TOP_SCORE from plan.todo_table import item_details, LEVELS, risk, TOP_SCORE
from text_files.markdown_text import listed from text_files.markdown_text import listed
from plan.named_code import named_files from plan.named_paths import named_files
from project_config.main import project, title_templates from project_config.main import project, title_templates
from transcript_archive.location import project_archive from transcript_archive.location import project_archive
from score_outcomes.reversals import reversal_lines from score_outcomes.reversals import reversal_lines
+1 -1
View File
@@ -6,7 +6,7 @@ from branch_chunks.cut import BranchChunk, Landing, NOT_WORK
from review_rules.round_titles import Findings, round_findings, rounds_past_first from review_rules.round_titles import Findings, round_findings, rounds_past_first
from plan.todo_table import Item from plan.todo_table import Item
from text_files.markdown_text import listed from text_files.markdown_text import listed
from plan.named_code import named_files from plan.named_paths import named_files
# Fewest single-item chunks a score needs before its medians print: the 10 figures the reading-cost trend waits for; no published standard sets either. # Fewest single-item chunks a score needs before its medians print: the 10 figures the reading-cost trend waits for; no published standard sets either.
ENOUGH = 10 ENOUGH = 10
@@ -414,6 +414,11 @@ class EntryTest(unittest.TestCase):
self.assertEqual([line.split(" at ")[1] for line in store.text.splitlines() if line.startswith("## ")], ["ccccccc", "ddddddd", "eeeeeee"]) self.assertEqual([line.split(" at ")[1] for line in store.text.splitlines() if line.startswith("## ")], ["ccccccc", "ddddddd", "eeeeeee"])
self.assertEqual(store.text.count("\n\n\n"), 0) self.assertEqual(store.text.count("\n\n\n"), 0)
def test_writes_over_the_version_it_read(self) -> None:
store = MemoryStore("", version=3)
record.append(store, [5], "## Chunk 5, 2026-01-01T00:00:00Z, at aaaaaaa\n")
self.assertEqual(store.overs, ["3"])
def test_a_record_that_cannot_be_read_is_a_failure(self) -> None: def test_a_record_that_cannot_be_read_is_a_failure(self) -> None:
self.assertEqual(record.append(MemoryStore(fails="no disk"), [5], "x"), Failure("no disk")) self.assertEqual(record.append(MemoryStore(fails="no disk"), [5], "x"), Failure("no disk"))