Name each file of the setup as the setup's, and a config's as setup:<path>
CI / tests (pull_request) Successful in 4m42s

This commit is contained in:
2026-12-04 04:23:17 +01:00
parent eff57c1dfd
commit 6dd2787e7b
41 changed files with 220 additions and 156 deletions
+7 -4
View File
@@ -16,19 +16,22 @@ comprehension-history = "folder:docs/comprehension-history.md"
reading-cost = "folder:docs/reading-cost.md"
changelog = "checkout:CHANGELOG.md"
goals-and-audience = "folder:goals.md"
principles = "~/.claude/principles"
standards = "~/.claude/skills/larv-review/standards"
principles = "setup:principles"
standards = "setup:skills/larv-review/standards"
"""
JIRA_PLAN = "jira:https://acme.atlassian.net/browse/ABC-12"
JIRA_SCORING = 'jira-score-formula = "100 * V / (2**S + 8)"\njira-score-bar = 1\n'
# Where a test's config places the setup's folders: under the test's home, so no test reads the clone it runs in.
SETUP = "~/setup"
def write_config(home: pathlib.Path, checkout: pathlib.Path, goals: str = "checkout:README.md") -> pathlib.Path:
"""A config under home that names checkout, every setting inside it but goals-and-audience; for the tests of each tool that reads the config."""
"""A config under home that names checkout, every setting inside it but goals-and-audience, principles and standards, which lie in SETUP; for the tests of each tool that reads the config."""
folder = config_folder({}, home) / checkout.name
folder.mkdir(parents=True, exist_ok=True)
(folder / "config.toml").write_text(CLIENT.replace('"~/code/acme-billing"', f'"{checkout}"').replace('"folder:', '"checkout:').replace('"checkout:goals.md"', f'"{goals}"'), encoding="utf-8")
(folder / "config.toml").write_text(CLIENT.replace('"~/code/acme-billing"', f'"{checkout}"').replace('"folder:', '"checkout:').replace('"setup:', f'"{SETUP}/').replace('"checkout:goals.md"', f'"{goals}"'), encoding="utf-8")
return folder
+4 -3
View File
@@ -10,8 +10,9 @@ Run inside a checkout, or a worktree of one. It finds the config that names the
and project-config doesn't read anything from it, so no project may use `build-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:<path>" inside the checkout, "folder:<path>" inside the config's own folder, or one that
starts with / or ~/. In a worktree, a "checkout:" path is the worktree's own file.
"checkout:<path>" inside the checkout, "folder:<path>" inside the config's own folder,
"setup:<path>" inside the clone of this setup whose tool reads the config, or one that starts with
/ or ~/. In a worktree, a "checkout:" path is the worktree's own file.
checkout = "~/code/acme-billing"
plan = "folder:todo.md"
@@ -23,7 +24,7 @@ starts with / or ~/. In a worktree, a "checkout:" path is the worktree's own fil
changelog = "checkout:CHANGELOG.md"
goals-and-audience = "folder:goals.md"
principles = "folder:principles"
standards = "~/.claude/skills/larv-review/standards"
standards = "setup:skills/larv-review/standards"
`principles` and `standards` name the folders the reviewers hold the project to: the technical
principles and the review standards. A standards folder must hold quality.md, prose.md, comments.md
+4 -3
View File
@@ -10,7 +10,7 @@ import re
import tomllib
import typing
from loop_state.paths import config_folder
from loop_state.paths import config_folder, RELEASE_ROOT
from failure import Failure
from plan.formula import parse_formula
from plan.todo_table import SHAPE
@@ -25,7 +25,7 @@ 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.
SPELLING = '"checkout:<path>" for a path in the checkout, "folder:<path>" for one in the config\'s folder, or a path that starts with / or ~/'
SPELLING = '"checkout:<path>" for a path in the checkout, "folder:<path>" for one in the config\'s folder, "setup:<path>" for one in the setup\'s clone, or a path that starts with / or ~/'
# A path setting a project may leave out: the file of KEY=value credentials its tools read. It has no default either: a project without it asks for no credentials, and never reads another project's.
ENV_FILE = "env-file"
# An optional setting: the service that sends the loop's DMs to the human, one of NOTIFIERS. A project that names none gets no DMs, so a client's env file of Jira credentials is never read for a chat token.
@@ -475,7 +475,8 @@ def placed(value: object, top: pathlib.Path, folder: pathlib.Path, home: pathlib
"""The path a setting's value spells, or None where it doesn't spell one. A prefixed path stays inside its place."""
if not isinstance(value, str):
return None
for prefix, place in (("checkout:", top), ("folder:", folder)):
# "setup:" is the clone this tool runs from, so a config holds wherever that clone lies. Five readers, seated as people who write a config and as claudes that read one, each picked the prefix over a path in the loop's Claude home and over the clone's path written out.
for prefix, place in (("checkout:", top), ("folder:", folder), ("setup:", RELEASE_ROOT)):
if value.startswith(prefix):
inside = pathlib.PurePosixPath(value.removeprefix(prefix))
return None if inside.is_absolute() or ".." in inside.parts or not inside.parts else place / inside
+5 -3
View File
@@ -12,6 +12,7 @@ from project_config.doubles import CLIENT, JIRA_PLAN, JIRA_SCORING
from failure import Failure
from test_env import isolated_env
from project_config.main import located, title_templates
from loop_state.paths import RELEASE_ROOT
from project_config.templates import Titles
TOOL = pathlib.Path(__file__).resolve().parents[1] / "project-config"
@@ -50,8 +51,8 @@ class LoadTest(ConfigCase):
self.assertEqual(found.paths["plan"], folder / "todo.md")
self.assertEqual(found.paths["decisions"], folder / "docs" / "decisions.md")
self.assertEqual(found.paths["changelog"], self.checkout / "CHANGELOG.md")
self.assertEqual(found.paths["principles"], self.home / ".claude" / "principles")
self.assertEqual(found.paths["standards"], self.home / ".claude" / "skills" / "larv-review" / "standards")
self.assertEqual(found.paths["principles"], RELEASE_ROOT / "principles")
self.assertEqual(found.paths["standards"], RELEASE_ROOT / "skills" / "larv-review" / "standards")
self.assertEqual(tuple(found.paths), SETTINGS)
def test_the_build_epic_folder_is_no_projects_config_so_it_needs_no_checkout(self) -> None:
@@ -191,7 +192,7 @@ class LoadTest(ConfigCase):
self.assertIsNone(found.tracked("plan"), "the config's folder is outside the checkout")
def test_an_absolute_checkout_and_path_are_taken_as_written(self) -> None:
self.write("acme", CLIENT.replace("~/code/acme-billing", str(self.checkout)).replace("~/.claude/principles", "/srv/principles"))
self.write("acme", CLIENT.replace("~/code/acme-billing", str(self.checkout)).replace("setup:principles", "/srv/principles"))
found = load(self.checkout, self.checkout, self.home, {})
assert isinstance(found, ProjectConfig), found
self.assertEqual(found.paths["principles"], pathlib.Path("/srv/principles"))
@@ -235,6 +236,7 @@ class LoadTest(ConfigCase):
"a value that is not text": ("plan = 3\n", "`plan`"),
"a path that leaves the folder": ('plan = "folder:../other/todo.md"\n', "`plan`"),
"a path that leaves the checkout": ('plan = "checkout:../todo.md"\n', "`plan`"),
"a path that leaves the setup": ('plan = "setup:../todo.md"\n', "`plan`"),
"an empty path": ('plan = "folder:"\n', "`plan`"),
}
for case, (line, named) in cases.items():