From eb49d62e3609871c6d5034bd65175d0810f3ccb4 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 16:13:37 +0100 Subject: [PATCH 01/21] Forbid a test that decides at run time whether to check anything --- agents/stability-reviewer.md | 1 + docs/reading-cost.md | 34 ++++++++++++++++++++++++++++++ principles/technical-principles.md | 1 + 3 files changed, 36 insertions(+) diff --git a/agents/stability-reviewer.md b/agents/stability-reviewer.md index fc1ee23e..0f34b3e7 100644 --- a/agents/stability-reviewer.md +++ b/agents/stability-reviewer.md @@ -125,6 +125,7 @@ Every PR gets at least this sweep. - Was a test deleted while the behaviour it pinned remains? Flag it; restore the test. - Were tests and implementation changed together in a way that could mask a regression — e.g. an assertion weakened to make a test pass? Flag it; these should be separate changes. - Does each test earn its keep, as the technical principles' test bullet says? Look at where its expected values come from, what it asserts, what it mocks, what wording it pins, whether another test already pins the behaviour, and whether it sleeps or reads the wall clock. +- Does a test decide at run time whether to check anything, by a conditional skip, early return or catch around its assertions, as the technical principles' test bullet forbids? Flag it. - Are there untestable side effects that should be refactored? diff --git a/docs/reading-cost.md b/docs/reading-cost.md index f27e666e..1c136508 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2691,3 +2691,37 @@ Read most (opens and searches): - `bin/transcript_archive/outcomes.py` 2 - `bin/judge_replay/replay.py` 1 - `bin/rung_replay/archive.py` 1 + +## Reading cost, chunk f6452ae1f4d1, finished 2026-11-18T15:04:37Z + +164779 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 5 +- `CHANGELOG.md` 2 +- `bin/claude_code/reply.py` 2 +- `bin/do_epic/backend/contract.py` 2 +- `bin/do_epic/backend/jira.py` 2 +- `bin/do_epic/backend/test_jira.py` 2 +- `docs/decisions.md` 2 +- `bin/atlassian/client.py` 1 +- `bin/do_epic/backend/fake.py` 1 +- `bin/do_epic/backend/protocol.py` 1 + +## Reading cost, chunk a1d1adafc713, finished 2026-11-18T15:13:10Z + +257245 new input tokens before the first commit. + +Read most (opens and searches): + +- `docs/decisions.md` 11 +- `bin/review_replay/test_review_replay.py` 9 +- `bin/review_replay/replay.py` 7 +- `README.md` 6 +- `bin/review_replay/change_comparison.py` 5 +- `bin/rule_hook/test_rule_hook.py` 4 +- `bin/loop_claude/cycle/run.py` 2 +- `bin/loop_claude/test_loop_claude.py` 2 +- `bin/review_replay/main.py` 2 +- `bin/rule_hook/main.py` 2 diff --git a/principles/technical-principles.md b/principles/technical-principles.md index 9733e34a..44199dc0 100644 --- a/principles/technical-principles.md +++ b/principles/technical-principles.md @@ -46,6 +46,7 @@ - Assert the outcome — returned values, stored state, emitted output — not how the code reached it. Use real collaborators or fakes; mock only slow, nondeterministic or external edges. BANNED: asserting which internal function ran, or scanning the source with `ast` or a regex. GOOD: `assertEqual(saved_row, {...})` against a fake store; a fake clock. - Pin wording only where the wording is the contract: a message a consumer parses, a published format. For prompts, help and error text, assert the facts the text must carry — an item ID, a model argument, an error code — not the sentence. BANNED: `assertIn("", prompt)`. GOOD: `assertIn("model opus, effort high", prompt)`. - One behaviour per test, named for it, tested once, at the lowest level that reproduces it. No loops or branches in a test body; parametrize the cases. + - A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing. BANNED: `test.skip(created.every((count) => count === 0))`, since a broken payroll also creates zero rows. GOOD: check the precondition before the action, failing with its cause, then `expect(created).toEqual([1, 2, 1])`. - Every escaped bug becomes a test that fails without its fix. - Write no test that no real bug could fail: a constant's value, a list's length, the framework's own behaviour. - A test neither sleeps nor asserts on the wall clock, and seeds any randomness. From 2c1a84518fab53646fe42a9f9a4b5f2c11bdca40 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:16:37 +0100 Subject: [PATCH 02/21] Read each epic issue's scores, blockers and whether the loop filed it, from both backends --- bin/do_epic/backend/contract.py | 47 ++++++++++++++++++++++++++++++-- bin/do_epic/backend/fake.py | 2 +- bin/do_epic/backend/jira.py | 25 +++++++++++------ bin/do_epic/backend/protocol.py | 9 +++++- bin/do_epic/backend/test_fake.py | 12 ++++++++ bin/do_epic/backend/test_jira.py | 35 ++++++++++++++++++++---- bin/plan_store/jira_epic.py | 7 ++++- docs/reading-cost.md | 17 ++++++++++++ 8 files changed, 136 insertions(+), 18 deletions(-) diff --git a/bin/do_epic/backend/contract.py b/bin/do_epic/backend/contract.py index e0b33b86..11d38cef 100644 --- a/bin/do_epic/backend/contract.py +++ b/bin/do_epic/backend/contract.py @@ -1,9 +1,10 @@ -"""What every backend of an epic's plan must hold, as tests. A backend's test case inherits EpicStoreContract and unittest.TestCase, and builds an epic with no issues in new_store. Its assign and close change an issue as a person would in the tracker.""" +"""What every backend of an epic's plan must hold, as tests. A backend's test case inherits EpicStoreContract and unittest.TestCase, and builds an epic with no issues in new_store. Its assign, close, person_files, score and block change the tracker as a person, or the plan store, would.""" import re import typing from do_epic.backend.protocol import EpicIssue, EpicStore from failure import Failure +from plan.todo_table import ItemFields class EpicStoreContract: @@ -22,6 +23,18 @@ class EpicStoreContract: """Moves the issue named key to the done status named status.""" raise NotImplementedError + def person_files(self, store: EpicStore, summary: str) -> str: + """Files a child issue of the epic as a person does in the tracker, not through the store, and answers its key.""" + raise NotImplementedError + + def score(self, store: EpicStore, key: str, scores: dict[str, str]) -> None: + """Sets the scores of the issue named key, as `plan_store` writes them: each column's name with its value as text, such as {"L": "2", "Moves": "1 by 5"}.""" + raise NotImplementedError + + def block(self, store: EpicStore, key: str, blocker: str) -> None: + """Makes the issue named key blocked by the issue named blocker, as a person would link them in the tracker.""" + raise NotImplementedError + def filed(self, store: EpicStore, parent: str, summary: str, detail: str = "", labels: tuple[str, ...] = ()) -> str: key = store.file(parent, summary, detail, labels) assert isinstance(key, str), key @@ -38,7 +51,7 @@ class EpicStoreContract: def test_reads_back_a_child_issue_it_filed(self) -> None: store = self.new_store() key = self.filed(store, store.epic_key, "Count the runs.", "Why it counts.\n\nA second paragraph.", ("security", "api")) - self.assertEqual(self.issues(store), [EpicIssue(key, "Count the runs.", "Why it counts.\n\nA second paragraph.", ("api", "security"), None, "To Do", False, store.epic_key)]) + self.assertEqual(self.issues(store), [EpicIssue(key, "Count the runs.", "Why it counts.\n\nA second paragraph.", ("api", "security"), None, "To Do", False, store.epic_key, by_loop=True)]) def test_reads_back_a_sub_task_it_filed_after_its_parent(self) -> None: store = self.new_store() @@ -107,3 +120,33 @@ class EpicStoreContract: self.assertEqual(store.add_label(key, label), Failure(reason)) self.assertIsInstance(store.add_label("ZZZ-1", "repo:log"), Failure) self.assertEqual([issue.labels for issue in self.issues(store)], [(), ()]) + + def test_reads_an_issue_without_scores_or_blockers_as_one_with_none(self) -> None: + store = self.new_store() + key = self.filed(store, store.epic_key, "Count the runs.") + [issue] = self.issues(store) + self.assertEqual((issue.key, issue.scores, issue.blockers), (key, ItemFields(), ())) + + def test_reads_the_scores_a_person_or_the_plan_store_set(self) -> None: + store = self.new_store() + key = self.filed(store, store.epic_key, "Count the runs.") + self.score(store, key, {"L": "2", "E": "3", "I": "4", "S": "3", "Moves": "1 by 5", "Exempt": "security"}) + [issue] = self.issues(store) + self.assertEqual((issue.scores.scores, issue.scores.moves, issue.scores.exempt), ({"L": 2, "E": 3, "I": 4, "S": 3}, (("1", 5),), "security")) + self.assertEqual((issue.scores.release, issue.scores.blocked_by), (None, ())) + + def test_reads_each_blocker_of_an_issue_and_none_for_a_blocker_of_another(self) -> None: + store = self.new_store() + first, second, third = (self.filed(store, store.epic_key, f"Item {n}.") for n in range(3)) + self.block(store, third, first) + self.block(store, third, second) + read = {issue.key: issue for issue in self.issues(store)} + self.assertEqual([read[key].blockers for key in (first, second, third)], [(), (), (first, second)]) + + def test_reads_whether_the_loop_filed_an_issue(self) -> None: + store = self.new_store() + ours = self.filed(store, store.epic_key, "Count the runs.") + theirs = self.person_files(store, "A person's issue.") + task = self.filed(store, ours, "Count them in the api.") + read = {issue.key: issue for issue in self.issues(store)} + self.assertEqual([read[key].by_loop for key in (ours, theirs, task)], [True, False, True]) diff --git a/bin/do_epic/backend/fake.py b/bin/do_epic/backend/fake.py index 04f87397..217ef991 100644 --- a/bin/do_epic/backend/fake.py +++ b/bin/do_epic/backend/fake.py @@ -25,7 +25,7 @@ class MemoryEpic: if parent != self.epic_key and parent not in {issue.key for issue in self.issues if issue.parent == self.epic_key}: return no_parent(self.epic_key, parent) key = f"{self.epic_key.rpartition('-')[0]}-{len(self.issues) + 100}" - self.issues.append(EpicIssue(key, summary, detail.strip(), tuple(sorted(labels)), None, "To Do", False, parent)) + self.issues.append(EpicIssue(key, summary, detail.strip(), tuple(sorted(labels)), None, "To Do", False, parent, by_loop=True)) return key def add_label(self, key: str, label: str) -> None | Failure: diff --git a/bin/do_epic/backend/jira.py b/bin/do_epic/backend/jira.py index 05d10536..730f885f 100644 --- a/bin/do_epic/backend/jira.py +++ b/bin/do_epic/backend/jira.py @@ -5,12 +5,12 @@ import typing from adf_codec.convert import adfs_to_markdown, markdown_to_adf, Refused from atlassian.client import basic_auth, Http, jira_json, ToAdf, ToMarkdown +from plan_store.jira_epic import blocked_by_links, FILED_BY, ISSUE_KEY, ISSUE_TYPE, project_of, PROPERTY, scores, searched from project_config.settings import Epic from do_epic.backend.protocol import EpicIssue, no_child, no_parent, unfit, unfit_label from failure import Failure -from plan_store.jira_epic import ISSUE_KEY, ISSUE_TYPE, project_of, searched -FIELDS = ["summary", "description", "labels", "assignee", "status", "parent"] +FIELDS = ["summary", "description", "labels", "assignee", "status", "parent", "issuelinks"] # How many child issues one search for sub-tasks names, which keeps its JQL well inside the length Jira takes. PARENTS_PER_SEARCH = 50 PERHAPS_FILED = "unless Jira refused the request, the issue may exist: look under {parent} before filing it again" @@ -60,6 +60,8 @@ class JiraEpic: if refused := unfit(summary, labels) or self.not_a_parent(parent, authorization): return refused fields: dict[str, typing.Any] = {"project": {"key": project_of(parent)}, "parent": {"key": parent}, "summary": summary, "labels": list(labels)} + # The mark that tells the loop's issues from a person's, as plan_store marks the items it files. + properties = [{"key": PROPERTY, "value": {FILED_BY[0]: FILED_BY[1]}}] kind = {"name": ISSUE_TYPE} if parent == self.epic_key else self.sub_task_type(project_of(parent), authorization) if isinstance(kind, Failure): return kind @@ -68,7 +70,7 @@ class JiraEpic: if isinstance(description, Failure): return Failure(f"cannot convert the detail to a Jira description: {description.reason}") fields["description"] = description - created = self.http("POST", f"{self.epic.site}/rest/api/3/issue", authorization, {"fields": fields | {"issuetype": kind}}) + created = self.http("POST", f"{self.epic.site}/rest/api/3/issue", authorization, {"fields": fields | {"issuetype": kind}, "properties": properties}) if isinstance(created, Failure): return Failure(f"cannot file the issue under {parent}: {created.reason}; {PERHAPS_FILED.format(parent=parent)}") key = created.get("key") if isinstance(created, dict) else None @@ -130,7 +132,7 @@ class JiraEpic: def searched(self, what: str, parents: tuple[str, ...], authorization: str) -> list[Found] | Failure: """The issues whose parent is one of parents, in rank order.""" named = ", ".join(f'"{key}"' for key in parents) - answered = searched(self.epic.site, what, f"parent in ({named}) ORDER BY Rank ASC", {"fields": FIELDS}, authorization, self.http) + answered = searched(self.epic.site, what, f"parent in ({named}) ORDER BY Rank ASC", {"fields": FIELDS, "properties": [PROPERTY]}, authorization, self.http) if isinstance(answered, Failure): return answered found = [found_of(raw) for raw in answered] @@ -159,9 +161,16 @@ def found_of(raw: object) -> Found | Failure: summary, labels, assignee, status, parent, description = fields["summary"], fields["labels"], fields["assignee"], fields["status"], fields["parent"]["key"], fields["description"] name = assignee["displayName"] if assignee is not None else None state, done = status["name"], status["statusCategory"]["key"] == "done" + blockers = tuple(link.blocker for link in blocked_by_links(fields)) + held = raw.get("properties", {}).get(PROPERTY, {}) except (AttributeError, KeyError, TypeError) as failure: return Failure(f"{key} is not in the shape Jira Cloud's REST API version 3 documents: {failure!r}") - texts = (summary, *labels, state, parent) if isinstance(labels, list) else () - if not texts or not all(isinstance(text, str) for text in texts) or not isinstance(name, str | None) or not ISSUE_KEY.fullmatch(parent) or not isinstance(description, dict | None): - return Failure(f"{key} is not in the shape Jira Cloud's REST API version 3 documents: its summary, labels, assignee, status, parent or description holds another kind of value") - return Found(EpicIssue(key, summary.strip(), "", tuple(sorted(labels)), name, state, done, parent), description) + texts = (summary, *labels, state, parent, *blockers) if isinstance(labels, list) else () + if not texts or not all(isinstance(text, str) for text in texts) or not isinstance(name, str | None) or not all(ISSUE_KEY.fullmatch(each) for each in (parent, *blockers)) or not isinstance(description, dict | None): + return Failure(f"{key} is not in the shape Jira Cloud's REST API version 3 documents: its summary, labels, assignee, status, parent, description or a linked issue's key holds another kind of value") + if not isinstance(held, dict): + return Failure(f"{key}'s issue property {PROPERTY} is not a JSON object") + read = scores(key, held) + if isinstance(read, Failure): + return read + return Found(EpicIssue(key, summary.strip(), "", tuple(sorted(labels)), name, state, done, parent, read, blockers, held.get(FILED_BY[0]) == FILED_BY[1]), description) diff --git a/bin/do_epic/backend/protocol.py b/bin/do_epic/backend/protocol.py index 0a9b0f23..78b30cb6 100644 --- a/bin/do_epic/backend/protocol.py +++ b/bin/do_epic/backend/protocol.py @@ -6,6 +6,7 @@ import re import typing from failure import Failure +from plan.todo_table import ItemFields # What a tracker accepts as a label: Jira refuses a label holding white space. LABEL = re.compile(r"\S+") @@ -28,6 +29,12 @@ class EpicIssue: done: bool # The epic's key for a child issue, the child's key for a sub-task. parent: str + # The scores, Moves and Exempt a plan-item issue property holds, as `plan_store` reads them; its release and blocked_by stay unset, since an epic's items have no release and `blockers` holds theirs. Empty where the issue holds none, as a person's issue does. + scores: ItemFields = dataclasses.field(default_factory=ItemFields) + # The key of each issue this one is blocked by, in the tracker's order. + blockers: tuple[str, ...] = () + # Whether the loop filed the issue, through EpicStore.file, rather than a person. + by_loop: bool = False class EpicStore(typing.Protocol): @@ -41,7 +48,7 @@ class EpicStore(typing.Protocol): """Each child issue, open or done, in the tracker's rank order, each followed by its sub-tasks in theirs.""" def file(self, parent: str, summary: str, detail: str, labels: tuple[str, ...]) -> str | Failure: - """Files an open issue under parent and answers its key: a child issue where parent is the epic, a sub-task where parent is one of its child issues. detail is markdown, and may be empty.""" + """Files an open issue under parent, marked as filed by the loop, and answers its key: a child issue where parent is the epic, a sub-task where parent is one of its child issues. detail is markdown, and may be empty.""" def add_label(self, key: str, label: str) -> None | Failure: """Adds label to the epic's child issue named key, leaving its other labels as they are; adding one it already has leaves the labels as they are. A sub-task, or an issue outside the epic, is refused.""" diff --git a/bin/do_epic/backend/test_fake.py b/bin/do_epic/backend/test_fake.py index a2d804a8..40632ba8 100644 --- a/bin/do_epic/backend/test_fake.py +++ b/bin/do_epic/backend/test_fake.py @@ -6,6 +6,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) from do_epic.backend.contract import EpicStoreContract from failure import Failure +from plan_store import jira_epic from do_epic.backend.fake import MemoryEpic @@ -19,6 +20,17 @@ class MemoryEpicContract(EpicStoreContract, unittest.TestCase): def close(self, store: MemoryEpic, key: str, status: str) -> None: # type: ignore[override] store.change(key, status=status, done=True) + def person_files(self, store: MemoryEpic, summary: str) -> str: # type: ignore[override] + key = self.filed(store, store.epic_key, summary) + store.change(key, by_loop=False) + return key + + def score(self, store: MemoryEpic, key: str, scores: dict[str, str]) -> None: # type: ignore[override] + store.change(key, scores=jira_epic.scores(key, scores)) + + def block(self, store: MemoryEpic, key: str, blocker: str) -> None: # type: ignore[override] + store.change(key, blockers=(*next(issue for issue in store.issues if issue.key == key).blockers, blocker)) + class Failing(unittest.TestCase): def test_every_read_and_filing_fails_with_the_reason_given(self) -> None: diff --git a/bin/do_epic/backend/test_jira.py b/bin/do_epic/backend/test_jira.py index e7287c74..18ac3f23 100644 --- a/bin/do_epic/backend/test_jira.py +++ b/bin/do_epic/backend/test_jira.py @@ -72,7 +72,7 @@ class FakeJira: if matched is None: return Failure("Jira answered 400: the JQL is not valid") parents = re.findall(r'"([A-Z]+-[0-9]+)"', matched[1]) - found = [{"key": issue["key"], "fields": {name: value for name, value in issue["fields"].items() if name in body.get("fields", [])}} for issue in self.issues if issue["fields"]["parent"]["key"] in parents] # type: ignore[index, attr-defined] + found = [{"key": issue["key"], "fields": {name: value for name, value in issue["fields"].items() if name in body.get("fields", [])}, "properties": {name: value for name, value in issue.get("properties", {}).items() if name in body.get("properties", [])}} for issue in self.issues if issue["fields"]["parent"]["key"] in parents] # type: ignore[index, attr-defined] start = int(body.get("nextPageToken", 0)) return {"issues": found[start:start + 2]} | ({"nextPageToken": str(start + 2)} if start + 2 < len(found) else {}) @@ -84,12 +84,21 @@ class FakeJira: if fields["project"] != {"key": "ABC"} or kind is None or fields["issuetype"] != kind: return Failure("Jira answered 400: the project, parent or issue type is not valid") key = f"ABC-{len(self.issues) + 100}" - self.issues.append({"key": key, "fields": {"summary": fields["summary"], "description": fields.get("description"), "labels": fields["labels"], "assignee": None, "status": TO_DO, "parent": {"key": parent}}}) + self.issues.append({"key": key, "fields": {"summary": fields["summary"], "description": fields.get("description"), "labels": fields["labels"], "assignee": None, "status": TO_DO, "parent": {"key": parent}, "issuelinks": []}, "properties": {entry["key"]: entry["value"] for entry in body["properties"]}}) return {"id": "1", "key": key} def change(self, key: str, **fields: object) -> None: next(issue for issue in self.issues if issue["key"] == key)["fields"].update(fields) # type: ignore[union-attr] + def person_files(self, summary: str) -> str: + """Files a child issue as the Jira website does: with no issue property.""" + key = f"ABC-{len(self.issues) + 100}" + self.issues.append({"key": key, "fields": {"summary": summary, "description": None, "labels": [], "assignee": None, "status": TO_DO, "parent": {"key": "ABC-12"}, "issuelinks": []}}) + return key + + def set_property(self, key: str, value: dict[str, object]) -> None: + next(issue for issue in self.issues if issue["key"] == key).setdefault("properties", {})["plan-item"] = value # type: ignore[attr-defined, union-attr] + class Case(unittest.TestCase): def setUp(self) -> None: @@ -111,6 +120,17 @@ class JiraEpicContract(Case, EpicStoreContract): def close(self, store: JiraEpic, key: str, status: str) -> None: # type: ignore[override] self.jira.change(key, status={"name": status, "statusCategory": {"key": "done"}}) + def person_files(self, store: JiraEpic, summary: str) -> str: # type: ignore[override] + return self.jira.person_files(summary) + + def score(self, store: JiraEpic, key: str, scores: dict[str, str]) -> None: # type: ignore[override] + held = next(issue for issue in self.jira.issues if issue["key"] == key).get("properties", {}).get("plan-item", {}) # type: ignore[attr-defined, union-attr] + self.jira.set_property(key, held | scores) + + def block(self, store: JiraEpic, key: str, blocker: str) -> None: # type: ignore[override] + links = next(issue for issue in self.jira.issues if issue["key"] == key)["fields"]["issuelinks"] # type: ignore[index] + links.append({"id": str(len(links) + 1), "type": {"inward": "is blocked by", "outward": "blocks"}, "inwardIssue": {"key": blocker}}) + class Jira(Case): def test_reads_the_sub_tasks_of_more_children_than_one_search_names(self) -> None: @@ -146,16 +166,21 @@ class Jira(Case): self.assertEqual(len(self.jira.issues), 1) def test_an_issue_in_another_shape_fails_the_read(self) -> None: - valid = {"summary": "Count the runs.", "description": None, "labels": [], "assignee": None, "status": TO_DO, "parent": {"key": "ABC-12"}} + valid = {"summary": "Count the runs.", "description": None, "labels": [], "assignee": None, "status": TO_DO, "parent": {"key": "ABC-12"}, "issuelinks": []} + linked = {"id": "1", "type": {"inward": "is blocked by"}, "inwardIssue": {"key": "ABC-2"}} shape = "ABC-34 is not in the shape Jira Cloud's REST API version 3 documents" for raw, reason in ( ("ABC-34", "the search answered an issue without an issue key"), ({"fields": valid}, "the search answered an issue without an issue key"), ({"key": "abc-34", "fields": valid}, "the search answered an issue without an issue key"), ({"key": "ABC-34", "fields": {"summary": "Count the runs.", "parent": {"key": "ABC-12"}}}, shape + ": KeyError('labels')"), - *((({"key": "ABC-34", "fields": valid | changed}, shape + ": its summary, labels, assignee, status, parent or description holds another kind of value") for changed in ( - {"summary": 3}, {"labels": "api"}, {"labels": [3]}, {"assignee": {"displayName": 0}}, {"status": {"name": 0, "statusCategory": {"key": "new"}}}, {"parent": {"key": "ABC"}}, {"parent": {"key": 12}}, {"description": "text"}, + *((({"key": "ABC-34", "fields": valid | changed}, shape + ": its summary, labels, assignee, status, parent, description or a linked issue's key holds another kind of value") for changed in ( + {"summary": 3}, {"labels": "api"}, {"labels": [3]}, {"assignee": {"displayName": 0}}, {"status": {"name": 0, "statusCategory": {"key": "new"}}}, {"parent": {"key": "ABC"}}, {"parent": {"key": 12}}, {"description": "text"}, {"issuelinks": [linked | {"inwardIssue": {"key": 7}}]}, {"issuelinks": [linked | {"inwardIssue": {"key": "ABC-x"}}]}, ))), + ({"key": "ABC-34", "fields": {key: value for key, value in valid.items() if key != "issuelinks"}}, shape + ": KeyError('issuelinks')"), + ({"key": "ABC-34", "fields": valid, "properties": {"plan-item": "L 2"}}, "ABC-34's issue property plan-item is not a JSON object"), + ({"key": "ABC-34", "fields": valid, "properties": {"plan-item": {"L": "many"}}}, "item ABC-34's L 'many' is not a whole number from 1 to 4; ABC-34 holds it in its issue property plan-item"), + ({"key": "ABC-34", "fields": valid, "properties": None}, shape + ": AttributeError(\"'NoneType' object has no attribute 'get'\")"), ): with self.subTest(raw=raw): self.jira.answers[("POST", SEARCH)] = {"issues": [raw]} diff --git a/bin/plan_store/jira_epic.py b/bin/plan_store/jira_epic.py index 69104cf4..9ffa60ef 100644 --- a/bin/plan_store/jira_epic.py +++ b/bin/plan_store/jira_epic.py @@ -476,7 +476,7 @@ def issue_of(raw: object) -> Issue | Failure: # The answer's nested fields are read as Jira documents them; one missing or of another type ends the read here, as a Failure, so no later step meets it. try: fields = raw["fields"] - links = tuple(Link(link["inwardIssue"]["key"], link["id"]) for link in fields["issuelinks"] if "inwardIssue" in link and link["type"]["inward"] == "is blocked by") + links = blocked_by_links(fields) held = raw.get("properties", {}).get(PROPERTY, {}) summary, description, versions = fields["summary"].strip(), fields["description"], tuple(version["name"] for version in fields["fixVersions"]) except (AttributeError, KeyError, TypeError) as failure: @@ -489,6 +489,11 @@ def issue_of(raw: object) -> Issue | Failure: return issue +def blocked_by_links(fields: dict[str, typing.Any]) -> tuple[Link, ...]: + """The "is blocked by" links among an issue's `issuelinks` field; a KeyError, TypeError or AttributeError where it isn't in the shape Jira documents.""" + return tuple(Link(link["inwardIssue"]["key"], link["id"]) for link in fields["issuelinks"] if "inwardIssue" in link and link["type"]["inward"] == "is blocked by") + + def keys_of(answered: list[object]) -> set[object]: """The key of each issue in the search's answer.""" return {raw.get("key") for raw in answered if isinstance(raw, dict)} diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 1c136508..110d0c05 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2725,3 +2725,20 @@ Read most (opens and searches): - `bin/loop_claude/test_loop_claude.py` 2 - `bin/review_replay/main.py` 2 - `bin/rule_hook/main.py` 2 + +## Reading cost, chunk 755c22e12ace, finished 2026-11-18T16:10:53Z + +114613 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/plan/ranking.py` 6 +- `bin/plan_store/jira_epic.py` 5 +- `rules/todo-items.md` 4 +- `bin/plan/goals_file.py` 2 +- `bin/do_epic/backend/jira.py` 1 +- `bin/do_epic/backend/protocol.py` 1 +- `bin/do_epic/config.py` 1 +- `bin/plan/blockers.py` 1 +- `bin/plan/todo_table.py` 1 +- `docs/decisions.md` 1 From f0d99c8141ac44d96a2ec8c5b5949d01073341c2 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:21:16 +0100 Subject: [PATCH 03/21] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From e5751153a54bc06471fccd2c25108679a8ecf238 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:21:41 +0100 Subject: [PATCH 04/21] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20name=20the?= =?UTF-8?q?=20payroll=20run=20and=20the=20precondition=20in=20the=20exampl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- principles/technical-principles.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/principles/technical-principles.md b/principles/technical-principles.md index 44199dc0..81261b2f 100644 --- a/principles/technical-principles.md +++ b/principles/technical-principles.md @@ -46,7 +46,7 @@ - Assert the outcome — returned values, stored state, emitted output — not how the code reached it. Use real collaborators or fakes; mock only slow, nondeterministic or external edges. BANNED: asserting which internal function ran, or scanning the source with `ast` or a regex. GOOD: `assertEqual(saved_row, {...})` against a fake store; a fake clock. - Pin wording only where the wording is the contract: a message a consumer parses, a published format. For prompts, help and error text, assert the facts the text must carry — an item ID, a model argument, an error code — not the sentence. BANNED: `assertIn("", prompt)`. GOOD: `assertIn("model opus, effort high", prompt)`. - One behaviour per test, named for it, tested once, at the lowest level that reproduces it. No loops or branches in a test body; parametrize the cases. - - A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing. BANNED: `test.skip(created.every((count) => count === 0))`, since a broken payroll also creates zero rows. GOOD: check the precondition before the action, failing with its cause, then `expect(created).toEqual([1, 2, 1])`. + - A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing. BANNED: `test.skip(created.every((count) => count === 0))` after the payroll run under test, since a broken payroll also creates zero rows. GOOD: before running the payroll, check each precondition and fail naming the one that is missing; after it, `expect(created).toEqual([1, 2, 1])`. - Every escaped bug becomes a test that fails without its fix. - Write no test that no real bug could fail: a constant's value, a list's length, the framework's own behaviour. - A test neither sleeps nor asserts on the wall clock, and seeds any randomness. From 61f070c302614174761a4251537ed89fb4e5db5a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:21:41 +0100 Subject: [PATCH 05/21] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20file=20item?= =?UTF-8?q?=20424=20for=20the=20tests=20that=20skip=20today?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- todo.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 7aea3498..b54e32ef 100644 --- a/todo.md +++ b/todo.md @@ -6,12 +6,13 @@ `Bar = 0.1` -`Next ID = 424` +`Next ID = 425` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 424 | 0.12.0 | | principle | **Make each test that skips at run time create the state it needs or fail naming what is missing, so no test in the repo skips at run time.** | 3 | 2 | 1 | 4 | 4 | code health by 3, 1.1 by 3 | 4.8 | | 401 | 0.12.0 | | | **Move loop-claude's cycle, judge, interrupt, tmux and routing into a package a second entry point drives, with loop-claude's behaviour unchanged.** | 3 | 2 | 3 | 6 | 6 | 1 by 3, code health by 2 | 1.8 | | 408 | 0.12.0 | | | **Rank an epic's items by one weight chain, the epic's achieve goals, then code health, then the item's repo goals, then by Blocked by, and re-rank Jira's backlog to match, with people's issues keeping their rank.** | 3 | 2 | 2 | 5 | 4 | 1 by 5 | 1.6 | | 410 | 0.12.0 | 401, 408 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | @@ -81,6 +82,29 @@ ## Details +### 424. Make each test that skips at run time create the state it needs or fail naming what is missing, so no test in the repo skips at run time. + +Follows item 400's bullet in `principles/technical-principles.md` → the tests principle: "A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing." Stability review found the repo's own tests break it in 13 places, each a skip decided at run time: + +- root-less permission checks, `skipIf(os.geteuid() == 0, ...)`: 3 in `bin/loop_claude/test_black_box.py`, 3 in `bin/loop_claude/test_loop_claude.py`, 1 in `bin/routing_figures/test_routing_figures.py`, 1 in `bin/plan_store/test_stores.py`; +- pytest: `skipUnless(HAS_PYTEST, ...)` on the class `Run` in `bin/run_tests/test_run_tests.py`; +- docker: the `docker info` skipif on 2 tests in `bin/adf_codec/test_adf_codec.py`, and `needs_docker` in `bin/touch_predictions/test_touch_predictions.py`; +- /proc: `self.skipTest("no /proc/meminfo ...")` in `bin/run_heavy/test_run_heavy.py`. + +The choice per case is the implementer's: for example, run the permission tests as a non-root user or drop the permission check in favour of an injected failure, take the docker or /proc state from an injected fake, or let the test fail naming what is missing. Done when a grep for `skipIf`, `skipUnless`, `skipTest` and `mark.skip` in the repo's tests finds none. + +Touches: + +- `bin/loop_claude/test_black_box.py`: `Cycles.test_exits_1_when_the_transcript_cannot_be_read`, `Interrupt.test_exits_1_when_the_transcript_cannot_be_read_after_the_interrupt`, `Models.test_exits_1_when_the_models_file_cannot_be_written` +- `bin/loop_claude/test_loop_claude.py`: `Cycles.test_stops_on_a_session_folder_it_cannot_read_whole`, `Cycles.test_stops_keeping_the_transcript_when_the_finished_chunks_session_cannot_be_deleted`, `RoutingCheck.test_says_a_figure_it_cannot_write_and_goes_on` +- `bin/routing_figures/test_routing_figures.py`: `Archive.test_fails_when_it_cannot_keep_the_state` (small) +- `bin/plan_store/test_stores.py`: `FilePlan.test_a_file_it_cannot_write_fails_naming_it` (small) +- `bin/run_tests/test_run_tests.py`: `HAS_PYTEST`, `Run` (small) +- `bin/adf_codec/test_adf_codec.py`: `test_round_trip_through_the_real_container`, `test_the_lossless_pair_gives_back_a_jira_description_identical_and_the_portable_pair_does_not` +- `bin/touch_predictions/test_touch_predictions.py`: `needs_docker`, `PredictedTest.test_a_list_written_in_markdown_and_read_back_from_a_jira_description_reads_as_written`, `PredictedTest.test_a_list_typed_in_jiras_editor_reads_as_its_files_and_parts` +- `bin/run_heavy/test_run_heavy.py`: `RunHeavy.test_a_docker_run_without_limits_gets_three_quarters_of_the_memory_split_across_the_slots` (small) +- `bin/machine_load/memory.py`: `read_memory` (small) + ### 401. Move loop-claude's cycle, judge, interrupt, tmux and routing into a package a second entry point drives, with loop-claude's behaviour unchanged. do-epic runs on these, not on a copy (`docs/decisions.md` → `do-epic: drives one Jira epic …`). Move the reusable modules into `bin/agent_cycle/`: `tmux`, `judge`, `interrupt`, `verdicts`, `retry`, `spend`, `worker`, `states`, `stop`, and the parts of `routing` that take a `ProjectRung` and a `Route`. Keep `routed_item`, `loop/`, `project/`, `escalation_mark` and `chunk_items` in `loop_claude`. Decouple `cycle/run.py`'s archive and `Chunk items:` handling, and `cycle/prompts.py`'s goals-file and `todo.md` names, behind parameters. The places the comprehension seats found hard here, `routing.py` `unfinished_route` and `cycle/judge.py` `quotes_checked`, must read no harder after the move. From 6468c820a342a2e29992c795021fd8c002ffa0b0 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:22:43 +0100 Subject: [PATCH 06/21] File item 428 for the tests that skip at run time --- todo.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 5fdea232..0948f98a 100644 --- a/todo.md +++ b/todo.md @@ -6,12 +6,13 @@ `Bar = 0.1` -`Next ID = 428` +`Next ID = 429` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 428 | 0.12.0 | | principle | **Make each test that skips at run time create the state it needs or fail naming what is missing, so no test in the repo skips at run time.** | 3 | 2 | 1 | 4 | 4 | code health by 3, 1.1 by 3 | 4.8 | | 426 | 0.12.0 | | | **Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 427 | 0.12.0 | 426 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | | 410 | 0.12.0 | 427 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | @@ -82,6 +83,29 @@ ## Details +### 428. Make each test that skips at run time create the state it needs or fail naming what is missing, so no test in the repo skips at run time. + +Follows item 400's bullet in `principles/technical-principles.md` → the tests principle: "A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing." Stability review found the repo's own tests break it in 13 places, each a skip decided at run time: + +- root-less permission checks, `skipIf(os.geteuid() == 0, ...)`: 3 in `bin/loop_claude/test_black_box.py`, 3 in `bin/loop_claude/test_loop_claude.py`, 1 in `bin/routing_figures/test_routing_figures.py`, 1 in `bin/plan_store/test_stores.py`; +- pytest: `skipUnless(HAS_PYTEST, ...)` on the class `Run` in `bin/run_tests/test_run_tests.py`; +- docker: the `docker info` skipif on 2 tests in `bin/adf_codec/test_adf_codec.py`, and `needs_docker` in `bin/plan/test_touches.py`; +- /proc: `self.skipTest("no /proc/meminfo ...")` in `bin/run_heavy/test_run_heavy.py`. + +The choice per case is the implementer's: for example, run the permission tests as a non-root user or drop the permission check in favour of an injected failure, take the docker or /proc state from an injected fake, or let the test fail naming what is missing. Done when a grep for `skipIf`, `skipUnless`, `skipTest` and `mark.skip` in the repo's tests finds none. + +Touches: + +- `bin/loop_claude/test_black_box.py`: `Cycles.test_exits_1_when_the_transcript_cannot_be_read`, `Interrupt.test_exits_1_when_the_transcript_cannot_be_read_after_the_interrupt`, `Models.test_exits_1_when_the_models_file_cannot_be_written` +- `bin/loop_claude/test_loop_claude.py`: `Cycles.test_stops_on_a_session_folder_it_cannot_read_whole`, `Cycles.test_stops_keeping_the_transcript_when_the_finished_chunks_session_cannot_be_deleted`, `RoutingCheck.test_says_a_figure_it_cannot_write_and_goes_on` +- `bin/routing_figures/test_routing_figures.py`: `Archive.test_fails_when_it_cannot_keep_the_state` (small) +- `bin/plan_store/test_stores.py`: `FilePlan.test_a_file_it_cannot_write_fails_naming_it` (small) +- `bin/run_tests/test_run_tests.py`: `HAS_PYTEST`, `Run` (small) +- `bin/adf_codec/test_adf_codec.py`: `test_round_trip_through_the_real_container`, `test_the_lossless_pair_gives_back_a_jira_description_identical_and_the_portable_pair_does_not` +- `bin/plan/test_touches.py`: `needs_docker`, `PredictedTest.test_a_list_written_in_markdown_and_read_back_from_a_jira_description_reads_as_written`, `PredictedTest.test_a_list_typed_in_jiras_editor_reads_as_its_files_and_parts` +- `bin/run_heavy/test_run_heavy.py`: `RunHeavy.test_a_docker_run_without_limits_gets_three_quarters_of_the_memory_split_across_the_slots` (small) +- `bin/machine_load/memory.py`: `read_memory` (small) + ### 426. Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends. Today `EpicIssue` holds none of the three, so do-epic cannot score or order an epic's items (item 408) or tell a person's issue from its own (item 427). The Jira backend reads them as `plan_store/jira_epic.py` does: the `plan-item` issue property, its `Filed by` key, and the "is blocked by" links. The contract tests in `contract.py` cover both backends. From fa34d832aa4af0ed5b5ae1e5844668b5d6098f62 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:23:05 +0100 Subject: [PATCH 07/21] Finish item 400 in the plan --- CHANGELOG.md | 1 + todo.md | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24af261a..954f1364 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- The technical principles now forbid a test that decides at run time whether to check anything, by a conditional skip, early return or catch around its assertions, and stability-reviewer flags one. - do-epic's scorer orders an epic's items by score, then by Blocked by: an item's Moves names a goal as `epic 1.1`, `code health` or `repo 2`, and the epic's achieve goals outweigh the achieve goals of every repo. Nothing calls it yet. - `todo-item add` and `todo-item edit --detail` refuse a detail whose `Touches:` list touch-predictions cannot read, and `rank_todo.py --check` fails on each item holding one, so rule-hook refuses a commit of such a plan: after updating, run `~/.claude/bin/rank_todo.py --check` in each project and fix each list it names. - loop-claude hands each worker's claude a Bash output ceiling of 6,000 characters that saves a longer result to a file, rule-hook refuses a Read of a session transcript under ~/.claude/projects, and review-replay takes --bash-ceiling and --read-limit to test such a limit against archived review rounds. diff --git a/todo.md b/todo.md index 0948f98a..1b300096 100644 --- a/todo.md +++ b/todo.md @@ -20,7 +20,6 @@ | 413 | 0.12.0 | 410 | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | | 415 | 0.12.0 | 410, 413 | | **Finish an epic: run release-review passes on each repo it changed, work what they file, have the human confirm each goal, post a summary comment, and close the epic in Jira last.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | | 418 | 0.12.0 | 415 | | **Describe do-epic in `README.md`'s tools and setup, with its machine settings and `repo-rule.md`.** | 1 | 2 | 1 | 2 | 2 | 1 by 5 | 2.1 | -| 400 | 0.12.0 | | | **Forbid a test that decides at run time whether to check anything in `principles/technical-principles.md`, and point stability-reviewer's Tests checks at it.** | 1 | 2 | 3 | 4 | 2 | 1.1 by 5 | 2.0 | | 420 | 0.12.0 | | | **End a worker that printed its final result and lingers, by killing the background shells it left, after a few minutes, and print each kill with its evidence on loop-claude's terminal.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 6 | 2.0 | | 409 | 0.12.0 | | | **Split an epic item that changes several repos into one Jira sub-task per repo, each labelled for its repo, with the parent tracking the whole change, when do-epic plans the item.** | 2 | 2 | 3 | 5 | 3 | 1 by 5 | 1.9 | | 411 | 0.12.0 | 410 | | **Park a chunk whose PR waits on a long gate, keeping its worktree, PR and session in a state file that survives a reboot, and resume its session when the gate passes or a reviewer comments.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | @@ -187,19 +186,6 @@ Touches: - `README.md`: `## Tools`, `### Set up a project` (small) -### 400. Forbid a test that decides at run time whether to check anything in `principles/technical-principles.md`, and point stability-reviewer's Tests checks at it. - -Today the rule is only implied, by "fails when that behaviour breaks" and "states what it needs and gets it". Proposed bullet under the tests principle: "A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing. BANNED: `test.skip(created.every((count) => count === 0))`, since a broken payroll also creates zero rows. GOOD: check the precondition before the action, failing with its cause, then `expect(created).toEqual([1, 2, 1])`." - -Add one line to section 11 of `agents/stability-reviewer.md` that points at the bullet. - -Source: a client project's pull request, where a fix hid a regression behind a conditional skip. - -Touches: - -- `principles/technical-principles.md` -- `agents/stability-reviewer.md`: `### 11. Tests` (small) - ### 420. End a worker that printed its final result and lingers, by killing the background shells it left, after a few minutes, and print each kill with its evidence on loop-claude's terminal. On 2026-11-18 the worker of the item 402 chunk merged its pull request at about 11:47, printed its summary and then waited 95 minutes: it had started `until [ -s /tmp/merge-402.log ] && ! pgrep -f "chunk-pr merg"; do sleep 15; done` in the background, and `pgrep -f` matched the loop's own command line, so the condition never held. Its `claude -p` stayed alive ("Waiting for background work to finish"), `loop-claude` waited for it to exit, and the window's slot started no new chunk until the human found it and killed the shell. From 51b10aaf4129d30e92a15c42bb468661d9680eaf Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:28:45 +0100 Subject: [PATCH 08/21] File items 428 to 438: principle and review changes brought back from a client setup --- todo.md | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 5fdea232..30f76b58 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 0.1` -`Next ID = 428` +`Next ID = 439` ## Items @@ -21,15 +21,26 @@ | 418 | 0.12.0 | 415 | | **Describe do-epic in `README.md`'s tools and setup, with its machine settings and `repo-rule.md`.** | 1 | 2 | 1 | 2 | 2 | 1 by 5 | 2.1 | | 400 | 0.12.0 | | | **Forbid a test that decides at run time whether to check anything in `principles/technical-principles.md`, and point stability-reviewer's Tests checks at it.** | 1 | 2 | 3 | 4 | 2 | 1.1 by 5 | 2.0 | | 420 | 0.12.0 | | | **End a worker that printed its final result and lingers, by killing the background shells it left, after a few minutes, and print each kill with its evidence on loop-claude's terminal.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 6 | 2.0 | +| 429 | 0.12.0 | | | **Open a chunk's pull request only once its local review is done, where the repo's CI runs on pushed branches, and keep the draft-first order where CI runs only on pull requests.** | 3 | 2 | 3 | 6 | 4 | 1.1 by 3, 1.6 by 4 | 2.0 | +| 433 | 0.12.0 | | | **Let a project's config name a team's convention files in a `conventions` setting, which every reviewer reads beside the principles and standards, the team's rule winning where they conflict.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 6 | 2.0 | | 409 | 0.12.0 | | | **Split an epic item that changes several repos into one Jira sub-task per repo, each labelled for its repo, with the parent tracking the whole change, when do-epic plans the item.** | 2 | 2 | 3 | 5 | 3 | 1 by 5 | 1.9 | | 411 | 0.12.0 | 410 | | **Park a chunk whose PR waits on a long gate, keeping its worktree, PR and session in a state file that survives a reboot, and resume its session when the gate passes or a reviewer comments.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | | 412 | 0.12.0 | 410, 411 | | **Print each chunk of an epic, running, parked with its gate and since when, or stopped, each human task and each open interrupt with `do-epic --status`, and name a parked chunk's gate in its tmux window's name.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | | 414 | 0.12.0 | 410 | | **DM the human through the notifier when a human-task issue blocks the epic's next item, and poll until it closes.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 417 | 0.12.0 | 410 | | **Run do-epic end to end against a sandbox epic on a real Jira site with a command of its own, outside `run-tests`.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | +| 430 | 0.12.0 | | | **Hold tests on a shared environment to five rules in the principles' "Tests and tooling": assert only on named records, touch only owned state, survive any order and a concurrent copy, register teardown before creating, and check what a save stored.** | 1 | 2 | 3 | 4 | 2 | 1.1 by 4 | 1.6 | | 421 | 0.12.0 | | | **Refuse in rule-hook a Bash or Monitor wait that has no end: a loop without a time or count cap, and a `pgrep -f` or `pkill -f` whose pattern the same command line contains.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | +| 432 | 0.12.0 | | | **Have stability-reviewer check, for a change that stores a value differently, that its longest value fits the column and that every search on the column still finds what users type.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 3 | 1.3 | +| 436 | 0.12.0 | | | **Add the principle "Never mock a service your own team runs": test its seam against the real build, and mock only a third party that can't be run locally.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 3 | 1.3 | +| 434 | 0.12.0 | | | **File a plan item to add the language's mutation tool, pinned to a version that supports the project's language version, when `mutate-changes` reports changed files no tool covers.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 3 | 1.2 | | 316 | 0.12.0 | | | **Launch comprehension seats as an agent type of their own under `agents/`, without `CLAUDE.md` and the skill and agent listings a general-purpose subagent carries.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3 | 1.0 | +| 431 | 0.12.0 | | | **Give "Make invalid states unrepresentable" an example about a function's inputs, and the rule to change a signature once review finds a second edge case in a check.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 2 | 0.9 | +| 438 | 0.12.0 | | | **Add the principle "Don't loosen a type when refactoring": a function keeps its concrete return type, and a DTO or value object replaces an `object`, `array`, `mixed` or `any`.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 2 | 0.9 | | 310 | 0.12.0 | | | **Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 3 | 0.9 | | 422 | 0.12.0 | 420 | | **Check every 5 minutes whether a tmux window of the loop looks stuck by other signs than a lingering worker, investigate it with a headless claude, and kill only the process the investigation names.** | 3 | 2 | 3 | 6 | 5 | 1.5 by 4 | 0.8 | +| 428 | 0.12.0 | | | **Split the technical principles into blocking rules and rules of thumb, map a breach of a rule of thumb to 🟡, and add "keep each pull request as small as its chunk allows" to that tier.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 2 | 0.7 | +| 435 | 0.12.0 | | | **Count rounds, diff for review and find the pull request against a stacked branch's own base, in larv-review, rule-hook's round cap, mutate-changes and chunk-pr.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 3, 1.5 by 2 | 0.7 | +| 437 | 0.12.0 | 428 | | **Add "Coverage doesn't fall" to the rules of thumb, as a 🟡 where a change deletes or skips tests of code it keeps, measured only where CI already reports coverage.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 1 | 0.4 | | 365 | 0.13.0 | | | **Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 | | 368 | 0.13.0 | | | **Call a release review due, call a release ready to cut, and tell whether a chunk owes a scoring run, for a plan outside the checkout, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 | | 309 | 0.13.0 | | | **Run a scoring run's second pass on one head with two seats in place of four, once `larv-review agreement` shows the seats agree with each other more than a run agrees with its rerun.** | 2 | 2 | 2 | 4 | 2 | 1.4 by 3 | 1.2 | @@ -192,6 +203,31 @@ Touches: - `bin/loop_claude/loop/lingering_workers.py` - `README.md`: `## Tools` (small) +### 429. Open a chunk's pull request only once its local review is done, where the repo's CI runs on pushed branches, and keep the draft-first order where CI runs only on pull requests. + +Today larv-review §2 opens a draft pull request first, so CI cycles while the review runs. A forge's auto-reviewer reviews drafts too, and human reviewers see them, so outside findings land before any of our own passes have run. In a client's chunk that put about six findings on the forge that our own passes would have caught. Nothing in larv-review needs a pull request before the gate: `reviewer-header` prints `PR: none open at the pushed head`, and round counts read commit titles. + +Where the repo's CI runs on pushed branches: push early, so CI runs; run `chunk-pr open` once every §3 pass is done and §2's tests, static analysis and mutation tests pass; mark it ready at once. Where CI runs only on pull requests, keep today's draft-first order. Decide from the repo's CI config which case holds, and say in the summary which order the chunk took. + +Item 419 runs the auto-reviewer until clean; this item makes its first review see a change our passes already cleaned. + +Touches: +- `skills/larv-review/SKILL.md`: `## 2. Ship the branch`, `## 4. Gate` +- `bin/chunk_pr/main.py`: `opened` (small) +- `bin/chunk_pr/test_chunk_pr.py` + +### 433. Let a project's config name a team's convention files in a `conventions` setting, which every reviewer reads beside the principles and standards, the team's rule winning where they conflict. + +Today a team's conventions reach the reviewers only by hand, and copying them into claude-config's standards would drift. Add an optional `conventions` setting: a list of paths, in the same path syntax as the other settings, such as `checkout:CONVENTIONS.md`. `reviewer-header` prints them, every reviewer reads them beside the principles and the standards, and the team's rule wins where the two conflict, as `CLAUDE.md` → "A client project's `CLAUDE.md` and `AGENTS.md`" already has it for those files. A missing file fails as an empty principles folder does today. + +Touches: +- `bin/project_config/settings.py`: `SETTINGS` +- `bin/project_config/test_project_config.py` +- `bin/larv_review/reviewer_header.py` +- `bin/larv_review/test_larv_review.py` +- `skills/larv-review/SKILL.md`: `### Principles` (small) +- `README.md`: `## Install` (small) + ### 409. Split an epic item that changes several repos into one Jira sub-task per repo, each labelled for its repo, with the parent tracking the whole change, when do-epic plans the item. do-epic predicts the repos from the code, as `Touches:` predictions are made. A person's issue is split too, with a comment for the team in the epic's language (`docs/decisions.md` → `do-epic: drives one Jira epic …`). The parent is finished once every sub-task is. @@ -243,6 +279,22 @@ Touches: - `bin/do-epic-e2e` - `bin/do_epic/e2e/` +### 430. Hold tests on a shared environment to five rules in the principles' "Tests and tooling": assert only on named records, touch only owned state, survive any order and a concurrent copy, register teardown before creating, and check what a save stored. + +A test that runs against a shared environment, such as a staging database or a shared queue, meets other runs' data. Add to the "Tests and tooling" bullet under "Compose, do not entangle": + +- Assert only on records the test created and can name, never on a count or on the first row. +- Never change state the test doesn't own. +- Pass in any order, and beside a second copy of itself running at the same time. +- A test helper registers its teardown before it creates anything, keyed by a value the helper made itself, and the teardown deletes only what it can name. +- A helper that saves checks what was saved, never the status code alone. + +Give one BANNED/GOOD pair for each. These come from a client team's conventions and one of its reviews; state them in our own words, naming neither. + +Touches: +- `principles/technical-principles.md`: `Compose, do not entangle`, `Most, if not all, code should have automated tests, and each test earns its keep.` +- `agents/stability-reviewer.md`: `### 11. Tests` (small) + ### 421. Refuse in rule-hook a Bash or Monitor wait that has no end: a loop without a time or count cap, and a `pgrep -f` or `pkill -f` whose pattern the same command line contains. On 2026-11-18 a worker in the item 402 chunk started `until [ -s /tmp/merge-402.log ] && ! pgrep -f "chunk-pr merg"; do sleep 15; done` in the background. The `pgrep -f` pattern is part of the loop's own command line, so it matched itself and the loop never ended; the worker's `claude -p` waited on it for 95 minutes and its slot started no new chunk (item 420 ends such a worker; item 422 handles other stuck windows). A wait that cannot end is cheaper to refuse before it starts. @@ -260,6 +312,33 @@ Touches: - `bin/rule_hook/test_rule_hook.py`: `CommandBreaches` (small) - `settings.json` +### 432. Have stability-reviewer check, for a change that stores a value differently, that its longest value fits the column and that every search on the column still finds what users type. + +A change that escapes, converts or grows a stored value: the longest value it can now write must fit the column, and every search, filter or comparison on the column must still find what users type. In a client's chunk, escaping text into a TEXT column lowered its overflow limit fivefold, and a LIKE search stopped matching apostrophes. Product-owner and the auto-reviewer caught it; stability didn't. + +It goes in stability-reviewer's "Data Integrity & Persistence" checks, beside the one on a new column, since it is a check a reviewer runs on a change, not a design rule, and the agent is shared by every project. + +Touches: +- `agents/stability-reviewer.md`: `### 7. Data Integrity & Persistence` (small) + +### 436. Add the principle "Never mock a service your own team runs": test its seam against the real build, and mock only a third party that can't be run locally. + +Today the principles say to mock only slow, nondeterministic or external edges, which leaves room to mock a service the team itself runs; such a mock drifts from the real service unseen. Add: test the seam to a service your team runs against its real build, in a harness that runs the real stack. Mock only a third party that can't be run locally in a reasonable way. + +Recommended scope: the rule binds the test that covers the seam. A unit test of the caller's own logic may still use a fake, as "Use real collaborators or fakes" allows, so the lowest-level rule still holds. + +Touches: +- `principles/technical-principles.md`: `Most, if not all, code should have automated tests, and each test earns its keep.` (small) + +### 434. File a plan item to add the language's mutation tool, pinned to a version that supports the project's language version, when `mutate-changes` reports changed files no tool covers. + +`mutate-changes` prints a line naming the changed files in a language no tool covers. Today that line goes to the stability reviewer, which then hunts mutants by hand. In a client's PHP chunk without Infection, three findings were surviving mutants a tool would have reported before review. + +On that line, larv-review §2 files a plan item, or refreshes the one an earlier chunk filed, to add the language's mutation tool to the project, with a pinned version that supports the project's language version. In a plan kept in Jira that is a ticket for the team. + +Touches: +- `skills/larv-review/SKILL.md`: `## 2. Ship the branch` (small) + ### 316. Launch comprehension seats as an agent type of their own under `agents/`, without `CLAUDE.md` and the skill and agent listings a general-purpose subagent carries. Seats run as general-purpose subagents, so each starts with the skill and agent listings, about 7,500 tokens, at $9.00 per 1,000 prefix tokens over the archive measured from 2026-09-30 to 2026-11-11: about 1.3% of spend. An agent under `agents/` with Read, Grep, Glob and Bash, `omitClaudeMd: true`, and the seat's persona in its prompt drops both; a seat reads the project as a newcomer does, which is what it simulates. Keep each seat's prompt from `skills/comprehension-panel/seat-prompts.md`. Check that a scoring run's scores on one head stay within the spread two runs of today's seats show. lilleman approved on 2026-11-11. @@ -275,6 +354,23 @@ Touches: - `bin/rule_hook/test_rule_hook.py`: `ReviewerRung` - `bin/larv_review/test_scoring_setup.py` +### 431. Give "Make invalid states unrepresentable" an example about a function's inputs, and the rule to change a signature once review finds a second edge case in a check. + +The principle's only example is a database time type, so in a client's chunk neither the implementer nor the reviewers connected it to a test helper that validated its own caller's input, over four review rounds. Add: + +- BANNED: a helper that takes a token and a message, and checks that the message holds the token. GOOD: the helper makes the token and builds the message. +- "When a review finds a second edge case in a check, change the signature so the input can't occur." + +Touches: +- `principles/technical-principles.md`: `Make invalid states unrepresentable.` (small) + +### 438. Add the principle "Don't loosen a type when refactoring": a function keeps its concrete return type, and a DTO or value object replaces an `object`, `array`, `mixed` or `any`. + +A function that returned a concrete type keeps returning it when its implementation changes: never degrade it to `object`, `array`, `mixed` or `any`. Introduce a DTO or value object instead. From a client team's PHP conventions, but it holds in any typed language. Add it under "Validate data and build DTOs as early as possible.", with one BANNED/GOOD pair. + +Touches: +- `principles/technical-principles.md`: `Validate data and build DTOs as early as possible.` (small) + ### 310. Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then. 281 worker resumes after the 1-hour cache expired rewrote a whole context, $379 of the $9,154 measured from 2026-09-30 to 2026-11-11 (4.1%). A compaction while the cache is warm reads the context at a twentieth of the input price and leaves about 20k tokens to rewrite later. @@ -306,6 +402,45 @@ Touches: - `bin/agent_cycle/tmux.py`: `Listed`, `listed` - `README.md`: `## Tools` (small) +### 428. Split the technical principles into blocking rules and rules of thumb, map a breach of a rule of thumb to 🟡, and add "keep each pull request as small as its chunk allows" to that tier. + +Today every principle holds at blocking strength: a breach is a 🔴. A client team's principles keep a "Rules of thumb" tier whose breach is guidance. Add the tier as its own section of `principles/technical-principles.md`, and map a breach of a rule in it to 🟡 in `review-findings.md`. + +Its first rule: "Keep each pull request as small as its chunk allows: leave out every change none of the chunk's items needs." Not "as small as possible": the working loop bundles items that share a review into one chunk on purpose, since each review has a fixed cost, and a bare small-PR rule would contradict it. + +Touches: +- `principles/technical-principles.md`: `# Principles` +- `skills/larv-review/review-findings.md` +- `agents/principles-auditor.md` + +### 435. Count rounds, diff for review and find the pull request against a stacked branch's own base, in larv-review, rule-hook's round cap, mutate-changes and chunk-pr. + +For a branch based on another chunk's branch, round counts and the review diff are taken against the default branch, so they count the parent pull request's rounds too. In a client's chunk, rule-hook's round cap refused a real round commit, and `reviewer-header` reported "stability takes no more rounds". `chunk-pr open` and `ready` only find pull requests into the default branch. + +Take the pull request's base, from the forge or from a `--base ` option, everywhere a merge base or a commit range with the default branch is taken. The CLAUDE.md rule to branch off the default branch stays the default; a stack is the exception a team's workflow asks for. + +Touches: +- `bin/git_cli/git_repo.py`: `default_branch`, `default_ref`, `branch_titles` +- `bin/larv_review/main.py`: `with_default_branch` +- `bin/larv_review/reviewer_header.py` +- `bin/larv_review/owed.py` +- `bin/rule_hook/round_cap.py`: `earlier_titles` +- `bin/chunk_pr/main.py`: `default_branch`, `opened` +- `bin/mutate_changes/main.py`: `mutate` +- `bin/larv_review/test_larv_review.py` +- `bin/chunk_pr/test_chunk_pr.py` +- `bin/rule_hook/test_rule_hook.py` +- `skills/larv-review/SKILL.md`: `## 2. Ship the branch` (small) + +### 437. Add "Coverage doesn't fall" to the rules of thumb, as a 🟡 where a change deletes or skips tests of code it keeps, measured only where CI already reports coverage. + +A client team holds "Test coverage must not decline" as a principle. Ours says "Coverage is no target: it finds untested code, not weak tests", and the mutation rule already fails a changed line no test runs, since its mutants survive. What a coverage ratchet adds is a signal on unchanged code whose tests a change deleted or weakened. + +Recommendation: add it to item 428's rules-of-thumb tier as "Coverage doesn't fall", a 🟡 where a change deletes or skips tests of code it keeps; measure it only where the project's CI already reports coverage, and add no coverage tooling for it. Never a target, so the existing line stays. + +Touches: +- `principles/technical-principles.md`: `Every mutant of a changed line fails a test` (small) + ### 365. Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs. lilleman's call, 2026-11-12: 0.10.0 and 0.11.0 switch the history tools off for a plan outside the checkout, and 0.13.0 holds only their ports. In Jira a dropped item, which `Drop item` commit titles mark today, is an issue resolved by a resolution the config names. From 9cc505b764fe024170fcd911906e4710582147a5 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:33:04 +0100 Subject: [PATCH 09/21] Fail the tests that skipped at run time, naming what they miss, and give CI's tests docker --- README.md | 2 +- bin/adf_codec/test_adf_codec.py | 8 +++----- bin/loop_claude/test_black_box.py | 8 ++++---- bin/loop_claude/test_loop_claude.py | 7 ++++--- bin/plan/test_touches.py | 10 ++-------- bin/plan_store/test_stores.py | 4 ++-- bin/routing_figures/test_routing_figures.py | 4 ++-- bin/run_heavy/test_run_heavy.py | 3 +-- bin/run_tests/test_run_tests.py | 15 +++++---------- bin/test_env.py | 6 ++++++ ci.sh | 9 +++++++-- 11 files changed, 37 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 3b5caed1..bec11763 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a Test on the host with `bin/run-tests`, which runs pytest through `uvx`, pinned in `bin/run_tests/main.py`. It prints each failing test with its error and pytest's summary line, and saves the whole output to a file whose path it prints. It passes on any test paths or pytest options it is given, such as `bin/run-tests bin/chunk_pr -x`. It needs `uv` on `PATH`, which fetches pytest, pytest-xdist and mypy. pytest-xdist runs the tests in one worker per CPU of a heavy slot (`docs/decisions.md` → `bin/: the tools support only the latest stable Python, …`). `python3 -m unittest discover -s bin -p 'test_*.py'` runs the same tests one at a time. Test the bench's scripts with `python3 -m unittest discover -s workflow-bench -p 'test_*.py'`. -CI runs `ci.sh` on every pull request, and `main` doesn't merge anything until it passes. The script runs the same tests on the committed HEAD in a pinned Python container; run it under `run-heavy` to reproduce a CI failure, with Docker on `PATH`. +CI runs `ci.sh` on every pull request, and `main` doesn't merge anything until it passes. The script runs the same tests on the committed HEAD in a pinned Python container, which reaches the host's docker daemon for the tests that run the adf-codec shim; run it under `run-heavy` to reproduce a CI failure, with Docker on `PATH`. To mutation-test the lines a branch changes, run `~/.claude/bin/run-heavy ~/.claude/bin/mutate-changes --prefix 'uvx --python "$(command -v python3)" --with pytest==9.2.0 --from "mutmut>=3,<4"'` in its checkout. diff --git a/bin/adf_codec/test_adf_codec.py b/bin/adf_codec/test_adf_codec.py index b264cc24..c1f79f42 100644 --- a/bin/adf_codec/test_adf_codec.py +++ b/bin/adf_codec/test_adf_codec.py @@ -1,7 +1,6 @@ import contextlib import json import os -import shutil import subprocess import pytest @@ -296,10 +295,10 @@ def test_container_run_passes_an_image_failure_through(tmp_path): assert convert.container_run("to-adf", "text", scripted(down), shim_dir(tmp_path)) == down -@pytest.mark.skipif(shutil.which("docker") is None or subprocess.run(["docker", "info"], capture_output=True, timeout=20).returncode != 0, reason="needs a docker daemon") def test_round_trip_through_the_real_container(): doc = convert.markdown_to_adf("# Title\n\nSome **bold** text.\n") - assert isinstance(doc, dict) and doc["type"] == "doc" and doc["content"][0]["type"] == "heading" + assert isinstance(doc, dict), doc + assert doc["type"] == "doc" and doc["content"][0]["type"] == "heading" markdown = convert.adf_to_markdown(doc) assert isinstance(markdown, str) and markdown.startswith("# Title") and "**bold**" in markdown refused = convert.adf_to_markdown({"type": "nope"}) @@ -324,10 +323,9 @@ JIRA_DESCRIPTION = { } -@pytest.mark.skipif(shutil.which("docker") is None or subprocess.run(["docker", "info"], capture_output=True, timeout=20).returncode != 0, reason="needs a docker daemon") def test_the_lossless_pair_gives_back_a_jira_description_identical_and_the_portable_pair_does_not(): markdown = convert.adf_to_markdown_lossless(JIRA_DESCRIPTION) - assert isinstance(markdown, str) + assert isinstance(markdown, str), markdown assert convert.markdown_to_adf_lossless(markdown) == JIRA_DESCRIPTION assert convert.adfs_to_markdown_lossless([JIRA_DESCRIPTION, JIRA_DESCRIPTION]) == [markdown, markdown] portable = convert.markdown_to_adf(convert.adf_to_markdown(JIRA_DESCRIPTION)) diff --git a/bin/loop_claude/test_black_box.py b/bin/loop_claude/test_black_box.py index ff4fdb3d..8e26f551 100644 --- a/bin/loop_claude/test_black_box.py +++ b/bin/loop_claude/test_black_box.py @@ -18,7 +18,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from test_env import isolated_env +from test_env import assert_not_root, isolated_env from project_config.test_project_config import write_config BIN = pathlib.Path(__file__).resolve().parents[1] @@ -753,8 +753,8 @@ class Cycles(unittest.TestCase): self.assertIn("past the noise", run.stdout) self.assertIn("past the noise", run.calls[1]["stdin"]) - @unittest.skipIf(os.geteuid() == 0, "root reads an unreadable file") def test_exits_1_when_the_transcript_cannot_be_read(self): + assert_not_root(self) checkout = Checkout(self) run = checkout.run([worker(unreadable=True)]) self.assertEqual((run.code, run.roles()), (1, ["worker"])) @@ -1000,8 +1000,8 @@ class Interrupt(unittest.TestCase): self.assertFalse(run.calls[2]["ctrl_c_ignored"]) self.assertIn("[human] B", run.calls[3]["stdin"]) - @unittest.skipIf(os.geteuid() == 0, "root reads an unreadable file") def test_exits_1_when_the_transcript_cannot_be_read_after_the_interrupt(self): + assert_not_root(self) checkout = Checkout(self) run = checkout.run([worker(say="A or B?"), judge(interrupt=True, evidence="A or B?", question="A or B?"), interrupt(type="B", unreadable=True)], terminal_input="/talk\n", before_typing=ANSWERING) self.assertEqual((run.code, run.roles()), (1, ["worker", "judge", "interrupt"])) @@ -1082,8 +1082,8 @@ class Models(unittest.TestCase): self.assertIn("no model catalog cached", run.stderr) self.assertEqual(argument(run.calls[0], "--model"), "1") - @unittest.skipIf(os.geteuid() == 0, "root writes into a read-only directory") def test_exits_1_when_the_models_file_cannot_be_written(self): + assert_not_root(self) checkout = Checkout(self) del checkout.env["LOOP_CLAUDE_JUDGE_MODEL"], checkout.env["LOOP_CLAUDE_WORKER_MODEL"] checkout.models_file().parent.mkdir(parents=True, mode=0o500) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index 873ae18d..bb223bff 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -18,6 +18,7 @@ import uuid sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) +from test_env import assert_not_root from routing_figures import archive, state from claude_code.output_limits import BASH_CEILING_CHARACTERS from routing_figures.calls import Call @@ -519,8 +520,8 @@ Spent since 2026-09-21T14:13:20Z, in tokens of input, cache write 5m, cache writ [next_chunk] = set(self.archive.iterdir()) - {chunk} self.assertEqual(sorted(path.read_text() for path in (next_chunk / "session" / str(self.session.id)).glob("custom-title.json*")), ["third"]) - @unittest.skipIf(os.geteuid() == 0, "root reads an unreadable folder") def test_stops_on_a_session_folder_it_cannot_read_whole(self): + assert_not_root(self) locked = self.paths.claude_code_transcripts / "-fake" / str(self.session.id) / "subagents" locked.mkdir(parents=True) locked.chmod(0) @@ -689,8 +690,8 @@ Spent since 2026-09-21T14:13:20Z, in tokens of input, cache write 5m, cache writ self.assertIn(f"\n{STAMP} Which one?\a\n", said.getvalue()) self.assertNotIn("Use ... A.", said.getvalue()) - @unittest.skipIf(os.geteuid() == 0, "root writes into a read-only directory") def test_stops_keeping_the_transcript_when_the_finished_chunks_session_cannot_be_deleted(self): + assert_not_root(self) folder = self.paths.claude_code_transcripts / "-fake" / str(self.session.id) (folder / "subagents").mkdir(parents=True) folder.chmod(0o500) @@ -967,8 +968,8 @@ class RoutingCheck(unittest.TestCase): stop, _ = self.check(FakeEffects(on_terminal_claude=[OSError(2, "No such file or directory")], git=[UNREAD] * 3)) self.assertEqual(stop, Stop(1, f"could not start claude for the routing calls in {self.home / 'code' / 'claude-config'}, the setup's development clone: No such file or directory")) - @unittest.skipIf(os.geteuid() == 0, "root writes into a read-only directory") def test_says_a_figure_it_cannot_write_and_goes_on(self): + assert_not_root(self) self.chunks(5, 4) (self.root / "routing-figures.lock").touch() self.root.chmod(0o555) diff --git a/bin/plan/test_touches.py b/bin/plan/test_touches.py index d0e0b18d..75966665 100644 --- a/bin/plan/test_touches.py +++ b/bin/plan/test_touches.py @@ -1,6 +1,4 @@ import pathlib -import shutil -import subprocess import sys import unittest @@ -22,9 +20,6 @@ Touches: More prose, with `bin/b.py` named. """ -needs_docker = unittest.skipIf(shutil.which("docker") is None or subprocess.run(["docker", "info"], capture_output=True, timeout=20).returncode != 0, "adf_codec runs in a container, which needs a docker daemon") - - def text(words: str, code: bool = False) -> dict: return {"type": "text", "text": words, **({"marks": [{"type": "code"}]} if code else {})} @@ -90,15 +85,14 @@ class PredictedTest(unittest.TestCase): def test_a_longer_run_with_a_space_at_one_end_only_keeps_it(self) -> None: self.assertEqual(predicted("Touches:\n- `a.md`: `` x``, ``y ``, `` a ``\n"), {"a.md": (Part(" x"), Part("y "), Part("a"))}) - @needs_docker def test_a_list_written_in_markdown_and_read_back_from_a_jira_description_reads_as_written(self) -> None: description = convert.markdown_to_adf(DETAIL) - assert isinstance(description, dict) + assert isinstance(description, dict), description self.assertEqual(predicted(convert.adf_to_markdown(description)), predicted(DETAIL)) - @needs_docker def test_a_list_typed_in_jiras_editor_reads_as_its_files_and_parts(self) -> None: read = convert.adf_to_markdown(JIRA_TOUCHES) + assert isinstance(read, str), read self.assertEqual(predicted(read), { "bin/a.py": (Part("main"), Part("Plan.branch", small=True)), "a`b.md": (Part("## The `foo` tool", small=True), Part("`x`")), diff --git a/bin/plan_store/test_stores.py b/bin/plan_store/test_stores.py index 755d6c9e..af711edb 100644 --- a/bin/plan_store/test_stores.py +++ b/bin/plan_store/test_stores.py @@ -1,6 +1,5 @@ import dataclasses import decimal -import os import pathlib import sys import tempfile @@ -8,6 +7,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) +from test_env import assert_not_root from project_config.settings import DEFAULT_FLOOR, Epic, Finish, JiraScoring, ProjectConfig, SETTINGS from failure import Failure from record_store.stores import FileStore, goals_store, store as record_store @@ -136,8 +136,8 @@ class FilePlan(FilePlanContract): self.assertEqual(store.edit(id_, {}, "### Why\n"), Failure(split)) self.assertEqual((self.folder / "todo.md").read_text(), before) - @unittest.skipIf(os.geteuid() == 0, "root writes into a read-only directory") def test_a_file_it_cannot_write_fails_naming_it(self): + assert_not_root(self) store = self.new_store() self.folder.chmod(0o555) self.addCleanup(self.folder.chmod, 0o755) diff --git a/bin/routing_figures/test_routing_figures.py b/bin/routing_figures/test_routing_figures.py index 71d90647..dad79153 100644 --- a/bin/routing_figures/test_routing_figures.py +++ b/bin/routing_figures/test_routing_figures.py @@ -25,7 +25,7 @@ from routing_figures.state import due from claude_code.entries import entry_from from failure import Failure from git_cli import git_repo -from test_env import isolated_env +from test_env import assert_not_root, isolated_env from plan.todo_table import Item from transcript_archive import outcomes, write from model_routing.ladder_file import read_ladder, SHIPPED @@ -495,8 +495,8 @@ class Archive(unittest.TestCase): self.assertIsNone(state.mark_raised(self.root, [a], "2026-10-15T02:00:00Z")) self.assertEqual(state.raised(self.root), state.Raised("2026-10-15T01:00:00Z", frozenset({a}))) - @unittest.skipIf(os.geteuid() == 0, "root writes into a read-only directory") def test_fails_when_it_cannot_keep_the_state(self): + assert_not_root(self) self.root.chmod(0o555) self.addCleanup(self.root.chmod, 0o755) self.assertIsInstance(state.mark_measured(self.root, 40), Failure) diff --git a/bin/run_heavy/test_run_heavy.py b/bin/run_heavy/test_run_heavy.py index f028d6b7..af147f8d 100644 --- a/bin/run_heavy/test_run_heavy.py +++ b/bin/run_heavy/test_run_heavy.py @@ -94,8 +94,7 @@ class RunHeavy(unittest.TestCase): def test_a_docker_run_without_limits_gets_three_quarters_of_the_memory_split_across_the_slots(self): memory = read_memory() - if memory is None: - self.skipTest("no /proc/meminfo to read the share from") + assert memory is not None, "this test reads the share from /proc/meminfo, which only Linux has" share = f"{memory.total * 3 // 4 // slot_count(usable_cpus()) // 1024}m" result = self.run_tool("docker", "run", "--rm", "img", "true", env=self.fake_docker()) self.assertEqual((result.returncode, result.stdout), (0, f"run --memory {share} --memory-swap {share} --rm img true\n")) diff --git a/bin/run_tests/test_run_tests.py b/bin/run_tests/test_run_tests.py index 139f316e..9e31a7e7 100644 --- a/bin/run_tests/test_run_tests.py +++ b/bin/run_tests/test_run_tests.py @@ -1,5 +1,4 @@ import contextlib -import importlib.util import io from unittest import mock import os @@ -14,10 +13,8 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from run_tests import main BIN = pathlib.Path(__file__).resolve().parents[1] -# The suite runs under pytest, and `python3 -m unittest` may run it where pytest is not installed. -HAS_PYTEST = importlib.util.find_spec("pytest") is not None -HAS_XDIST = importlib.util.find_spec("xdist") is not None -PYTEST_HERE = [sys.executable, "-m", "pytest", "-p", "no:cacheprovider"] +# The pytest and pytest-xdist run-tests pins, without its worker count, so the tests run them whether or not the interpreter running the tests has pytest. +PYTEST_PINNED = [*main.PYTEST[:main.PYTEST.index("-n")], "-p", "no:cacheprovider"] class PytestArgs(unittest.TestCase): @@ -109,7 +106,6 @@ class RunWithAStandIn(unittest.TestCase): self.assertEqual(err.getvalue(), "run-tests: cannot start /no/such/uvx: No such file or directory\n") -@unittest.skipUnless(HAS_PYTEST, "needs pytest importable") class Run(unittest.TestCase): def run_in(self, folder: str, pytest: list[str], *args: str) -> tuple[int, str]: out = io.StringIO() @@ -127,7 +123,7 @@ class Run(unittest.TestCase): def test_a_passing_run_prints_the_summary_line_and_the_log_path(self): with tempfile.TemporaryDirectory() as folder: pathlib.Path(folder, "test_ok.py").write_text("def test_ok():\n\tprint('noise from a passing test')\n") - code, output = self.run_in(folder, PYTEST_HERE, "-s", folder) + code, output = self.run_in(folder, PYTEST_PINNED, "-s", folder) self.assertEqual(code, 0) lines = output.rstrip("\n").splitlines() self.assertEqual(len(lines), 2, output) @@ -136,10 +132,9 @@ class Run(unittest.TestCase): def test_a_failing_run_prints_each_failing_test_with_its_error(self): # pytest-xdist drops the error from the short summary's lines, so the run takes it from the FAILURES section. - workers = ["-n", "2"] if HAS_XDIST else [] with tempfile.TemporaryDirectory() as folder: pathlib.Path(folder, "test_bad.py").write_text("def test_ok():\n\tpass\n\ndef test_bad():\n\tassert 1 == 2, 'one is not two'\n\ndef test_long():\n\traise ValueError('\\n'.join(map(str, range(30))))\n") - code, output = self.run_in(folder, PYTEST_HERE, *workers, folder) + code, output = self.run_in(folder, PYTEST_PINNED, "-n", "2", folder) self.assertEqual(code, 1) self.assertRegex(output, r"(?m)^_+ test_bad _+\nE +AssertionError: one is not two\n(E .*\n)*.*test_bad\.py:5: AssertionError$") self.assertRegex(output, r"(?m)^FAILED .*test_bad\.py::test_bad\b") @@ -158,7 +153,7 @@ class Run(unittest.TestCase): def test_a_run_that_prints_no_summary_line_shows_the_logs_last_lines(self): with tempfile.TemporaryDirectory() as folder: - code, output = self.run_in(folder, PYTEST_HERE, "--no-such-option", folder) + code, output = self.run_in(folder, PYTEST_PINNED, "--no-such-option", folder) self.assertEqual(code, 1) self.assertIn("run-tests: pytest printed no summary line; the log ends:", output) self.assertIn("--no-such-option", output) diff --git a/bin/test_env.py b/bin/test_env.py index 528ac255..ab231493 100644 --- a/bin/test_env.py +++ b/bin/test_env.py @@ -1,7 +1,13 @@ import os +import unittest # A git hook's GIT_DIR, the host's LOOP_CLAUDE_* or PYTHONPATH would point the program under test at the host's own state, # and the host's CLAUDE_CODE_SANDBOXED would hide whether loop-claude sets it. def isolated_env() -> dict[str, str]: return {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "LOOP_CLAUDE_", "PYTHON")) and name != "CLAUDE_CODE_SANDBOXED"} + + +# Root ignores file permissions, so a test that makes a file unreadable or a folder read-only needs another user. +def assert_not_root(test: unittest.TestCase) -> None: + test.assertNotEqual(os.geteuid(), 0, "this test needs file permissions to bind it, which they don't for root: run the tests as another user") diff --git a/ci.sh b/ci.sh index d9ddcd76..d5d44325 100755 --- a/ci.sh +++ b/ci.sh @@ -1,10 +1,15 @@ #!/bin/sh -# Runs the test suite on the committed HEAD as CI does: in a pinned Python container, as the caller's uid, so the tests that skip under root still run. +# Runs the test suite on the committed HEAD as CI does: in a pinned Python container, as the caller's uid, so the tests that need file permissions to bind them run. # It is sh, not Python, since it runs on the CI runner's host, which needs only git and docker. # The repo goes in as a git bundle rather than a bind mount, so the script works whether the CI runner shares the docker daemon's filesystem or not. +# The adf-codec tests run their shim's container, so the test container holds a docker client and reaches the daemon through its socket, which the daemon mounts from its own host. set -eu cd "$(dirname "$0")" -git bundle create - HEAD | docker run --rm -i --memory 4g --memory-swap 4g --user "$(id -u):$(id -g)" -e HOME=/tmp python:3.14.8 sh -euc ' +socket=/var/run/docker.sock +image="claude-config-ci:$$" +printf 'FROM docker:29.1.3-cli AS docker\nFROM python:3.14.8\nCOPY --from=docker /usr/local/bin/docker /usr/local/bin/docker\n' | docker build --quiet --memory 1g --memory-swap 1g --tag "$image" - >/dev/null +trap 'docker image rm "$image" >/dev/null' EXIT +git bundle create - HEAD | docker run --rm -i --memory 4g --memory-swap 4g --user "$(id -u):$(id -g)" --group-add "$(stat -c %g "$socket")" -v "$socket:$socket" -e HOME=/tmp "$image" sh -euc ' cat >/tmp/head.bundle git -c init.defaultBranch=main -c advice.detachedHead=false clone --quiet /tmp/head.bundle /tmp/repo cd /tmp/repo From c864650fa00a118b86c89978f099a7024365ad26 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:33:29 +0100 Subject: [PATCH 10/21] Append the reading-cost figures --- docs/reading-cost.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 1c136508..97294917 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2725,3 +2725,47 @@ Read most (opens and searches): - `bin/loop_claude/test_loop_claude.py` 2 - `bin/review_replay/main.py` 2 - `bin/rule_hook/main.py` 2 + +## Reading cost, chunk 755c22e12ace, finished 2026-11-18T16:10:53Z + +114613 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/plan/ranking.py` 6 +- `bin/plan_store/jira_epic.py` 5 +- `rules/todo-items.md` 4 +- `bin/plan/goals_file.py` 2 +- `bin/do_epic/backend/jira.py` 1 +- `bin/do_epic/backend/protocol.py` 1 +- `bin/do_epic/config.py` 1 +- `bin/plan/blockers.py` 1 +- `bin/plan/todo_table.py` 1 +- `docs/decisions.md` 1 + +## Reading cost, chunk 5178e8fcc756, finished 2026-11-18T16:16:09Z + +240957 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/loop_claude/test_loop_claude.py` 11 +- `README.md` 6 +- `bin/agent_cycle/routing.py` 3 +- `docs/decisions.md` 3 +- `.gitignore` 2 +- `bin/agent_cycle/test_quotes.py` 2 +- `bin/loop_claude/cycle/__init__.py` 2 +- `bin/loop_claude/cycle/prompts.py` 2 +- `bin/loop_claude/loop/main.py` 2 +- `ci.sh` 2 + +## Reading cost, chunk 26709555b08d, finished 2026-11-18T16:28:37Z + +50266 new input tokens before the first commit. + +Read most (opens and searches): + +- `principles/technical-principles.md` 2 +- `README.md` 1 +- `agents/stability-reviewer.md` 1 From da066fd0b4a6e2111eae27d5a8bc99d5381bd360 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:34:50 +0100 Subject: [PATCH 11/21] Drop items 428, 430, 431, 432, 433, 434, 435, 436, 437 and 438: merged into item 429, or dropped by the human --- todo.md | 153 +++++++++----------------------------------------------- 1 file changed, 23 insertions(+), 130 deletions(-) diff --git a/todo.md b/todo.md index 30f76b58..c75e9fb0 100644 --- a/todo.md +++ b/todo.md @@ -21,26 +21,16 @@ | 418 | 0.12.0 | 415 | | **Describe do-epic in `README.md`'s tools and setup, with its machine settings and `repo-rule.md`.** | 1 | 2 | 1 | 2 | 2 | 1 by 5 | 2.1 | | 400 | 0.12.0 | | | **Forbid a test that decides at run time whether to check anything in `principles/technical-principles.md`, and point stability-reviewer's Tests checks at it.** | 1 | 2 | 3 | 4 | 2 | 1.1 by 5 | 2.0 | | 420 | 0.12.0 | | | **End a worker that printed its final result and lingers, by killing the background shells it left, after a few minutes, and print each kill with its evidence on loop-claude's terminal.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 6 | 2.0 | -| 429 | 0.12.0 | | | **Open a chunk's pull request only once its local review is done, where the repo's CI runs on pushed branches, and keep the draft-first order where CI runs only on pull requests.** | 3 | 2 | 3 | 6 | 4 | 1.1 by 3, 1.6 by 4 | 2.0 | -| 433 | 0.12.0 | | | **Let a project's config name a team's convention files in a `conventions` setting, which every reviewer reads beside the principles and standards, the team's rule winning where they conflict.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 6 | 2.0 | | 409 | 0.12.0 | | | **Split an epic item that changes several repos into one Jira sub-task per repo, each labelled for its repo, with the parent tracking the whole change, when do-epic plans the item.** | 2 | 2 | 3 | 5 | 3 | 1 by 5 | 1.9 | | 411 | 0.12.0 | 410 | | **Park a chunk whose PR waits on a long gate, keeping its worktree, PR and session in a state file that survives a reboot, and resume its session when the gate passes or a reviewer comments.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | | 412 | 0.12.0 | 410, 411 | | **Print each chunk of an epic, running, parked with its gate and since when, or stopped, each human task and each open interrupt with `do-epic --status`, and name a parked chunk's gate in its tmux window's name.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | | 414 | 0.12.0 | 410 | | **DM the human through the notifier when a human-task issue blocks the epic's next item, and poll until it closes.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 417 | 0.12.0 | 410 | | **Run do-epic end to end against a sandbox epic on a real Jira site with a command of its own, outside `run-tests`.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | -| 430 | 0.12.0 | | | **Hold tests on a shared environment to five rules in the principles' "Tests and tooling": assert only on named records, touch only owned state, survive any order and a concurrent copy, register teardown before creating, and check what a save stored.** | 1 | 2 | 3 | 4 | 2 | 1.1 by 4 | 1.6 | | 421 | 0.12.0 | | | **Refuse in rule-hook a Bash or Monitor wait that has no end: a loop without a time or count cap, and a `pgrep -f` or `pkill -f` whose pattern the same command line contains.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 4 | 1.3 | -| 432 | 0.12.0 | | | **Have stability-reviewer check, for a change that stores a value differently, that its longest value fits the column and that every search on the column still finds what users type.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 3 | 1.3 | -| 436 | 0.12.0 | | | **Add the principle "Never mock a service your own team runs": test its seam against the real build, and mock only a third party that can't be run locally.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 3 | 1.3 | -| 434 | 0.12.0 | | | **File a plan item to add the language's mutation tool, pinned to a version that supports the project's language version, when `mutate-changes` reports changed files no tool covers.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 3 | 1.2 | | 316 | 0.12.0 | | | **Launch comprehension seats as an agent type of their own under `agents/`, without `CLAUDE.md` and the skill and agent listings a general-purpose subagent carries.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3 | 1.0 | -| 431 | 0.12.0 | | | **Give "Make invalid states unrepresentable" an example about a function's inputs, and the rule to change a signature once review finds a second edge case in a check.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 2 | 0.9 | -| 438 | 0.12.0 | | | **Add the principle "Don't loosen a type when refactoring": a function keeps its concrete return type, and a DTO or value object replaces an `object`, `array`, `mixed` or `any`.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 2 | 0.9 | +| 429 | 0.12.0 | | | **Bring nine lessons from a client setup into the principles, the reviewers, larv-review and the project config, and rank a deterministic tool first where an outside reviewer's finding changes the setup.** | 4 | 2 | 3 | 7 | 7 | 1.1 by 5, 1.6 by 5 | 0.9 | | 310 | 0.12.0 | | | **Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 3 | 0.9 | | 422 | 0.12.0 | 420 | | **Check every 5 minutes whether a tmux window of the loop looks stuck by other signs than a lingering worker, investigate it with a headless claude, and kill only the process the investigation names.** | 3 | 2 | 3 | 6 | 5 | 1.5 by 4 | 0.8 | -| 428 | 0.12.0 | | | **Split the technical principles into blocking rules and rules of thumb, map a breach of a rule of thumb to 🟡, and add "keep each pull request as small as its chunk allows" to that tier.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 2 | 0.7 | -| 435 | 0.12.0 | | | **Count rounds, diff for review and find the pull request against a stacked branch's own base, in larv-review, rule-hook's round cap, mutate-changes and chunk-pr.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 3, 1.5 by 2 | 0.7 | -| 437 | 0.12.0 | 428 | | **Add "Coverage doesn't fall" to the rules of thumb, as a 🟡 where a change deletes or skips tests of code it keeps, measured only where CI already reports coverage.** | 1 | 2 | 3 | 4 | 1 | 1.1 by 1 | 0.4 | | 365 | 0.13.0 | | | **Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 | | 368 | 0.13.0 | | | **Call a release review due, call a release ready to cut, and tell whether a chunk owes a scoring run, for a plan outside the checkout, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 | | 309 | 0.13.0 | | | **Run a scoring run's second pass on one head with two seats in place of four, once `larv-review agreement` shows the seats agree with each other more than a run agrees with its rerun.** | 2 | 2 | 2 | 4 | 2 | 1.4 by 3 | 1.2 | @@ -203,31 +193,6 @@ Touches: - `bin/loop_claude/loop/lingering_workers.py` - `README.md`: `## Tools` (small) -### 429. Open a chunk's pull request only once its local review is done, where the repo's CI runs on pushed branches, and keep the draft-first order where CI runs only on pull requests. - -Today larv-review §2 opens a draft pull request first, so CI cycles while the review runs. A forge's auto-reviewer reviews drafts too, and human reviewers see them, so outside findings land before any of our own passes have run. In a client's chunk that put about six findings on the forge that our own passes would have caught. Nothing in larv-review needs a pull request before the gate: `reviewer-header` prints `PR: none open at the pushed head`, and round counts read commit titles. - -Where the repo's CI runs on pushed branches: push early, so CI runs; run `chunk-pr open` once every §3 pass is done and §2's tests, static analysis and mutation tests pass; mark it ready at once. Where CI runs only on pull requests, keep today's draft-first order. Decide from the repo's CI config which case holds, and say in the summary which order the chunk took. - -Item 419 runs the auto-reviewer until clean; this item makes its first review see a change our passes already cleaned. - -Touches: -- `skills/larv-review/SKILL.md`: `## 2. Ship the branch`, `## 4. Gate` -- `bin/chunk_pr/main.py`: `opened` (small) -- `bin/chunk_pr/test_chunk_pr.py` - -### 433. Let a project's config name a team's convention files in a `conventions` setting, which every reviewer reads beside the principles and standards, the team's rule winning where they conflict. - -Today a team's conventions reach the reviewers only by hand, and copying them into claude-config's standards would drift. Add an optional `conventions` setting: a list of paths, in the same path syntax as the other settings, such as `checkout:CONVENTIONS.md`. `reviewer-header` prints them, every reviewer reads them beside the principles and the standards, and the team's rule wins where the two conflict, as `CLAUDE.md` → "A client project's `CLAUDE.md` and `AGENTS.md`" already has it for those files. A missing file fails as an empty principles folder does today. - -Touches: -- `bin/project_config/settings.py`: `SETTINGS` -- `bin/project_config/test_project_config.py` -- `bin/larv_review/reviewer_header.py` -- `bin/larv_review/test_larv_review.py` -- `skills/larv-review/SKILL.md`: `### Principles` (small) -- `README.md`: `## Install` (small) - ### 409. Split an epic item that changes several repos into one Jira sub-task per repo, each labelled for its repo, with the parent tracking the whole change, when do-epic plans the item. do-epic predicts the repos from the code, as `Touches:` predictions are made. A person's issue is split too, with a comment for the team in the epic's language (`docs/decisions.md` → `do-epic: drives one Jira epic …`). The parent is finished once every sub-task is. @@ -279,22 +244,6 @@ Touches: - `bin/do-epic-e2e` - `bin/do_epic/e2e/` -### 430. Hold tests on a shared environment to five rules in the principles' "Tests and tooling": assert only on named records, touch only owned state, survive any order and a concurrent copy, register teardown before creating, and check what a save stored. - -A test that runs against a shared environment, such as a staging database or a shared queue, meets other runs' data. Add to the "Tests and tooling" bullet under "Compose, do not entangle": - -- Assert only on records the test created and can name, never on a count or on the first row. -- Never change state the test doesn't own. -- Pass in any order, and beside a second copy of itself running at the same time. -- A test helper registers its teardown before it creates anything, keyed by a value the helper made itself, and the teardown deletes only what it can name. -- A helper that saves checks what was saved, never the status code alone. - -Give one BANNED/GOOD pair for each. These come from a client team's conventions and one of its reviews; state them in our own words, naming neither. - -Touches: -- `principles/technical-principles.md`: `Compose, do not entangle`, `Most, if not all, code should have automated tests, and each test earns its keep.` -- `agents/stability-reviewer.md`: `### 11. Tests` (small) - ### 421. Refuse in rule-hook a Bash or Monitor wait that has no end: a loop without a time or count cap, and a `pgrep -f` or `pkill -f` whose pattern the same command line contains. On 2026-11-18 a worker in the item 402 chunk started `until [ -s /tmp/merge-402.log ] && ! pgrep -f "chunk-pr merg"; do sleep 15; done` in the background. The `pgrep -f` pattern is part of the loop's own command line, so it matched itself and the loop never ended; the worker's `claude -p` waited on it for 95 minutes and its slot started no new chunk (item 420 ends such a worker; item 422 handles other stuck windows). A wait that cannot end is cheaper to refuse before it starts. @@ -312,33 +261,6 @@ Touches: - `bin/rule_hook/test_rule_hook.py`: `CommandBreaches` (small) - `settings.json` -### 432. Have stability-reviewer check, for a change that stores a value differently, that its longest value fits the column and that every search on the column still finds what users type. - -A change that escapes, converts or grows a stored value: the longest value it can now write must fit the column, and every search, filter or comparison on the column must still find what users type. In a client's chunk, escaping text into a TEXT column lowered its overflow limit fivefold, and a LIKE search stopped matching apostrophes. Product-owner and the auto-reviewer caught it; stability didn't. - -It goes in stability-reviewer's "Data Integrity & Persistence" checks, beside the one on a new column, since it is a check a reviewer runs on a change, not a design rule, and the agent is shared by every project. - -Touches: -- `agents/stability-reviewer.md`: `### 7. Data Integrity & Persistence` (small) - -### 436. Add the principle "Never mock a service your own team runs": test its seam against the real build, and mock only a third party that can't be run locally. - -Today the principles say to mock only slow, nondeterministic or external edges, which leaves room to mock a service the team itself runs; such a mock drifts from the real service unseen. Add: test the seam to a service your team runs against its real build, in a harness that runs the real stack. Mock only a third party that can't be run locally in a reasonable way. - -Recommended scope: the rule binds the test that covers the seam. A unit test of the caller's own logic may still use a fake, as "Use real collaborators or fakes" allows, so the lowest-level rule still holds. - -Touches: -- `principles/technical-principles.md`: `Most, if not all, code should have automated tests, and each test earns its keep.` (small) - -### 434. File a plan item to add the language's mutation tool, pinned to a version that supports the project's language version, when `mutate-changes` reports changed files no tool covers. - -`mutate-changes` prints a line naming the changed files in a language no tool covers. Today that line goes to the stability reviewer, which then hunts mutants by hand. In a client's PHP chunk without Infection, three findings were surviving mutants a tool would have reported before review. - -On that line, larv-review §2 files a plan item, or refreshes the one an earlier chunk filed, to add the language's mutation tool to the project, with a pinned version that supports the project's language version. In a plan kept in Jira that is a ticket for the team. - -Touches: -- `skills/larv-review/SKILL.md`: `## 2. Ship the branch` (small) - ### 316. Launch comprehension seats as an agent type of their own under `agents/`, without `CLAUDE.md` and the skill and agent listings a general-purpose subagent carries. Seats run as general-purpose subagents, so each starts with the skill and agent listings, about 7,500 tokens, at $9.00 per 1,000 prefix tokens over the archive measured from 2026-09-30 to 2026-11-11: about 1.3% of spend. An agent under `agents/` with Read, Grep, Glob and Bash, `omitClaudeMd: true`, and the seat's persona in its prompt drops both; a seat reads the project as a newcomer does, which is what it simulates. Keep each seat's prompt from `skills/comprehension-panel/seat-prompts.md`. Check that a scoring run's scores on one head stay within the spread two runs of today's seats show. lilleman approved on 2026-11-11. @@ -354,22 +276,32 @@ Touches: - `bin/rule_hook/test_rule_hook.py`: `ReviewerRung` - `bin/larv_review/test_scoring_setup.py` -### 431. Give "Make invalid states unrepresentable" an example about a function's inputs, and the rule to change a signature once review finds a second edge case in a check. +### 429. Bring nine lessons from a client setup into the principles, the reviewers, larv-review and the project config, and rank a deterministic tool first where an outside reviewer's finding changes the setup. -The principle's only example is a database time type, so in a client's chunk neither the implementer nor the reviewers connected it to a test helper that validated its own caller's input, over four review rounds. Add: +Lessons from running this setup in a client's repo, shipped as one chunk. Each part names the gap it closes; none names the client, its code or its reviewers' text. -- BANNED: a helper that takes a token and a message, and checks that the message holds the token. GOOD: the helper makes the token and builds the message. -- "When a review finds a second edge case in a check, change the signature so the input can't occur." +1. **Open the pull request after our own review, where CI runs on pushed branches.** Today larv-review §2 opens a draft first. A forge's auto-reviewer reviews drafts and human reviewers see them, so in a client's chunk about six outside findings landed that our passes would have caught. Nothing in larv-review needs a pull request before the gate: `reviewer-header` prints `PR: none open at the pushed head`, and round counts read commit titles. Push early so CI runs; run `chunk-pr open` once every §3 pass is done and §2's tests, static analysis and mutation tests pass; mark it ready at once. Where CI runs only on pull requests, keep the draft-first order. Decide which from the repo's CI config, and say in the summary which order the chunk took. +2. **Rules for tests on a shared environment**, in the "Tests and tooling" bullet under "Compose, do not entangle", one BANNED/GOOD pair each: assert only on records the test created and can name, never on a count or the first row; never change state the test doesn't own; pass in any order and beside a second copy of itself running at the same time; a helper registers its teardown before it creates anything, keyed by a value it made itself, and the teardown deletes only what it can name; a helper that saves checks what was saved, never the status code alone. +3. **"Make invalid states unrepresentable" gets an example about function inputs.** Its only example is a database time type, so in a client's chunk nobody connected it to a test helper that validated its caller's input, over four review rounds. BANNED: a helper that takes a token and a message, and checks that the message holds the token. GOOD: the helper makes the token and builds the message. Add: "When a review finds a second edge case in a check, change the signature so the input can't occur." +4. **stability-reviewer checks a change that stores a value differently**, in "Data Integrity & Persistence": where a change escapes, converts or grows a stored value, the longest value it can now write must fit the column, and every search, filter or comparison on the column must still find what users type. In a client's chunk, escaping text into a TEXT column lowered its overflow limit fivefold, and a LIKE search stopped matching apostrophes; stability missed both. +5. **A `conventions` setting in the project config**: an optional list of paths, in the other settings' path syntax, such as `checkout:CONVENTIONS.md`. `reviewer-header` prints them, every reviewer reads them beside the principles and standards, and the team's rule wins where they conflict. A missing file fails as an empty principles folder does. Today a team's conventions reach reviewers only by hand. +6. **larv-review §2 files an item to add a mutation tool** when `mutate-changes` prints its line naming changed files no tool covers, or refreshes the item an earlier chunk filed: the language's mutation tool, pinned to a version that supports the project's language version. In a client's PHP repo without one, three findings were surviving mutants a tool would have reported before review. +7. **The principle "Never mock a service your own team runs."** Test the seam to it against its real build, in a harness that runs the real stack; mock only a third party that can't be run locally in a reasonable way. The rule binds the test that covers the seam: a unit test of the caller's own logic may still use a fake, as "Use real collaborators or fakes" allows. +8. **The principle "Don't loosen a type when refactoring"**, under "Validate data and build DTOs as early as possible.", with one BANNED/GOOD pair: a function that returned a concrete type keeps returning it when its implementation changes, never `object`, `array`, `mixed` or `any`; introduce a DTO or value object instead. +9. **Reflect on every outside reviewer's finding, deterministic tools first.** `CLAUDE.md` → "Change the setup for each reasonable fix an outside reviewer asked for on a PR" already asks why our review missed it, but ranks reviewer agents and larv-review with the hooks and tools, and covers only fixes. Make it cover every finding an outside reviewer raises, and rank the places: 1. a deterministic tool that would have caught it, such as a rule-hook rule, a gate check, a linter setting or `mutate-changes`; 2. the technical principles or review standards; 3. anything else: the reviewers' agents, `larv-review`'s text, or the project's own settings, principles folder or `AGENTS.md`. Touches: -- `principles/technical-principles.md`: `Make invalid states unrepresentable.` (small) - -### 438. Add the principle "Don't loosen a type when refactoring": a function keeps its concrete return type, and a DTO or value object replaces an `object`, `array`, `mixed` or `any`. - -A function that returned a concrete type keeps returning it when its implementation changes: never degrade it to `object`, `array`, `mixed` or `any`. Introduce a DTO or value object instead. From a client team's PHP conventions, but it holds in any typed language. Add it under "Validate data and build DTOs as early as possible.", with one BANNED/GOOD pair. - -Touches: -- `principles/technical-principles.md`: `Validate data and build DTOs as early as possible.` (small) +- `CLAUDE.md`: `## Working loop` (small) +- `skills/larv-review/SKILL.md`: `## 2. Ship the branch`, `## 4. Gate`, `### Principles` (small) +- `bin/chunk_pr/main.py`: `opened` (small) +- `bin/chunk_pr/test_chunk_pr.py` +- `principles/technical-principles.md`: `Compose, do not entangle`, `Make invalid states unrepresentable.`, `Validate data and build DTOs as early as possible.`, `Most, if not all, code should have automated tests, and each test earns its keep.` +- `agents/stability-reviewer.md`: `### 7. Data Integrity & Persistence` (small), `### 11. Tests` (small) +- `bin/project_config/settings.py`: `SETTINGS` +- `bin/project_config/test_project_config.py` +- `bin/larv_review/reviewer_header.py` +- `bin/larv_review/test_larv_review.py` +- `README.md`: `## Install` (small) ### 310. Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then. @@ -402,45 +334,6 @@ Touches: - `bin/agent_cycle/tmux.py`: `Listed`, `listed` - `README.md`: `## Tools` (small) -### 428. Split the technical principles into blocking rules and rules of thumb, map a breach of a rule of thumb to 🟡, and add "keep each pull request as small as its chunk allows" to that tier. - -Today every principle holds at blocking strength: a breach is a 🔴. A client team's principles keep a "Rules of thumb" tier whose breach is guidance. Add the tier as its own section of `principles/technical-principles.md`, and map a breach of a rule in it to 🟡 in `review-findings.md`. - -Its first rule: "Keep each pull request as small as its chunk allows: leave out every change none of the chunk's items needs." Not "as small as possible": the working loop bundles items that share a review into one chunk on purpose, since each review has a fixed cost, and a bare small-PR rule would contradict it. - -Touches: -- `principles/technical-principles.md`: `# Principles` -- `skills/larv-review/review-findings.md` -- `agents/principles-auditor.md` - -### 435. Count rounds, diff for review and find the pull request against a stacked branch's own base, in larv-review, rule-hook's round cap, mutate-changes and chunk-pr. - -For a branch based on another chunk's branch, round counts and the review diff are taken against the default branch, so they count the parent pull request's rounds too. In a client's chunk, rule-hook's round cap refused a real round commit, and `reviewer-header` reported "stability takes no more rounds". `chunk-pr open` and `ready` only find pull requests into the default branch. - -Take the pull request's base, from the forge or from a `--base ` option, everywhere a merge base or a commit range with the default branch is taken. The CLAUDE.md rule to branch off the default branch stays the default; a stack is the exception a team's workflow asks for. - -Touches: -- `bin/git_cli/git_repo.py`: `default_branch`, `default_ref`, `branch_titles` -- `bin/larv_review/main.py`: `with_default_branch` -- `bin/larv_review/reviewer_header.py` -- `bin/larv_review/owed.py` -- `bin/rule_hook/round_cap.py`: `earlier_titles` -- `bin/chunk_pr/main.py`: `default_branch`, `opened` -- `bin/mutate_changes/main.py`: `mutate` -- `bin/larv_review/test_larv_review.py` -- `bin/chunk_pr/test_chunk_pr.py` -- `bin/rule_hook/test_rule_hook.py` -- `skills/larv-review/SKILL.md`: `## 2. Ship the branch` (small) - -### 437. Add "Coverage doesn't fall" to the rules of thumb, as a 🟡 where a change deletes or skips tests of code it keeps, measured only where CI already reports coverage. - -A client team holds "Test coverage must not decline" as a principle. Ours says "Coverage is no target: it finds untested code, not weak tests", and the mutation rule already fails a changed line no test runs, since its mutants survive. What a coverage ratchet adds is a signal on unchanged code whose tests a change deleted or weakened. - -Recommendation: add it to item 428's rules-of-thumb tier as "Coverage doesn't fall", a 🟡 where a change deletes or skips tests of code it keeps; measure it only where the project's CI already reports coverage, and add no coverage tooling for it. Never a target, so the existing line stays. - -Touches: -- `principles/technical-principles.md`: `Every mutant of a changed line fails a test` (small) - ### 365. Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs. lilleman's call, 2026-11-12: 0.10.0 and 0.11.0 switch the history tools off for a plan outside the checkout, and 0.13.0 holds only their ports. In Jira a dropped item, which `Drop item` commit titles mark today, is an issue resolved by a resolution the config names. From 5371cec343e720c4b708cf96416b0b13f54a49c8 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:43:31 +0100 Subject: [PATCH 12/21] Sort the new test_env imports by their first binding --- bin/loop_claude/test_loop_claude.py | 2 +- bin/routing_figures/test_routing_figures.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index bb223bff..0b93fd86 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -18,8 +18,8 @@ import uuid sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from test_env import assert_not_root from routing_figures import archive, state +from test_env import assert_not_root from claude_code.output_limits import BASH_CEILING_CHARACTERS from routing_figures.calls import Call from loop_claude.project import checkout, model_choice, records diff --git a/bin/routing_figures/test_routing_figures.py b/bin/routing_figures/test_routing_figures.py index dad79153..61803e64 100644 --- a/bin/routing_figures/test_routing_figures.py +++ b/bin/routing_figures/test_routing_figures.py @@ -15,6 +15,7 @@ import unittest.mock sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from routing_figures import archive, state +from test_env import assert_not_root, isolated_env from project_config.templates import BARE, Titles from branch_chunks.cut import BranchChunk from routing_figures.calls import Call, calls, totals @@ -25,7 +26,6 @@ from routing_figures.state import due from claude_code.entries import entry_from from failure import Failure from git_cli import git_repo -from test_env import assert_not_root, isolated_env from plan.todo_table import Item from transcript_archive import outcomes, write from model_routing.ladder_file import read_ladder, SHIPPED From 1c2791f2ad3a0947e05ac8fa331c618f3ae81f80 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:43:47 +0100 Subject: [PATCH 13/21] Name the Working loop heading in item 429's citation --- todo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 0a4da490..98e56fb8 100644 --- a/todo.md +++ b/todo.md @@ -298,7 +298,7 @@ Lessons from running this setup in a client's repo, shipped as one chunk. Each p 6. **larv-review §2 files an item to add a mutation tool** when `mutate-changes` prints its line naming changed files no tool covers, or refreshes the item an earlier chunk filed: the language's mutation tool, pinned to a version that supports the project's language version. In a client's PHP repo without one, three findings were surviving mutants a tool would have reported before review. 7. **The principle "Never mock a service your own team runs."** Test the seam to it against its real build, in a harness that runs the real stack; mock only a third party that can't be run locally in a reasonable way. The rule binds the test that covers the seam: a unit test of the caller's own logic may still use a fake, as "Use real collaborators or fakes" allows. 8. **The principle "Don't loosen a type when refactoring"**, under "Validate data and build DTOs as early as possible.", with one BANNED/GOOD pair: a function that returned a concrete type keeps returning it when its implementation changes, never `object`, `array`, `mixed` or `any`; introduce a DTO or value object instead. -9. **Reflect on every outside reviewer's finding, deterministic tools first.** `CLAUDE.md` → "Change the setup for each reasonable fix an outside reviewer asked for on a PR" already asks why our review missed it, but ranks reviewer agents and larv-review with the hooks and tools, and covers only fixes. Make it cover every finding an outside reviewer raises, and rank the places: 1. a deterministic tool that would have caught it, such as a rule-hook rule, a gate check, a linter setting or `mutate-changes`; 2. the technical principles or review standards; 3. anything else: the reviewers' agents, `larv-review`'s text, or the project's own settings, principles folder or `AGENTS.md`. +9. **Reflect on every outside reviewer's finding, deterministic tools first.** `CLAUDE.md` → "Working loop" → "Change the setup for each reasonable fix an outside reviewer asked for on a PR" already asks why our review missed it, but ranks reviewer agents and larv-review with the hooks and tools, and covers only fixes. Make it cover every finding an outside reviewer raises, and rank the places: 1. a deterministic tool that would have caught it, such as a rule-hook rule, a gate check, a linter setting or `mutate-changes`; 2. the technical principles or review standards; 3. anything else: the reviewers' agents, `larv-review`'s text, or the project's own settings, principles folder or `AGENTS.md`. Touches: - `CLAUDE.md`: `## Working loop` (small) From 59c319ebb44d3dafc1bd7eba6482946bf59ca3d0 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 17:45:02 +0100 Subject: [PATCH 14/21] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From aa62b081fb686466b8fac44805862e2e188507ae Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 18:05:39 +0100 Subject: [PATCH 15/21] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20run=20CI's?= =?UTF-8?q?=20image=20untagged=20and=20state=20where=20the=20socket=20must?= =?UTF-8?q?=20be?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- bin/run_heavy/test_run_heavy.py | 2 +- bin/run_tests/test_run_tests.py | 4 ++-- bin/test_env.py | 4 ++-- ci.sh | 12 ++++++------ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index bec11763..c23cfa32 100644 --- a/README.md +++ b/README.md @@ -240,9 +240,9 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a ## Test -Test on the host with `bin/run-tests`, which runs pytest through `uvx`, pinned in `bin/run_tests/main.py`. It prints each failing test with its error and pytest's summary line, and saves the whole output to a file whose path it prints. It passes on any test paths or pytest options it is given, such as `bin/run-tests bin/chunk_pr -x`. It needs `uv` on `PATH`, which fetches pytest, pytest-xdist and mypy. pytest-xdist runs the tests in one worker per CPU of a heavy slot (`docs/decisions.md` → `bin/: the tools support only the latest stable Python, …`). `python3 -m unittest discover -s bin -p 'test_*.py'` runs the same tests one at a time. Test the bench's scripts with `python3 -m unittest discover -s workflow-bench -p 'test_*.py'`. +Test on the host with `bin/run-tests`, which runs pytest through `uvx`, pinned in `bin/run_tests/main.py`. It prints each failing test with its error and pytest's summary line, and saves the whole output to a file whose path it prints. It passes on any test paths or pytest options it is given, such as `bin/run-tests bin/chunk_pr -x`. It needs `uv` on `PATH`, which fetches pytest, pytest-xdist and mypy, a Docker daemon, Linux, and a user other than root; a test that lacks one fails, naming it. pytest-xdist runs the tests in one worker per CPU of a heavy slot (`docs/decisions.md` → `bin/: the tools support only the latest stable Python, …`). `python3 -m unittest discover -s bin -p 'test_*.py'` runs the same tests one at a time, with the same needs. Test the bench's scripts with `python3 -m unittest discover -s workflow-bench -p 'test_*.py'`. -CI runs `ci.sh` on every pull request, and `main` doesn't merge anything until it passes. The script runs the same tests on the committed HEAD in a pinned Python container, which reaches the host's docker daemon for the tests that run the adf-codec shim; run it under `run-heavy` to reproduce a CI failure, with Docker on `PATH`. +CI runs `ci.sh` on every pull request, and `main` doesn't merge anything until it passes. The script runs the same tests on the committed HEAD in a pinned Python container. Run it under `run-heavy` to reproduce a CI failure, with Docker on `PATH` and its socket at `/var/run/docker.sock`, which the container shares. To mutation-test the lines a branch changes, run `~/.claude/bin/run-heavy ~/.claude/bin/mutate-changes --prefix 'uvx --python "$(command -v python3)" --with pytest==9.2.0 --from "mutmut>=3,<4"'` in its checkout. diff --git a/bin/run_heavy/test_run_heavy.py b/bin/run_heavy/test_run_heavy.py index af147f8d..c64b55b7 100644 --- a/bin/run_heavy/test_run_heavy.py +++ b/bin/run_heavy/test_run_heavy.py @@ -94,7 +94,7 @@ class RunHeavy(unittest.TestCase): def test_a_docker_run_without_limits_gets_three_quarters_of_the_memory_split_across_the_slots(self): memory = read_memory() - assert memory is not None, "this test reads the share from /proc/meminfo, which only Linux has" + assert memory is not None, "this test needs MemTotal and MemAvailable from /proc/meminfo: run it on Linux" share = f"{memory.total * 3 // 4 // slot_count(usable_cpus()) // 1024}m" result = self.run_tool("docker", "run", "--rm", "img", "true", env=self.fake_docker()) self.assertEqual((result.returncode, result.stdout), (0, f"run --memory {share} --memory-swap {share} --rm img true\n")) diff --git a/bin/run_tests/test_run_tests.py b/bin/run_tests/test_run_tests.py index 9e31a7e7..538385b1 100644 --- a/bin/run_tests/test_run_tests.py +++ b/bin/run_tests/test_run_tests.py @@ -13,7 +13,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from run_tests import main BIN = pathlib.Path(__file__).resolve().parents[1] -# The pytest and pytest-xdist run-tests pins, without its worker count, so the tests run them whether or not the interpreter running the tests has pytest. +# run-tests' own pytest command, without its worker count. uvx fetches pytest for it, so the Run tests need no pytest installed. PYTEST_PINNED = [*main.PYTEST[:main.PYTEST.index("-n")], "-p", "no:cacheprovider"] @@ -124,7 +124,7 @@ class Run(unittest.TestCase): with tempfile.TemporaryDirectory() as folder: pathlib.Path(folder, "test_ok.py").write_text("def test_ok():\n\tprint('noise from a passing test')\n") code, output = self.run_in(folder, PYTEST_PINNED, "-s", folder) - self.assertEqual(code, 0) + self.assertEqual(code, 0, output) lines = output.rstrip("\n").splitlines() self.assertEqual(len(lines), 2, output) self.assertRegex(lines[0], r"^=+ 1 passed in .* =+$") diff --git a/bin/test_env.py b/bin/test_env.py index ab231493..09106e0d 100644 --- a/bin/test_env.py +++ b/bin/test_env.py @@ -8,6 +8,6 @@ def isolated_env() -> dict[str, str]: return {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "LOOP_CLAUDE_", "PYTHON")) and name != "CLAUDE_CODE_SANDBOXED"} -# Root ignores file permissions, so a test that makes a file unreadable or a folder read-only needs another user. +# Call it first in a test that takes a file's or a folder's permissions away. def assert_not_root(test: unittest.TestCase) -> None: - test.assertNotEqual(os.geteuid(), 0, "this test needs file permissions to bind it, which they don't for root: run the tests as another user") + test.assertNotEqual(os.geteuid(), 0, "root ignores file permissions, which this test checks: run the tests as a user other than root") diff --git a/ci.sh b/ci.sh index d5d44325..1551c2bc 100755 --- a/ci.sh +++ b/ci.sh @@ -1,14 +1,14 @@ #!/bin/sh -# Runs the test suite on the committed HEAD as CI does: in a pinned Python container, as the caller's uid, so the tests that need file permissions to bind them run. +# Runs the test suite on the committed HEAD as CI does: in a pinned Python container, as the caller's uid, since root ignores file permissions and the tests that check them would fail. # It is sh, not Python, since it runs on the CI runner's host, which needs only git and docker. -# The repo goes in as a git bundle rather than a bind mount, so the script works whether the CI runner shares the docker daemon's filesystem or not. -# The adf-codec tests run their shim's container, so the test container holds a docker client and reaches the daemon through its socket, which the daemon mounts from its own host. +# The repo goes in as a git bundle rather than a bind mount, so the runner need not share the docker daemon's filesystem. +# The adf-codec tests, which convert Jira descriptions, start a container of their own. So the test container holds a docker client and the daemon's socket. +# The daemon mounts the socket from its own host, while stat reads its group on the runner: both need it at /var/run/docker.sock. set -eu cd "$(dirname "$0")" socket=/var/run/docker.sock -image="claude-config-ci:$$" -printf 'FROM docker:29.1.3-cli AS docker\nFROM python:3.14.8\nCOPY --from=docker /usr/local/bin/docker /usr/local/bin/docker\n' | docker build --quiet --memory 1g --memory-swap 1g --tag "$image" - >/dev/null -trap 'docker image rm "$image" >/dev/null' EXIT +# An untagged image, which docker image prune removes, since a cancelled run skips any cleanup. +image=$(printf 'FROM docker:29.1.3-cli AS docker\nFROM python:3.14.8\nCOPY --from=docker /usr/local/bin/docker /usr/local/bin/docker\n' | docker build --quiet --memory 1g --memory-swap 1g -) git bundle create - HEAD | docker run --rm -i --memory 4g --memory-swap 4g --user "$(id -u):$(id -g)" --group-add "$(stat -c %g "$socket")" -v "$socket:$socket" -e HOME=/tmp "$image" sh -euc ' cat >/tmp/head.bundle git -c init.defaultBranch=main -c advice.detachedHead=false clone --quiet /tmp/head.bundle /tmp/repo From 662f281d9965313e0d9ec9a84f254d00aec2fb83 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 18:05:45 +0100 Subject: [PATCH 16/21] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20name=20t?= =?UTF-8?q?he=20suite's=20needs=20in=20README=20and=20print=20run-tests'?= =?UTF-8?q?=20output=20on=20a=20failed=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From bb7d9b86ab1696d060b25a7301599d2d0e506978 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 18:05:45 +0100 Subject: [PATCH 17/21] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=206=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20root=20and=20meminfo=20messages,=20the=20pinned-pytest=20co?= =?UTF-8?q?mment=20and=20ci.sh's=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 90c7a2edbbb2784051c7323115aa79861d9e40a8 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 18:22:42 +0100 Subject: [PATCH 18/21] Finish item 428 in the plan --- todo.md | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/todo.md b/todo.md index 98e56fb8..1d48eaca 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 428 | 0.12.0 | | principle | **Make each test that skips at run time create the state it needs or fail naming what is missing, so no test in the repo skips at run time.** | 3 | 2 | 1 | 4 | 4 | code health by 3, 1.1 by 3 | 4.8 | | 426 | 0.12.0 | | | **Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 427 | 0.12.0 | 426 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | | 410 | 0.12.0 | 427 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | @@ -83,29 +82,6 @@ ## Details -### 428. Make each test that skips at run time create the state it needs or fail naming what is missing, so no test in the repo skips at run time. - -Follows item 400's bullet in `principles/technical-principles.md` → the tests principle: "A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing." Stability review found the repo's own tests break it in 13 places, each a skip decided at run time: - -- root-less permission checks, `skipIf(os.geteuid() == 0, ...)`: 3 in `bin/loop_claude/test_black_box.py`, 3 in `bin/loop_claude/test_loop_claude.py`, 1 in `bin/routing_figures/test_routing_figures.py`, 1 in `bin/plan_store/test_stores.py`; -- pytest: `skipUnless(HAS_PYTEST, ...)` on the class `Run` in `bin/run_tests/test_run_tests.py`; -- docker: the `docker info` skipif on 2 tests in `bin/adf_codec/test_adf_codec.py`, and `needs_docker` in `bin/plan/test_touches.py`; -- /proc: `self.skipTest("no /proc/meminfo ...")` in `bin/run_heavy/test_run_heavy.py`. - -The choice per case is the implementer's: for example, run the permission tests as a non-root user or drop the permission check in favour of an injected failure, take the docker or /proc state from an injected fake, or let the test fail naming what is missing. Done when a grep for `skipIf`, `skipUnless`, `skipTest` and `mark.skip` in the repo's tests finds none. - -Touches: - -- `bin/loop_claude/test_black_box.py`: `Cycles.test_exits_1_when_the_transcript_cannot_be_read`, `Interrupt.test_exits_1_when_the_transcript_cannot_be_read_after_the_interrupt`, `Models.test_exits_1_when_the_models_file_cannot_be_written` -- `bin/loop_claude/test_loop_claude.py`: `Cycles.test_stops_on_a_session_folder_it_cannot_read_whole`, `Cycles.test_stops_keeping_the_transcript_when_the_finished_chunks_session_cannot_be_deleted`, `RoutingCheck.test_says_a_figure_it_cannot_write_and_goes_on` -- `bin/routing_figures/test_routing_figures.py`: `Archive.test_fails_when_it_cannot_keep_the_state` (small) -- `bin/plan_store/test_stores.py`: `FilePlan.test_a_file_it_cannot_write_fails_naming_it` (small) -- `bin/run_tests/test_run_tests.py`: `HAS_PYTEST`, `Run` (small) -- `bin/adf_codec/test_adf_codec.py`: `test_round_trip_through_the_real_container`, `test_the_lossless_pair_gives_back_a_jira_description_identical_and_the_portable_pair_does_not` -- `bin/plan/test_touches.py`: `needs_docker`, `PredictedTest.test_a_list_written_in_markdown_and_read_back_from_a_jira_description_reads_as_written`, `PredictedTest.test_a_list_typed_in_jiras_editor_reads_as_its_files_and_parts` -- `bin/run_heavy/test_run_heavy.py`: `RunHeavy.test_a_docker_run_without_limits_gets_three_quarters_of_the_memory_split_across_the_slots` (small) -- `bin/machine_load/memory.py`: `read_memory` (small) - ### 426. Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends. Today `EpicIssue` holds none of the three, so do-epic cannot score or order an epic's items (item 408) or tell a person's issue from its own (item 427). The Jira backend reads them as `plan_store/jira_epic.py` does: the `plan-item` issue property, its `Filed by` key, and the "is blocked by" links. The contract tests in `contract.py` cover both backends. From e8255be53412e58681cb2f5206136bc3cdf3f540 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 18:32:38 +0100 Subject: [PATCH 19/21] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20score=20the?= =?UTF-8?q?=20person's=20issue=20in=20the=20contract=20test,=20and=20hold?= =?UTF-8?q?=20scores,=20moves=20and=20exempt=20apart=20from=20blockers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/do_epic/backend/contract.py | 16 ++++++++-------- bin/do_epic/backend/jira.py | 4 ++-- bin/do_epic/backend/protocol.py | 14 +++++++++----- bin/do_epic/backend/test_fake.py | 6 ++++-- bin/do_epic/backend/test_jira.py | 2 +- bin/plan_store/jira_epic.py | 2 +- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/bin/do_epic/backend/contract.py b/bin/do_epic/backend/contract.py index 11d38cef..c865bb0f 100644 --- a/bin/do_epic/backend/contract.py +++ b/bin/do_epic/backend/contract.py @@ -1,10 +1,9 @@ -"""What every backend of an epic's plan must hold, as tests. A backend's test case inherits EpicStoreContract and unittest.TestCase, and builds an epic with no issues in new_store. Its assign, close, person_files, score and block change the tracker as a person, or the plan store, would.""" +"""What every backend of an epic's plan must hold, as tests. A backend's test case inherits EpicStoreContract and unittest.TestCase, and builds an epic with no issues in new_store. Its assign, close, person_files, score and block change the tracker as a person or the plan store would.""" import re import typing from do_epic.backend.protocol import EpicIssue, EpicStore from failure import Failure -from plan.todo_table import ItemFields class EpicStoreContract: @@ -27,8 +26,8 @@ class EpicStoreContract: """Files a child issue of the epic as a person does in the tracker, not through the store, and answers its key.""" raise NotImplementedError - def score(self, store: EpicStore, key: str, scores: dict[str, str]) -> None: - """Sets the scores of the issue named key, as `plan_store` writes them: each column's name with its value as text, such as {"L": "2", "Moves": "1 by 5"}.""" + def score(self, store: EpicStore, key: str, scores: dict[str, object]) -> None: + """Sets the scores of the issue named key as `plan_store` writes them: each column's name with its value, a whole number for a score and text for Moves and Exempt, such as {"L": 2, "Moves": "1 by 5"}.""" raise NotImplementedError def block(self, store: EpicStore, key: str, blocker: str) -> None: @@ -125,15 +124,14 @@ class EpicStoreContract: store = self.new_store() key = self.filed(store, store.epic_key, "Count the runs.") [issue] = self.issues(store) - self.assertEqual((issue.key, issue.scores, issue.blockers), (key, ItemFields(), ())) + self.assertEqual((issue.key, issue.scores, issue.moves, issue.exempt, issue.blockers), (key, {}, (), "", ())) def test_reads_the_scores_a_person_or_the_plan_store_set(self) -> None: store = self.new_store() key = self.filed(store, store.epic_key, "Count the runs.") - self.score(store, key, {"L": "2", "E": "3", "I": "4", "S": "3", "Moves": "1 by 5", "Exempt": "security"}) + self.score(store, key, {"L": 2, "E": 3, "I": 4, "S": 3, "Moves": "1 by 5", "Exempt": "security"}) [issue] = self.issues(store) - self.assertEqual((issue.scores.scores, issue.scores.moves, issue.scores.exempt), ({"L": 2, "E": 3, "I": 4, "S": 3}, (("1", 5),), "security")) - self.assertEqual((issue.scores.release, issue.scores.blocked_by), (None, ())) + self.assertEqual((issue.scores, issue.moves, issue.exempt), ({"L": 2, "E": 3, "I": 4, "S": 3}, (("1", 5),), "security")) def test_reads_each_blocker_of_an_issue_and_none_for_a_blocker_of_another(self) -> None: store = self.new_store() @@ -147,6 +145,8 @@ class EpicStoreContract: store = self.new_store() ours = self.filed(store, store.epic_key, "Count the runs.") theirs = self.person_files(store, "A person's issue.") + # The plan store scores an issue a person filed without making it the loop's. + self.score(store, theirs, {"L": 2, "E": 3, "I": 4, "S": 3, "Moves": "1 by 5"}) task = self.filed(store, ours, "Count them in the api.") read = {issue.key: issue for issue in self.issues(store)} self.assertEqual([read[key].by_loop for key in (ours, theirs, task)], [True, False, True]) diff --git a/bin/do_epic/backend/jira.py b/bin/do_epic/backend/jira.py index 730f885f..d31f570b 100644 --- a/bin/do_epic/backend/jira.py +++ b/bin/do_epic/backend/jira.py @@ -60,7 +60,7 @@ class JiraEpic: if refused := unfit(summary, labels) or self.not_a_parent(parent, authorization): return refused fields: dict[str, typing.Any] = {"project": {"key": project_of(parent)}, "parent": {"key": parent}, "summary": summary, "labels": list(labels)} - # The mark that tells the loop's issues from a person's, as plan_store marks the items it files. + # Marks the issue as the loop's, as plan_store marks the items it files. properties = [{"key": PROPERTY, "value": {FILED_BY[0]: FILED_BY[1]}}] kind = {"name": ISSUE_TYPE} if parent == self.epic_key else self.sub_task_type(project_of(parent), authorization) if isinstance(kind, Failure): @@ -173,4 +173,4 @@ def found_of(raw: object) -> Found | Failure: read = scores(key, held) if isinstance(read, Failure): return read - return Found(EpicIssue(key, summary.strip(), "", tuple(sorted(labels)), name, state, done, parent, read, blockers, held.get(FILED_BY[0]) == FILED_BY[1]), description) + return Found(EpicIssue(key, summary.strip(), "", tuple(sorted(labels)), name, state, done, parent, read.scores, read.moves, read.exempt, blockers, held.get(FILED_BY[0]) == FILED_BY[1]), description) diff --git a/bin/do_epic/backend/protocol.py b/bin/do_epic/backend/protocol.py index 78b30cb6..3da13e8e 100644 --- a/bin/do_epic/backend/protocol.py +++ b/bin/do_epic/backend/protocol.py @@ -5,8 +5,8 @@ import dataclasses import re import typing +from plan.todo_table import Exempt, Moves from failure import Failure -from plan.todo_table import ItemFields # What a tracker accepts as a label: Jira refuses a label holding white space. LABEL = re.compile(r"\S+") @@ -29,11 +29,15 @@ class EpicIssue: done: bool # The epic's key for a child issue, the child's key for a sub-task. parent: str - # The scores, Moves and Exempt a plan-item issue property holds, as `plan_store` reads them; its release and blocked_by stay unset, since an epic's items have no release and `blockers` holds theirs. Empty where the issue holds none, as a person's issue does. - scores: ItemFields = dataclasses.field(default_factory=ItemFields) - # The key of each issue this one is blocked by, in the tracker's order. + # The score of each column the issue has one for, such as {"L": 2}, as `plan_store` reads them from the issue's `plan-item` property. Empty where the issue has no scores. + scores: dict[str, int] = dataclasses.field(default_factory=dict) + # The goals the issue moves, and how far (the plan's Moves cell); empty where it names none. + moves: Moves = () + # Why the issue is exempt from the plan's score bar, as the plan's Exempt cell names it; empty where it isn't. + exempt: Exempt = "" + # The key of each issue that blocks this one, in the tracker's order. blockers: tuple[str, ...] = () - # Whether the loop filed the issue, through EpicStore.file, rather than a person. + # True where the loop filed the issue through EpicStore.file; False for an issue a person filed. by_loop: bool = False diff --git a/bin/do_epic/backend/test_fake.py b/bin/do_epic/backend/test_fake.py index 40632ba8..24db7161 100644 --- a/bin/do_epic/backend/test_fake.py +++ b/bin/do_epic/backend/test_fake.py @@ -25,8 +25,10 @@ class MemoryEpicContract(EpicStoreContract, unittest.TestCase): store.change(key, by_loop=False) return key - def score(self, store: MemoryEpic, key: str, scores: dict[str, str]) -> None: # type: ignore[override] - store.change(key, scores=jira_epic.scores(key, scores)) + def score(self, store: MemoryEpic, key: str, scores: dict[str, object]) -> None: # type: ignore[override] + read = jira_epic.scores(key, scores) + assert not isinstance(read, Failure), read + store.change(key, scores=read.scores, moves=read.moves, exempt=read.exempt) def block(self, store: MemoryEpic, key: str, blocker: str) -> None: # type: ignore[override] store.change(key, blockers=(*next(issue for issue in store.issues if issue.key == key).blockers, blocker)) diff --git a/bin/do_epic/backend/test_jira.py b/bin/do_epic/backend/test_jira.py index 18ac3f23..015d5514 100644 --- a/bin/do_epic/backend/test_jira.py +++ b/bin/do_epic/backend/test_jira.py @@ -123,7 +123,7 @@ class JiraEpicContract(Case, EpicStoreContract): def person_files(self, store: JiraEpic, summary: str) -> str: # type: ignore[override] return self.jira.person_files(summary) - def score(self, store: JiraEpic, key: str, scores: dict[str, str]) -> None: # type: ignore[override] + def score(self, store: JiraEpic, key: str, scores: dict[str, object]) -> None: # type: ignore[override] held = next(issue for issue in self.jira.issues if issue["key"] == key).get("properties", {}).get("plan-item", {}) # type: ignore[attr-defined, union-attr] self.jira.set_property(key, held | scores) diff --git a/bin/plan_store/jira_epic.py b/bin/plan_store/jira_epic.py index 9ffa60ef..2bf47644 100644 --- a/bin/plan_store/jira_epic.py +++ b/bin/plan_store/jira_epic.py @@ -490,7 +490,7 @@ def issue_of(raw: object) -> Issue | Failure: def blocked_by_links(fields: dict[str, typing.Any]) -> tuple[Link, ...]: - """The "is blocked by" links among an issue's `issuelinks` field; a KeyError, TypeError or AttributeError where it isn't in the shape Jira documents.""" + """The "is blocked by" links among an issue's `issuelinks` field. A field not in the shape Jira documents raises a KeyError or TypeError, which the caller turns into a Failure.""" return tuple(Link(link["inwardIssue"]["key"], link["id"]) for link in fields["issuelinks"] if "inwardIssue" in link and link["type"]["inward"] == "is blocked by") From df1a4f9ca3e10a5c99b32ff42f2e2c50ae080a8d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 18:32:38 +0100 Subject: [PATCH 20/21] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20EpicIssue=20comments=20and=20the=20contract's=20score=20hoo?= =?UTF-8?q?k,=20in=20the=20stability=20round's=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 92bc84ba806a66f137f517d07b2ade4189ba08b3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 18:37:26 +0100 Subject: [PATCH 21/21] Finish item 426 in the plan --- CHANGELOG.md | 1 + todo.md | 15 +-------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 954f1364..4291972f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- do-epic's epic backends read each issue's scores, its blockers and whether the loop filed it, in the Jira backend and the in-memory one; the Jira backend marks each issue it files as the loop's. Nothing calls it yet. - The technical principles now forbid a test that decides at run time whether to check anything, by a conditional skip, early return or catch around its assertions, and stability-reviewer flags one. - do-epic's scorer orders an epic's items by score, then by Blocked by: an item's Moves names a goal as `epic 1.1`, `code health` or `repo 2`, and the epic's achieve goals outweigh the achieve goals of every repo. Nothing calls it yet. - `todo-item add` and `todo-item edit --detail` refuse a detail whose `Touches:` list touch-predictions cannot read, and `rank_todo.py --check` fails on each item holding one, so rule-hook refuses a commit of such a plan: after updating, run `~/.claude/bin/rank_todo.py --check` in each project and fix each list it names. diff --git a/todo.md b/todo.md index 1d48eaca..9fb303c1 100644 --- a/todo.md +++ b/todo.md @@ -12,8 +12,7 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 426 | 0.12.0 | | | **Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | -| 427 | 0.12.0 | 426 | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | +| 427 | 0.12.0 | | | **Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank.** | 3 | 2 | 3 | 6 | 3 | 1 by 5 | 1.9 | | 410 | 0.12.0 | 427 | | **Run `do-epic `: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 3 | 2 | 3 | 6 | 6 | 1 by 5 | 0.8 | | 416 | 0.12.0 | 410 | | **Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.** | 1 | 1 | 1 | 1 | 2 | 1 by 5 | 2.1 | | 413 | 0.12.0 | 410 | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | @@ -82,18 +81,6 @@ ## Details -### 426. Read each epic issue's scores, its blockers and whether the loop filed it through `EpicStore`, from both backends. - -Today `EpicIssue` holds none of the three, so do-epic cannot score or order an epic's items (item 408) or tell a person's issue from its own (item 427). The Jira backend reads them as `plan_store/jira_epic.py` does: the `plan-item` issue property, its `Filed by` key, and the "is blocked by" links. The contract tests in `contract.py` cover both backends. - -Touches: - -- `bin/do_epic/backend/protocol.py`: `EpicIssue` (small) -- `bin/do_epic/backend/fake.py` -- `bin/do_epic/backend/jira.py`: `FIELDS`, `JiraEpic.found` -- `bin/do_epic/backend/contract.py` -- `bin/do_epic/backend/test_jira.py` - ### 427. Re-rank Jira's backlog to match an epic's ranking, moving only the issues the loop filed, so people's issues keep their rank. Split from item 408 (`docs/decisions.md` → `do-epic: drives one Jira epic …`). `EpicStore` gains a rank call, in both backends and the contract tests. Lift `JiraPlan.rank_refusal` to a module function both stores call. Walk the target order: where the issue at a position isn't the target's, rank the target's just before it; the slots people's issues hold stay theirs. A rank Jira refuses stops the walk and is reported, since a wrongly ranked team backlog takes hours to restore.