From 31b8edb4c97bb10bbd9d5304949d70111350e16b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 09:51:12 +0100 Subject: [PATCH 1/8] Read do-epic's machine-wide settings and repo rule, and refuse to start while either is missing or misspelt --- bin/project_config/main.py | 2 ++ bin/project_config/settings.py | 38 ++++++++++++++++------- bin/project_config/test_project_config.py | 15 +++++++++ docs/reading-cost.md | 17 ++++++++++ 4 files changed, 61 insertions(+), 11 deletions(-) diff --git a/bin/project_config/main.py b/bin/project_config/main.py index 6b3e0120..02eeb8e0 100644 --- a/bin/project_config/main.py +++ b/bin/project_config/main.py @@ -128,6 +128,8 @@ Jira project's key before {id}, as here for the key ABC: The chunk for the issue ABC-123 is then on the branch ABC-123, in the worktree -ABC-123, and its commits and pull request are titled "ABC-123 - …". +`~/.claude-projects/do-epic/` holds do-epic's machine-wide settings, not a project's, so no project may use `do-epic` as its key and project-config reads nothing from that folder. + Exit 1, naming each fault on stderr, where no config names the checkout, or its config leaves out a setting, names an unknown one, misspells a path, a language or a template, sets `wait-for-approval` or `tooling-on-host` to anything but true or false, sets `notifier` to anything but mattermost or slack or diff --git a/bin/project_config/settings.py b/bin/project_config/settings.py index dca9390c..be902cd7 100644 --- a/bin/project_config/settings.py +++ b/bin/project_config/settings.py @@ -17,6 +17,10 @@ from plan.ranking import variables PROJECTS = ".claude-projects" CONFIG = "config.toml" +# The folder of do-epic's machine-wide settings, which names no checkout. No project may use it as its key. +DO_EPIC = "do-epic" +# A Jira Cloud or Confluence Cloud site's address: only https, so the credentials are never sent in the clear. +SITE = r"https://[A-Za-z0-9.-]+(?::[0-9]+)?" # Every path a project sets, by its role. Three readers, seated as the human who writes the config, picked the spelling from four candidates. They picked role names over file names, which a client's project doesn't share. SETTINGS = ("plan", "working-rules", "decisions", "score-anchors", "comprehension-history", "reading-cost", "changelog", "goals-and-audience", "principles", "standards") # They also picked a prefix over bare relative paths: each line says its own place, and a relative path with no prefix fails instead of landing somewhere by default. @@ -177,7 +181,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo top is the worktree that asks, and main itself outside a worktree. A `checkout:` path lands in top. A config that cannot be read fails every project, since it may be the one that names main.""" named: list[tuple[pathlib.Path, dict[str, object]]] = [] - for file in sorted((home / PROJECTS).glob(f"*/{CONFIG}")): + for file in configs(home): config = read(file, home) if isinstance(config, Failure): return config @@ -291,13 +295,13 @@ def name_of(value: object) -> str | None: def epic_of(value: object) -> Epic | None: """The epic a setting's value spells; None where it spells none. Only https, so the credentials are never sent in the clear.""" - spelt = isinstance(value, str) and re.fullmatch(rf"{JIRA}(https://[A-Za-z0-9.-]+(?::[0-9]+)?)/browse/([A-Z][A-Z0-9_]*-[0-9]+)", value) + spelt = isinstance(value, str) and re.fullmatch(rf"{JIRA}({SITE})/browse/([A-Z][A-Z0-9_]*-[0-9]+)", value) return Epic(spelt.group(1), spelt.group(2)) if spelt else None def page_of(value: object) -> Page | None: """The page a setting's value spells; None where it spells none. Only https, as for an epic.""" - spelt = isinstance(value, str) and re.fullmatch(rf"{CONFLUENCE}(https://[A-Za-z0-9.-]+(?::[0-9]+)?)/wiki/spaces/[^/?#]+/pages/([0-9]+)(?:/[^/?#]*)?", value) + spelt = isinstance(value, str) and re.fullmatch(rf"{CONFLUENCE}({SITE})/wiki/spaces/[^/?#]+/pages/([0-9]+)(?:/[^/?#]*)?", value) return Page(spelt.group(1), spelt.group(2), spelt.string) if spelt else None @@ -339,25 +343,37 @@ def lies_in(path: pathlib.Path, *places: pathlib.Path) -> bool: def held(folder: pathlib.Path, home: pathlib.Path) -> ProjectConfig | Failure | None: """The config in folder, read as its project's main checkout reads it; None where folder is not a config's folder under home.""" # Matched on resolved paths, as git names a folder, so a config's folder reached through a symlink is still found. - file = next((file for file in (home / PROJECTS).glob(f"*/{CONFIG}") if file.parent.resolve() == folder.resolve()), None) + file = next((file for file in configs(home) if file.parent.resolve() == folder.resolve()), None) if file is None: return None config = read(file, home) return config if isinstance(config, Failure) else load(config[0], config[0], home) +def configs(home: pathlib.Path) -> list[pathlib.Path]: + """Every project's config file under home, in key order. do-epic's is no project's.""" + return sorted(file for file in (home / PROJECTS).glob(f"*/{CONFIG}") if file.parent.name != DO_EPIC) + + def env_files(home: pathlib.Path) -> list[pathlib.Path]: - """Every config's env-file, read without the checks load makes, so a config that fails them still keeps its credentials guarded; a config that cannot be read names none.""" - configs = [read(file, home) for file in sorted((home / PROJECTS).glob(f"*/{CONFIG}"))] - return [path for config in configs if not isinstance(config, Failure) and (path := anywhere(config[1].get(ENV_FILE), home))] + """Every config's env-file, do-epic's included, read without the checks load makes, so a config that fails them still keeps its credentials guarded; a config that cannot be read names none.""" + values = [parsed(file) for file in (*configs(home), home / PROJECTS / DO_EPIC / CONFIG)] + return [path for found in values if not isinstance(found, Failure) and (path := anywhere(found.get(ENV_FILE), home))] + + +def parsed(file: pathlib.Path) -> dict[str, object] | Failure: + """The TOML values file holds.""" + try: + return tomllib.loads(file.read_text(encoding="utf-8")) + except (OSError, UnicodeDecodeError, tomllib.TOMLDecodeError) as failure: + return Failure(f"cannot read {file}: {failure}") def read(file: pathlib.Path, home: pathlib.Path) -> tuple[pathlib.Path, dict[str, object]] | Failure: """The checkout a config names, as an absolute path, and its other values.""" - try: - values = tomllib.loads(file.read_text(encoding="utf-8")) - except (OSError, UnicodeDecodeError, tomllib.TOMLDecodeError) as failure: - return Failure(f"cannot read {file}: {failure}") + values = parsed(file) + if isinstance(values, Failure): + return values checkout = anywhere(values.get("checkout"), home) if checkout is None: found = f"not {values['checkout']!r}" if "checkout" in values else "and is missing" diff --git a/bin/project_config/test_project_config.py b/bin/project_config/test_project_config.py index 7a07c131..a369e1da 100644 --- a/bin/project_config/test_project_config.py +++ b/bin/project_config/test_project_config.py @@ -91,6 +91,13 @@ class LoadTest(ConfigCase): self.assertEqual(found.paths["standards"], self.home / ".claude" / "skills" / "larv-review" / "standards") self.assertEqual(tuple(found.paths), SETTINGS) + def test_the_do_epic_folder_is_no_projects_config_so_it_needs_no_checkout(self) -> None: + self.write("do-epic", 'jira-url = "https://acme.atlassian.net"\n') + self.write("acme", CLIENT) + found = load(self.checkout, self.checkout, self.home) + assert isinstance(found, ProjectConfig), found + self.assertEqual(found.key, "acme") + def test_a_plan_spelt_as_a_jira_epic_is_no_path(self) -> None: self.write("acme", JIRA_CLIENT) found = load(self.checkout, self.checkout, self.home) @@ -578,6 +585,10 @@ class HeldTest(ConfigCase): (elsewhere / "config.toml").write_text(CLIENT, encoding="utf-8") self.assertIsNone(held(elsewhere, self.home), "a config.toml outside ~/.claude-projects/") + def test_the_do_epic_folder_holds_no_projects_config(self) -> None: + folder = self.write("do-epic", CLIENT) + self.assertIsNone(held(folder, self.home)) + def test_a_configs_folder_reached_through_a_symlink_holds_its_config(self) -> None: target = self.home / "kept" / "acme" target.mkdir(parents=True) @@ -595,6 +606,10 @@ class EnvFilesTest(ConfigCase): self.write("none", CLIENT) self.assertEqual(env_files(self.home), [self.home / "acme.env", pathlib.Path("/srv/other.env")]) + def test_lists_do_epics_env_file_though_its_config_names_no_checkout(self) -> None: + self.write("do-epic", 'env-file = "~/jira.env"\n') + self.assertEqual(env_files(self.home), [self.home / "jira.env"]) + class ToolTest(ConfigCase): def test_prints_a_jira_plan_as_the_config_spells_it(self) -> None: diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 62d3cdb1..731c705c 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2570,3 +2570,20 @@ Read most (opens and searches): - `bin/failure.py` 1 - `bin/markdown_section/test_markdown_section.py` 1 - `bin/run-tests` 1 + +## Reading cost, chunk 4655673a30a9, finished 2026-11-17T11:46:22Z + +111449 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/review_replay/test_review_replay.py` 6 +- `README.md` 2 +- `bin/review_replay/main.py` 2 +- `bin/review_replay/replay.py` 2 +- `docs/decisions.md` 2 +- `CHANGELOG.md` 1 +- `bin/review_replay/omit_comparison.py` 1 +- `bin/rung_replay/archive.py` 1 +- `bin/rung_replay/search.py` 1 +- `bin/rung_replay/test_rung_replay.py` 1 -- 2.52.0 From 4678ac6798d527d6d6424e15a869a73ed483beed Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 09:54:39 +0100 Subject: [PATCH 2/8] Name do-epic's env-file among the credentials rule-hook guards --- bin/rule_hook/env_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/rule_hook/env_file.py b/bin/rule_hook/env_file.py index 8e5ac1d4..377fdd17 100644 --- a/bin/rule_hook/env_file.py +++ b/bin/rule_hook/env_file.py @@ -1,6 +1,6 @@ """Whether a Read or a Grep reads a credentials file, or a Bash command names it or searches a folder holding it, for the `env-file-read` rule. -The files are `~/.claude/.env` and every config's `env-file`, not only the calling project's: a worker in one client's project must not read another client's credentials either, and listing every config's file needs no git call, as finding the calling project's would. +The files are `~/.claude/.env` and every config's `env-file`, do-epic's included, not only the calling project's: a worker in one client's project must not read another client's credentials either, and listing every config's file needs no git call, as finding the calling project's would. A Bash command names one where its text spells the file's path, or one of its words, a redirect's target included, leads to the file from the directory `cd` left the command in. Whether the command reads the file is not judged, so one that only mentions the path is refused too. It searches a folder holding one where `folder_search.searches` finds that an `ag`, `grep -r` or `rg` reaches the file. This guards against an agent reading the file in passing, not against one that hides the path, such as behind a glob, a variable of its own, `xargs` or `find -exec`.""" -- 2.52.0 From e2977b4946f6ee588ce4ff85a6b44e170bf80628 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 09:56:02 +0100 Subject: [PATCH 3/8] Track the do_epic package, which the gitignore allowlist left out --- .gitignore | 2 + bin/do_epic/__init__.py | 0 bin/do_epic/config.py | 72 ++++++++++++++++++++++++++++ bin/do_epic/test_do_epic.py | 93 +++++++++++++++++++++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 bin/do_epic/__init__.py create mode 100644 bin/do_epic/config.py create mode 100644 bin/do_epic/test_do_epic.py diff --git a/.gitignore b/.gitignore index 9f3ba4ff..b2090dbb 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,8 @@ !bin/deploy-release !bin/deploy_release/ !bin/deploy_release/*.py +!bin/do_epic/ +!bin/do_epic/*.py !bin/failure.py !bin/forge/ !bin/forge/*.py diff --git a/bin/do_epic/__init__.py b/bin/do_epic/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bin/do_epic/config.py b/bin/do_epic/config.py new file mode 100644 index 00000000..ad1d2f22 --- /dev/null +++ b/bin/do_epic/config.py @@ -0,0 +1,72 @@ +"""do-epic's machine-wide settings: `~/.claude-projects/do-epic/config.toml`, and `repo-rule.md` beside it. + +One pair per machine, the same for every epic (docs/decisions.md → `do-epic: drives one Jira epic …`). The config is TOML: + + jira-url = "https://acme.atlassian.net" + env-file = "~/.secrets/acme-jira.env" + repoless-model = "claude-opus-5-5" + clone-folder = "~/code" + language = "Swedish" + +`jira-url` is the Jira site's address, only https. `env-file` is the file of Jira credentials, a path that starts with / or ~/ and lies outside `~/.claude-projects` and the clone folder, so that no git remote receives them. `repoless-model` is the model that works an epic item with no repo. `clone-folder` is the folder a missing repo is cloned into; `~/code` where left out. `language` is the default language of Jira text, by its English name; English where left out. `repo-rule.md` is prose that says how to tell an item's repo.""" +import dataclasses +import pathlib +import re + +from failure import Failure +from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, language_fault, LANGUAGE, lies_in, parsed, PROJECTS, SITE + +REPO_RULE = "repo-rule.md" +# Three readers, seated as the human who writes this config, picked these spellings from four candidates each, 3-0: `jira-url` over `site`, `clone-folder` over `repos-folder` (which reads as the folder of repos that already exist) and `repoless-model` over `no-repo-model`. `env-file` and `language` keep the names a project's config gives them. +JIRA_URL = "jira-url" +REPOLESS_MODEL = "repoless-model" +CLONE_FOLDER = "clone-folder" +SETTINGS = (JIRA_URL, ENV_FILE, REPOLESS_MODEL) +OPTIONAL = (CLONE_FOLDER, LANGUAGE) +# A model id as Claude Code takes it, such as claude-opus-5-5 or claude-sonnet-4-5-20250929. +MODEL_ID = re.compile(r"claude-[a-z]+-[0-9]+(?:-[0-9]+)*") + + +@dataclasses.dataclass(frozen=True) +class DoEpicConfig: + """folder is `~/.claude-projects/do-epic`; repo_rule is `repo-rule.md`'s text.""" + folder: pathlib.Path + jira_url: str + env_file: pathlib.Path + clone_folder: pathlib.Path + language: str + repoless_model: str + repo_rule: str + + +def load(home: pathlib.Path) -> DoEpicConfig | Failure: + """The settings and the repo rule under home; a Failure naming each missing or misspelt one, so that do-epic refuses to start.""" + folder = home / PROJECTS / DO_EPIC + values = parsed(folder / CONFIG) + if isinstance(values, Failure): + return values + try: + rule = (folder / REPO_RULE).read_text(encoding="utf-8") + except (OSError, UnicodeDecodeError) as failure: + return Failure(f"cannot read {folder / REPO_RULE}: {failure}") + clone_folder = anywhere(values.get(CLONE_FOLDER, "~/code"), home) + env_file = anywhere(values.get(ENV_FILE), home) + language = values.get(LANGUAGE, "English") + url, model = values.get(JIRA_URL), values.get(REPOLESS_MODEL) + faults = [ + *(f"`{name}` is missing" for name in SETTINGS if name not in values), + *(f"`{name}` is not a setting" for name in values if name not in (*SETTINGS, *OPTIONAL)), + *([f"`{JIRA_URL}` is {url!r}, not a site's https address without a path, such as \"https://acme.atlassian.net\""] if JIRA_URL in values and not (isinstance(url, str) and re.fullmatch(SITE, url)) else []), + *([f"`{CLONE_FOLDER}` is {values[CLONE_FOLDER]!r}, not a path that starts with / or ~/"] if clone_folder is None else []), + *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not a path that starts with / or ~/"] if ENV_FILE in values and env_file is None else []), + # lies_in resolves both sides, so a symlink can't lead the file into a place it must stay out of. + *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, inside ~/{PROJECTS} or the clone folder, which a git remote may receive"] if env_file and lies_in(env_file, home / PROJECTS, *([clone_folder] if clone_folder else [])) else []), + *([f"`{LANGUAGE}` is {language!r}, {fault}"] if LANGUAGE in values and (fault := language_fault(language)) else []), + *([f"`{REPOLESS_MODEL}` is {model!r}, not a model id such as \"claude-opus-5-5\""] if REPOLESS_MODEL in values and not (isinstance(model, str) and MODEL_ID.fullmatch(model)) else []), + *([f"`{REPO_RULE}` is blank"] if not rule.strip() else []), + ] + if faults: + return Failure(f"{folder}: {'; '.join(faults)}. The settings are {', '.join(SETTINGS)}, and optionally {' and '.join(OPTIONAL)}.") + # faults names a missing or misspelt value of each type asserted here. + assert clone_folder and env_file and isinstance(url, str) and isinstance(model, str) and isinstance(language, str) + return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule) diff --git a/bin/do_epic/test_do_epic.py b/bin/do_epic/test_do_epic.py new file mode 100644 index 00000000..706a0f92 --- /dev/null +++ b/bin/do_epic/test_do_epic.py @@ -0,0 +1,93 @@ +import pathlib +import sys +import tempfile +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from do_epic.config import DoEpicConfig, load +from failure import Failure + +SETTINGS = """jira-url = "https://acme.atlassian.net" +env-file = "~/jira.env" +repoless-model = "claude-opus-5-5" +""" + + +class ConfigTest(unittest.TestCase): + def setUp(self) -> None: + made = tempfile.TemporaryDirectory() + self.addCleanup(made.cleanup) + self.home = pathlib.Path(made.name).resolve() + self.folder = self.home / ".claude-projects" / "do-epic" + self.folder.mkdir(parents=True) + + def write(self, settings: str | None = SETTINGS, rule: str | None = "A label that equals a repo's name names that repo.\n") -> None: + if settings is not None: + (self.folder / "config.toml").write_text(settings, encoding="utf-8") + if rule is not None: + (self.folder / "repo-rule.md").write_text(rule, encoding="utf-8") + + def failure(self) -> str: + found = load(self.home) + assert isinstance(found, Failure), found + return found.reason + + def test_reads_the_settings_and_the_rule_and_defaults_the_clone_folder_and_language(self) -> None: + self.write() + self.assertEqual(load(self.home), DoEpicConfig(self.folder, "https://acme.atlassian.net", self.home / "jira.env", self.home / "code", "English", "claude-opus-5-5", "A label that equals a repo's name names that repo.\n")) + + def test_reads_a_clone_folder_and_language_the_config_sets(self) -> None: + self.write(SETTINGS + 'clone-folder = "/srv/repos"\nlanguage = "Brazilian Portuguese"\n') + found = load(self.home) + assert isinstance(found, DoEpicConfig), found + self.assertEqual((found.clone_folder, found.language), (pathlib.Path("/srv/repos"), "Brazilian Portuguese")) + + def test_refuses_while_the_config_is_missing(self) -> None: + self.write(None) + self.assertIn(f"cannot read {self.folder / 'config.toml'}", self.failure()) + + def test_refuses_while_the_rule_is_missing_or_blank(self) -> None: + self.write(rule=None) + self.assertIn(f"cannot read {self.folder / 'repo-rule.md'}", self.failure()) + self.write(rule=" \n") + self.assertIn("`repo-rule.md` is blank", self.failure()) + + def test_names_each_missing_setting(self) -> None: + self.write("") + reason = self.failure() + for name in ("jira-url", "env-file", "repoless-model"): + self.assertIn(f"`{name}` is missing", reason) + + def test_names_a_setting_it_does_not_know(self) -> None: + self.write(SETTINGS + 'checkout = "~/code/acme"\n') + self.assertIn("`checkout` is not a setting", self.failure()) + + def test_names_each_misspelt_value(self) -> None: + for line, name in ( + ('jira-url = "http://acme.atlassian.net"', "jira-url"), + ('jira-url = "https://acme.atlassian.net/"', "jira-url"), + ('env-file = "jira.env"', "env-file"), + ('clone-folder = "code"', "clone-folder"), + ('language = "sv_SE"', "language"), + ('repoless-model = "opus"', "repoless-model"), + ): + with self.subTest(line): + self.write("\n".join([ln for ln in SETTINGS.splitlines() if not ln.startswith(name)] + [line])) + self.assertIn(f"`{name}` is", self.failure()) + + def test_keeps_the_credentials_outside_every_config_and_every_clone(self) -> None: + for env_file in ("~/.claude-projects/do-epic/jira.env", "~/.claude-projects/acme/jira.env"): + with self.subTest(env_file): + self.write(SETTINGS.replace("~/jira.env", env_file)) + self.assertIn("`env-file` is", self.failure()) + self.write(SETTINGS.replace("~/jira.env", "~/code/acme/jira.env")) + self.assertIn("`env-file` is", self.failure()) + self.write(SETTINGS.replace("~/jira.env", "~/clones/jira.env") + 'clone-folder = "~/clones"\n') + self.assertIn("`env-file` is", self.failure()) + + def test_reports_every_fault_at_once(self) -> None: + self.write('jira-url = "acme"\nrepoless-model = "x"\n') + reason = self.failure() + for part in ("`jira-url` is", "`env-file` is missing", "`repoless-model` is"): + self.assertIn(part, reason) -- 2.52.0 From b34d1087ca2cf30f2f6879cc39e66210872d5205 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 09:59:53 +0100 Subject: [PATCH 4/8] Sort do_epic/config.py's imports as the repo check requires --- bin/do_epic/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/do_epic/config.py b/bin/do_epic/config.py index ad1d2f22..8b223b3b 100644 --- a/bin/do_epic/config.py +++ b/bin/do_epic/config.py @@ -13,8 +13,8 @@ import dataclasses import pathlib import re +from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, LANGUAGE, language_fault, lies_in, parsed, PROJECTS, SITE from failure import Failure -from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, language_fault, LANGUAGE, lies_in, parsed, PROJECTS, SITE REPO_RULE = "repo-rule.md" # Three readers, seated as the human who writes this config, picked these spellings from four candidates each, 3-0: `jira-url` over `site`, `clone-folder` over `repos-folder` (which reads as the folder of repos that already exist) and `repoless-model` over `no-repo-model`. `env-file` and `language` keep the names a project's config gives them. -- 2.52.0 From b93d3799c319971bbf81bf7b0d32bc2f0838561f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 10:28:39 +0100 Subject: [PATCH 5/8] Answer round 1: check the model against the ladder, keep faults together, fix prose --- README.md | 1 + bin/do_epic/config.py | 35 +++++++++++++++++++++------------- bin/do_epic/test_do_epic.py | 12 +++++++++++- bin/project_config/main.py | 5 +++-- bin/project_config/settings.py | 12 ++++++------ 5 files changed, 43 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 430fa690..88e3255e 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes` and `routing_figures`. It imports `reading_cost`'s record path. - `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`. - `deploy_release` imports `release_plan`'s `release_standing`. +- `do_epic` imports `project_config`'s settings and `model_routing`'s ladder file. - `forge/` tells a GitHub origin from a Gitea one and runs that forge's CLI (`commands.py`), and finds a pull request and waits for its checks (`pulls.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release` and `larv_review`. - `git_cli/` runs git for every tool (`git_repo.py`), and reads the git calls in a shell command (`git_command.py`). - `judge_replay` imports `loop_claude`'s judge, verdicts, premises and records. diff --git a/bin/do_epic/config.py b/bin/do_epic/config.py index 8b223b3b..c38fba90 100644 --- a/bin/do_epic/config.py +++ b/bin/do_epic/config.py @@ -8,13 +8,19 @@ One pair per machine, the same for every epic (docs/decisions.md → `do-epic: d clone-folder = "~/code" language = "Swedish" -`jira-url` is the Jira site's address, only https. `env-file` is the file of Jira credentials, a path that starts with / or ~/ and lies outside `~/.claude-projects` and the clone folder, so that no git remote receives them. `repoless-model` is the model that works an epic item with no repo. `clone-folder` is the folder a missing repo is cloned into; `~/code` where left out. `language` is the default language of Jira text, by its English name; English where left out. `repo-rule.md` is prose that says how to tell an item's repo.""" +- `jira-url` is the Jira site's address: https, a host, and no path. +- `env-file` is the file of Jira credentials: a path that starts with / or ~/, outside `~/.claude-projects` and the clone folder, which are git checkouts or hold them. +- `repoless-model` is the model that works an epic item with no repo: a model on the routing ladder, `model_routing/routing-ladder.json`. +- `clone-folder` is the folder a missing repo is cloned into: a path that starts with / or ~/. `~/code` where left out. +- `language` is the default language of Jira text, by its English name. English where left out. +- `repo-rule.md` is prose that says how to tell an item's repo, and mustn't be blank.""" import dataclasses import pathlib import re from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, LANGUAGE, language_fault, lies_in, parsed, PROJECTS, SITE from failure import Failure +from model_routing.ladder_file import read_ladder, SHIPPED REPO_RULE = "repo-rule.md" # Three readers, seated as the human who writes this config, picked these spellings from four candidates each, 3-0: `jira-url` over `site`, `clone-folder` over `repos-folder` (which reads as the folder of repos that already exist) and `repoless-model` over `no-repo-model`. `env-file` and `language` keep the names a project's config gives them. @@ -23,8 +29,7 @@ REPOLESS_MODEL = "repoless-model" CLONE_FOLDER = "clone-folder" SETTINGS = (JIRA_URL, ENV_FILE, REPOLESS_MODEL) OPTIONAL = (CLONE_FOLDER, LANGUAGE) -# A model id as Claude Code takes it, such as claude-opus-5-5 or claude-sonnet-4-5-20250929. -MODEL_ID = re.compile(r"claude-[a-z]+-[0-9]+(?:-[0-9]+)*") +LISTED = f"The settings are {', '.join(SETTINGS)}, and optionally {' and '.join(OPTIONAL)}." @dataclasses.dataclass(frozen=True) @@ -39,16 +44,21 @@ class DoEpicConfig: repo_rule: str -def load(home: pathlib.Path) -> DoEpicConfig | Failure: - """The settings and the repo rule under home; a Failure naming each missing or misspelt one, so that do-epic refuses to start.""" +def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfig | Failure: + """The settings and the repo rule under home; a Failure naming each missing or misspelt one it finds, so that do-epic refuses to start.""" folder = home / PROJECTS / DO_EPIC values = parsed(folder / CONFIG) if isinstance(values, Failure): - return values + return Failure(f"{values.reason}. {LISTED}") + ladder = read_ladder(ladder_file) + if isinstance(ladder, Failure): + return ladder + models = sorted({rung.model for rung in ladder.rungs}) try: rule = (folder / REPO_RULE).read_text(encoding="utf-8") + unread = None except (OSError, UnicodeDecodeError) as failure: - return Failure(f"cannot read {folder / REPO_RULE}: {failure}") + rule, unread = "", f"cannot read {folder / REPO_RULE}: {failure}" clone_folder = anywhere(values.get(CLONE_FOLDER, "~/code"), home) env_file = anywhere(values.get(ENV_FILE), home) language = values.get(LANGUAGE, "English") @@ -59,14 +69,13 @@ def load(home: pathlib.Path) -> DoEpicConfig | Failure: *([f"`{JIRA_URL}` is {url!r}, not a site's https address without a path, such as \"https://acme.atlassian.net\""] if JIRA_URL in values and not (isinstance(url, str) and re.fullmatch(SITE, url)) else []), *([f"`{CLONE_FOLDER}` is {values[CLONE_FOLDER]!r}, not a path that starts with / or ~/"] if clone_folder is None else []), *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not a path that starts with / or ~/"] if ENV_FILE in values and env_file is None else []), - # lies_in resolves both sides, so a symlink can't lead the file into a place it must stay out of. - *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, inside ~/{PROJECTS} or the clone folder, which a git remote may receive"] if env_file and lies_in(env_file, home / PROJECTS, *([clone_folder] if clone_folder else [])) else []), + *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, inside ~/{PROJECTS} or the clone folder, which hold git checkouts"] if env_file and lies_in(env_file, home / PROJECTS, *([clone_folder] if clone_folder else [])) else []), *([f"`{LANGUAGE}` is {language!r}, {fault}"] if LANGUAGE in values and (fault := language_fault(language)) else []), - *([f"`{REPOLESS_MODEL}` is {model!r}, not a model id such as \"claude-opus-5-5\""] if REPOLESS_MODEL in values and not (isinstance(model, str) and MODEL_ID.fullmatch(model)) else []), - *([f"`{REPO_RULE}` is blank"] if not rule.strip() else []), + *([f"`{REPOLESS_MODEL}` is {model!r}, not a model on the routing ladder: {', '.join(models)}"] if REPOLESS_MODEL in values and model not in models else []), + *([unread] if unread else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []), ] if faults: - return Failure(f"{folder}: {'; '.join(faults)}. The settings are {', '.join(SETTINGS)}, and optionally {' and '.join(OPTIONAL)}.") - # faults names a missing or misspelt value of each type asserted here. + return Failure(f"{folder}: {'; '.join(faults)}. {LISTED}") + # Without a fault, each value above is present and of the type asserted here. assert clone_folder and env_file and isinstance(url, str) and isinstance(model, str) and isinstance(language, str) return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule) diff --git a/bin/do_epic/test_do_epic.py b/bin/do_epic/test_do_epic.py index 706a0f92..2f87a1d7 100644 --- a/bin/do_epic/test_do_epic.py +++ b/bin/do_epic/test_do_epic.py @@ -43,13 +43,16 @@ class ConfigTest(unittest.TestCase): assert isinstance(found, DoEpicConfig), found self.assertEqual((found.clone_folder, found.language), (pathlib.Path("/srv/repos"), "Brazilian Portuguese")) - def test_refuses_while_the_config_is_missing(self) -> None: + def test_refuses_while_the_config_is_missing_and_lists_the_settings(self) -> None: self.write(None) self.assertIn(f"cannot read {self.folder / 'config.toml'}", self.failure()) + self.assertIn("The settings are jira-url, env-file, repoless-model", self.failure()) def test_refuses_while_the_rule_is_missing_or_blank(self) -> None: self.write(rule=None) self.assertIn(f"cannot read {self.folder / 'repo-rule.md'}", self.failure()) + self.write(SETTINGS.replace("claude-opus-5-5", "x"), rule=None) + self.assertIn("`repoless-model` is 'x'", self.failure(), "a missing rule doesn't hide the settings' faults") self.write(rule=" \n") self.assertIn("`repo-rule.md` is blank", self.failure()) @@ -71,6 +74,7 @@ class ConfigTest(unittest.TestCase): ('clone-folder = "code"', "clone-folder"), ('language = "sv_SE"', "language"), ('repoless-model = "opus"', "repoless-model"), + ('repoless-model = "claude-opsu-5-5"', "repoless-model"), ): with self.subTest(line): self.write("\n".join([ln for ln in SETTINGS.splitlines() if not ln.startswith(name)] + [line])) @@ -86,6 +90,12 @@ class ConfigTest(unittest.TestCase): self.write(SETTINGS.replace("~/jira.env", "~/clones/jira.env") + 'clone-folder = "~/clones"\n') self.assertIn("`env-file` is", self.failure()) + def test_refuses_while_the_routing_ladder_cannot_be_read(self) -> None: + self.write() + found = load(self.home, self.home / "no-ladder.json") + assert isinstance(found, Failure), found + self.assertIn("no-ladder.json", found.reason) + def test_reports_every_fault_at_once(self) -> None: self.write('jira-url = "acme"\nrepoless-model = "x"\n') reason = self.failure() diff --git a/bin/project_config/main.py b/bin/project_config/main.py index 02eeb8e0..a7b824bf 100644 --- a/bin/project_config/main.py +++ b/bin/project_config/main.py @@ -6,6 +6,9 @@ Run inside a checkout, or a worktree of one. It finds the config that names the ~/.claude-projects//config.toml, and prints each setting and its absolute path, as in `plan: /home/me/code/acme/todo.md`. Given a setting, it prints only that setting's path. +`~/.claude-projects/do-epic/` holds do-epic's machine-wide settings, not a project's. It needs no `checkout`, +and project-config doesn't read anything from it, so no project may use `do-epic` as its key. + The config is TOML. `checkout` names the project's main checkout, and every setting in the example below is a path: "checkout:" inside the checkout, "folder:" inside the config's own folder, or one that starts with / or ~/. In a worktree, a "checkout:" path is the worktree's own file. @@ -128,8 +131,6 @@ Jira project's key before {id}, as here for the key ABC: The chunk for the issue ABC-123 is then on the branch ABC-123, in the worktree -ABC-123, and its commits and pull request are titled "ABC-123 - …". -`~/.claude-projects/do-epic/` holds do-epic's machine-wide settings, not a project's, so no project may use `do-epic` as its key and project-config reads nothing from that folder. - Exit 1, naming each fault on stderr, where no config names the checkout, or its config leaves out a setting, names an unknown one, misspells a path, a language or a template, sets `wait-for-approval` or `tooling-on-host` to anything but true or false, sets `notifier` to anything but mattermost or slack or diff --git a/bin/project_config/settings.py b/bin/project_config/settings.py index be902cd7..c72c7174 100644 --- a/bin/project_config/settings.py +++ b/bin/project_config/settings.py @@ -17,7 +17,7 @@ from plan.ranking import variables PROJECTS = ".claude-projects" CONFIG = "config.toml" -# The folder of do-epic's machine-wide settings, which names no checkout. No project may use it as its key. +# The key of do-epic's machine-wide settings: the folder's config.toml has no `checkout`, so no project may use the key. DO_EPIC = "do-epic" # A Jira Cloud or Confluence Cloud site's address: only https, so the credentials are never sent in the clear. SITE = r"https://[A-Za-z0-9.-]+(?::[0-9]+)?" @@ -294,13 +294,13 @@ def name_of(value: object) -> str | None: def epic_of(value: object) -> Epic | None: - """The epic a setting's value spells; None where it spells none. Only https, so the credentials are never sent in the clear.""" + """The epic a setting's value spells; None where it spells none.""" spelt = isinstance(value, str) and re.fullmatch(rf"{JIRA}({SITE})/browse/([A-Z][A-Z0-9_]*-[0-9]+)", value) return Epic(spelt.group(1), spelt.group(2)) if spelt else None def page_of(value: object) -> Page | None: - """The page a setting's value spells; None where it spells none. Only https, as for an epic.""" + """The page a setting's value spells; None where it spells none.""" spelt = isinstance(value, str) and re.fullmatch(rf"{CONFLUENCE}({SITE})/wiki/spaces/[^/?#]+/pages/([0-9]+)(?:/[^/?#]*)?", value) return Page(spelt.group(1), spelt.group(2), spelt.string) if spelt else None @@ -351,18 +351,18 @@ def held(folder: pathlib.Path, home: pathlib.Path) -> ProjectConfig | Failure | def configs(home: pathlib.Path) -> list[pathlib.Path]: - """Every project's config file under home, in key order. do-epic's is no project's.""" + """Every project's config file under home, in key order. do-epic's machine-wide config is not a project's.""" return sorted(file for file in (home / PROJECTS).glob(f"*/{CONFIG}") if file.parent.name != DO_EPIC) def env_files(home: pathlib.Path) -> list[pathlib.Path]: - """Every config's env-file, do-epic's included, read without the checks load makes, so a config that fails them still keeps its credentials guarded; a config that cannot be read names none.""" + """Every config's env-file, do-epic's included. Each is read without the checks load makes, so a config that fails them still keeps its credentials guarded. A config that can't be read doesn't name one.""" values = [parsed(file) for file in (*configs(home), home / PROJECTS / DO_EPIC / CONFIG)] return [path for found in values if not isinstance(found, Failure) and (path := anywhere(found.get(ENV_FILE), home))] def parsed(file: pathlib.Path) -> dict[str, object] | Failure: - """The TOML values file holds.""" + """The TOML values in file; a Failure where file can't be read or parsed.""" try: return tomllib.loads(file.read_text(encoding="utf-8")) except (OSError, UnicodeDecodeError, tomllib.TOMLDecodeError) as failure: -- 2.52.0 From b5033abacca2c971e0966c3dd18e0c340cc76f28 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 12:40:04 +0100 Subject: [PATCH 6/8] Answer stability round 1: refuse an env-file only inside a config's folder or the clone folder, and split the tests --- bin/do_epic/config.py | 7 ++++--- bin/do_epic/test_do_epic.py | 30 ++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/bin/do_epic/config.py b/bin/do_epic/config.py index c38fba90..f7f5a98c 100644 --- a/bin/do_epic/config.py +++ b/bin/do_epic/config.py @@ -9,7 +9,7 @@ One pair per machine, the same for every epic (docs/decisions.md → `do-epic: d language = "Swedish" - `jira-url` is the Jira site's address: https, a host, and no path. -- `env-file` is the file of Jira credentials: a path that starts with / or ~/, outside `~/.claude-projects` and the clone folder, which are git checkouts or hold them. +- `env-file` is the file of Jira credentials: a path that starts with / or ~/, outside every folder of `~/.claude-projects` and outside the clone folder, which hold git checkouts. `~/.claude-projects/.env` is fine. - `repoless-model` is the model that works an epic item with no repo: a model on the routing ladder, `model_routing/routing-ladder.json`. - `clone-folder` is the folder a missing repo is cloned into: a path that starts with / or ~/. `~/code` where left out. - `language` is the default language of Jira text, by its English name. English where left out. @@ -45,7 +45,7 @@ class DoEpicConfig: def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfig | Failure: - """The settings and the repo rule under home; a Failure naming each missing or misspelt one it finds, so that do-epic refuses to start.""" + """The settings and the repo rule under home; a Failure naming the file it can't read, else each missing or misspelt setting it finds, so that do-epic refuses to start.""" folder = home / PROJECTS / DO_EPIC values = parsed(folder / CONFIG) if isinstance(values, Failure): @@ -59,6 +59,7 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi unread = None except (OSError, UnicodeDecodeError) as failure: rule, unread = "", f"cannot read {folder / REPO_RULE}: {failure}" + config_folders = [path for path in (home / PROJECTS).iterdir() if path.is_dir()] clone_folder = anywhere(values.get(CLONE_FOLDER, "~/code"), home) env_file = anywhere(values.get(ENV_FILE), home) language = values.get(LANGUAGE, "English") @@ -69,7 +70,7 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi *([f"`{JIRA_URL}` is {url!r}, not a site's https address without a path, such as \"https://acme.atlassian.net\""] if JIRA_URL in values and not (isinstance(url, str) and re.fullmatch(SITE, url)) else []), *([f"`{CLONE_FOLDER}` is {values[CLONE_FOLDER]!r}, not a path that starts with / or ~/"] if clone_folder is None else []), *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not a path that starts with / or ~/"] if ENV_FILE in values and env_file is None else []), - *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, inside ~/{PROJECTS} or the clone folder, which hold git checkouts"] if env_file and lies_in(env_file, home / PROJECTS, *([clone_folder] if clone_folder else [])) else []), + *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, inside a folder of ~/{PROJECTS} or the clone folder, which hold git checkouts"] if env_file and lies_in(env_file, *config_folders, *([clone_folder] if clone_folder else [])) else []), *([f"`{LANGUAGE}` is {language!r}, {fault}"] if LANGUAGE in values and (fault := language_fault(language)) else []), *([f"`{REPOLESS_MODEL}` is {model!r}, not a model on the routing ladder: {', '.join(models)}"] if REPOLESS_MODEL in values and model not in models else []), *([unread] if unread else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []), diff --git a/bin/do_epic/test_do_epic.py b/bin/do_epic/test_do_epic.py index 2f87a1d7..c6a2fa29 100644 --- a/bin/do_epic/test_do_epic.py +++ b/bin/do_epic/test_do_epic.py @@ -43,19 +43,26 @@ class ConfigTest(unittest.TestCase): assert isinstance(found, DoEpicConfig), found self.assertEqual((found.clone_folder, found.language), (pathlib.Path("/srv/repos"), "Brazilian Portuguese")) - def test_refuses_while_the_config_is_missing_and_lists_the_settings(self) -> None: + def test_refuses_while_the_config_is_missing(self) -> None: self.write(None) self.assertIn(f"cannot read {self.folder / 'config.toml'}", self.failure()) + + def test_lists_the_settings_where_the_config_is_missing(self) -> None: + self.write(None) self.assertIn("The settings are jira-url, env-file, repoless-model", self.failure()) - def test_refuses_while_the_rule_is_missing_or_blank(self) -> None: + def test_refuses_while_the_rule_is_missing(self) -> None: self.write(rule=None) self.assertIn(f"cannot read {self.folder / 'repo-rule.md'}", self.failure()) - self.write(SETTINGS.replace("claude-opus-5-5", "x"), rule=None) - self.assertIn("`repoless-model` is 'x'", self.failure(), "a missing rule doesn't hide the settings' faults") + + def test_refuses_while_the_rule_is_blank(self) -> None: self.write(rule=" \n") self.assertIn("`repo-rule.md` is blank", self.failure()) + def test_a_missing_rule_does_not_hide_the_settings_faults(self) -> None: + self.write(SETTINGS.replace("claude-opus-5-5", "x"), rule=None) + self.assertIn("`repoless-model` is 'x'", self.failure()) + def test_names_each_missing_setting(self) -> None: self.write("") reason = self.failure() @@ -80,16 +87,23 @@ class ConfigTest(unittest.TestCase): self.write("\n".join([ln for ln in SETTINGS.splitlines() if not ln.startswith(name)] + [line])) self.assertIn(f"`{name}` is", self.failure()) - def test_keeps_the_credentials_outside_every_config_and_every_clone(self) -> None: - for env_file in ("~/.claude-projects/do-epic/jira.env", "~/.claude-projects/acme/jira.env"): + def test_keeps_the_credentials_outside_every_config_folder_and_the_clone_folder(self) -> None: + (self.home / ".claude-projects" / "acme").mkdir() + for env_file in ("~/.claude-projects/do-epic/jira.env", "~/.claude-projects/acme/jira.env", "~/code/acme/jira.env"): with self.subTest(env_file): self.write(SETTINGS.replace("~/jira.env", env_file)) self.assertIn("`env-file` is", self.failure()) - self.write(SETTINGS.replace("~/jira.env", "~/code/acme/jira.env")) - self.assertIn("`env-file` is", self.failure()) + + def test_keeps_the_credentials_outside_a_clone_folder_the_config_sets(self) -> None: self.write(SETTINGS.replace("~/jira.env", "~/clones/jira.env") + 'clone-folder = "~/clones"\n') self.assertIn("`env-file` is", self.failure()) + def test_accepts_credentials_beside_the_config_folders(self) -> None: + self.write(SETTINGS.replace("~/jira.env", "~/.claude-projects/do-epic.env")) + found = load(self.home) + assert isinstance(found, DoEpicConfig), found + self.assertEqual(found.env_file, self.home / ".claude-projects" / "do-epic.env") + def test_refuses_while_the_routing_ladder_cannot_be_read(self) -> None: self.write() found = load(self.home, self.home / "no-ladder.json") -- 2.52.0 From aabbefaad5098f1d308874bb707cc8340e3d6396 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 12:41:51 +0100 Subject: [PATCH 7/8] Kill the mutants of do_epic/config.py that its tests missed --- bin/do_epic/config.py | 8 ++++---- bin/do_epic/test_do_epic.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/do_epic/config.py b/bin/do_epic/config.py index f7f5a98c..81da5cff 100644 --- a/bin/do_epic/config.py +++ b/bin/do_epic/config.py @@ -54,11 +54,11 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi if isinstance(ladder, Failure): return ladder models = sorted({rung.model for rung in ladder.rungs}) + rule: str | Failure try: rule = (folder / REPO_RULE).read_text(encoding="utf-8") - unread = None except (OSError, UnicodeDecodeError) as failure: - rule, unread = "", f"cannot read {folder / REPO_RULE}: {failure}" + rule = Failure(f"cannot read {folder / REPO_RULE}: {failure}") config_folders = [path for path in (home / PROJECTS).iterdir() if path.is_dir()] clone_folder = anywhere(values.get(CLONE_FOLDER, "~/code"), home) env_file = anywhere(values.get(ENV_FILE), home) @@ -73,10 +73,10 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, inside a folder of ~/{PROJECTS} or the clone folder, which hold git checkouts"] if env_file and lies_in(env_file, *config_folders, *([clone_folder] if clone_folder else [])) else []), *([f"`{LANGUAGE}` is {language!r}, {fault}"] if LANGUAGE in values and (fault := language_fault(language)) else []), *([f"`{REPOLESS_MODEL}` is {model!r}, not a model on the routing ladder: {', '.join(models)}"] if REPOLESS_MODEL in values and model not in models else []), - *([unread] if unread else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []), + *([rule.reason] if isinstance(rule, Failure) else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []), ] if faults: return Failure(f"{folder}: {'; '.join(faults)}. {LISTED}") # Without a fault, each value above is present and of the type asserted here. - assert clone_folder and env_file and isinstance(url, str) and isinstance(model, str) and isinstance(language, str) + assert clone_folder and env_file and isinstance(url, str) and isinstance(model, str) and isinstance(language, str) and isinstance(rule, str) return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule) diff --git a/bin/do_epic/test_do_epic.py b/bin/do_epic/test_do_epic.py index c6a2fa29..2e0cf93a 100644 --- a/bin/do_epic/test_do_epic.py +++ b/bin/do_epic/test_do_epic.py @@ -115,3 +115,18 @@ class ConfigTest(unittest.TestCase): reason = self.failure() for part in ("`jira-url` is", "`env-file` is missing", "`repoless-model` is"): self.assertIn(part, reason) + self.assertIn("`env-file` is missing; `jira-url` is", reason, "joined by semicolons") + + def test_names_the_models_on_the_ladder_where_the_model_is_off_it(self) -> None: + ladder = self.home / "ladder.json" + ladder.write_text('[{"model": "claude-sonnet-5-5", "effort": "low"}, {"model": "claude-opus-5-5", "effort": "low"}]', encoding="utf-8") + self.write(SETTINGS.replace("claude-opus-5-5", "claude-haiku-5-5")) + found = load(self.home, ladder) + assert isinstance(found, Failure), found + self.assertIn("not a model on the routing ladder: claude-opus-5-5, claude-sonnet-5-5.", found.reason) + + def test_reads_the_rule_and_the_settings_as_utf8(self) -> None: + self.write(SETTINGS + 'language = "Svenska"\n', rule="Etiketten är repots namn.\n") + found = load(self.home) + assert isinstance(found, DoEpicConfig), found + self.assertEqual(found.repo_rule, "Etiketten är repots namn.\n") -- 2.52.0 From f444dca67a64f4f99691cbe6be5c1242cb6c8e79 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 12:47:22 +0100 Subject: [PATCH 8/8] Finish item 404 in the plan --- CHANGELOG.md | 1 + todo.md | 17 +++-------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e018977..f73a3d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- do-epic reads its machine-wide settings from ~/.claude-projects/do-epic/config.toml and its repo rule from repo-rule.md beside it, and refuses to start while either is missing or misspelt. - `project-record save` now writes a goals file kept as a Jira epic's description, except a change to `## Goals` or `## Audience`, which stays an edit in Jira. - Add do-epic's epic backend: one interface that reads a Jira epic's child issues and their sub-tasks, with labels, assignee, status and parent, and files new ones, met by a Jira backend and an in-memory fake that pass the same contract tests. - Fix for an outside reviewer's comment on a PR now ends with a change to the setup that would have caught it, in claude-config first, then the principles and standards, then the project. diff --git a/todo.md b/todo.md index 11b0a347..0f30394c 100644 --- a/todo.md +++ b/todo.md @@ -12,12 +12,11 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 404 | 0.12.0 | | | **Read do-epic's machine-wide settings from `~/.claude-projects/do-epic/config.toml` and its prose repo rule from `repo-rule.md` beside it, and refuse to start while either is missing or misspelt.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | -| 407 | 0.12.0 | 404 | | **Find an epic repo's checkout and project config by the repo's name, clone a missing one from the host of the epic's other repos, and ask the human where unsure.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | +| 407 | 0.12.0 | | | **Find an epic repo's checkout and project config by the repo's name, clone a missing one from the host of the epic's other repos, and ask the human where unsure.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 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 | -| 406 | 0.12.0 | 404 | | **Pick each epic item's repo, or for an item without one whether it is Claude's work or a human task, by `repo-rule.md`, record the pick on the issue, and ask the human where the rule leaves it unclear.** | 2 | 2 | 2 | 4 | 4 | 1 by 5 | 1.6 | +| 406 | 0.12.0 | | | **Pick each epic item's repo, or for an item without one whether it is Claude's work or a human task, by `repo-rule.md`, record the pick on the issue, and ask the human where the rule leaves it unclear.** | 2 | 2 | 2 | 4 | 4 | 1 by 5 | 1.6 | | 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, 404, 406, 407, 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 | +| 410 | 0.12.0 | 401, 406, 407, 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 | | 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 | | 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 | @@ -82,16 +81,6 @@ ## Details -### 404. Read do-epic's machine-wide settings from `~/.claude-projects/do-epic/config.toml` and its prose repo rule from `repo-rule.md` beside it, and refuse to start while either is missing or misspelt. - -Settings: the Jira site, `env-file`, the folder repos are cloned into (`~/code` by default), the default language, and the model for a no-repo item (`docs/decisions.md` → `do-epic: drives one Jira epic …`). Reuse `project_config/settings.py`'s parsing helpers: `read`, `anywhere`, `Scalar`, `language_fault`, and the `env-file` check that keeps credentials outside a checkout. - -Touches: - -- `bin/project_config/settings.py`: `read`, `anywhere`, `language_fault` (small) -- `bin/project_config/main.py`: `main` (small) -- `bin/do_epic/config.py` - ### 407. Find an epic repo's checkout and project config by the repo's name, clone a missing one from the host of the epic's other repos, and ask the human where unsure. Unsure means the epic's other repos sit on more than one host, or the clone fails (`docs/decisions.md` → `do-epic: drives one Jira epic …`). A by-name lookup goes beside `held` and `load`. -- 2.52.0