Merge remote-tracking branch 'origin/main' into item-458
CI / tests (pull_request) Has been cancelled

This commit is contained in:
Lilleman
2026-11-19 23:39:12 +01:00
6 changed files with 127 additions and 23 deletions
+3 -2
View File
@@ -91,8 +91,9 @@ prepare-scoring sets up a scoring run in the chunk's review folder: a detached w
checkout's HEAD, which the seats read, and one prompt file per seat beside it, as
skills/comprehension-panel/seat-prompts.md builds them. It prints the worktree's path and each
prompt's. It takes {{language}}, {{kind}}, {{domain}}, {{domain docs}} and {{3am question}} from the
checkout's AGENTS.md → "Scoring run". claude-config keeps no AGENTS.md, so there it takes them from
seat-prompts.md → "claude-config's values". It fills the other placeholders from the worktree and
project's working-rules file → "Scoring run", which is the checkout's AGENTS.md unless the config
names another. Where that file holds no such section, as in claude-config, it takes them from the
checkout's seat-prompts.md → "claude-config's values". It fills the other placeholders from the worktree and
the panel's SKILL.md. Where any one of the five values is missing, it exits 1 and doesn't write
anything. Where a setup that record-scoring never removed is still there, it removes it first and
says so.
+9 -4
View File
@@ -61,9 +61,12 @@ def score_bullets(skill: str) -> tuple[list[str], list[str]] | Failure:
return anchors, [line.replace("**", "") for _, line in dimensions]
VALUES_HEADING = r"(\d+\.\s+)?Scoring run|.+'s values"
def project_values(text: str, source: str) -> dict[str, str] | Failure:
"""Each value seat-prompts.md fills from the project, from the section of text, read from source, headed `Scoring run` or `<name>'s values`."""
lines = section(text, r"(\d+\.\s+)?Scoring run|.+'s values")
lines = section(text, VALUES_HEADING)
if lines is None:
return Failure(f"{source} has no \"Scoring run\" section to fill the seats' prompts from; add one with {listed([f'{{{name}}}' for name in VALUE_NAMES], 'and')}")
values = {}
@@ -137,13 +140,15 @@ def prepare_scoring(worktree: str, home: pathlib.Path, run: Git = git) -> str |
config = located(worktree, home, run)
if isinstance(config, Failure):
return config
# Where AGENTS.md is missing, this repo keeps the values in seat-prompts.md: .claude/rules/this-repo-keeps-no-agents-md.md.
source = config.paths["working-rules"]
if not source.is_file() and (own := pathlib.Path(worktree) / "skills" / "comprehension-panel" / "seat-prompts.md").is_file():
source = own
rules = read(source) if source.is_file() else ""
if isinstance(rules, Failure):
return rules
# This repo keeps the values in seat-prompts.md, so its working rules hold none: .claude/rules/this-repo-keeps-no-agents-md.md.
if section(rules, VALUES_HEADING) is None and (own := pathlib.Path(worktree) / "skills" / "comprehension-panel" / "seat-prompts.md").is_file():
source, rules = own, read(own)
if isinstance(rules, Failure):
return rules
skill = read(PANEL / "SKILL.md")
if isinstance(skill, Failure):
return skill
+30
View File
@@ -165,6 +165,28 @@ class PrepareScoring(unittest.TestCase):
assert isinstance(ran, str), ran
self.assertIn("every non-test tracked file: `bin/**` and `README.md`. Do NOT open any record of a past panel, nor any review output.", pathlib.Path(ran.splitlines()[2]).read_text())
def test_takes_the_values_from_the_checkouts_seat_prompts_where_the_working_rules_hold_none(self):
own = self.checkout / "skills" / "comprehension-panel" / "seat-prompts.md"
own.parent.mkdir(parents=True)
own.write_text("# Seats\n\n## proj's values\n\n- Language: Go\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n")
for rules in ("# Working rules, with no values\n", None):
with self.subTest(rules=rules):
(self.checkout / "AGENTS.md").unlink(missing_ok=True)
self.commit(rules)
ran = self.prepare()
assert isinstance(ran, str), ran
self.assertIn("Your background: ~2 years in Go, first codebase of this kind (a CLI)", pathlib.Path(ran.splitlines()[2]).read_text())
self.assertIsNone(removed_setup(str(self.checkout), self.root, functools.partial(git, env=self.env)))
def test_keeps_the_working_rules_values_where_the_checkout_has_seat_prompts_too(self):
own = self.checkout / "skills" / "comprehension-panel" / "seat-prompts.md"
own.parent.mkdir(parents=True)
own.write_text("## proj's values\n\n- Language: Go\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n")
self.commit("## Scoring run\n\n- Language: Python\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n")
ran = self.prepare()
assert isinstance(ran, str), ran
self.assertIn("Your background: ~2 years in Python,", pathlib.Path(ran.splitlines()[2]).read_text())
def test_refuses_writing_nothing_where_the_project_gives_no_values(self):
self.commit()
ran = self.run_tool("prepare-scoring")
@@ -181,6 +203,14 @@ class PrepareScoring(unittest.TestCase):
assert isinstance(unread, Failure), unread
self.assertTrue(unread.reason.startswith(f"cannot read {self.checkout}/AGENTS.md: "), unread.reason)
self.assertEqual(len(self.git("worktree", "list").splitlines()), 1)
own = self.checkout / "skills" / "comprehension-panel" / "seat-prompts.md"
own.parent.mkdir(parents=True)
own.write_bytes(b"\xff")
(self.checkout / "AGENTS.md").write_text("# Working rules, with no values\n")
unread = self.prepare()
assert isinstance(unread, Failure), unread
self.assertTrue(unread.reason.startswith(f"cannot read {own}: "), unread.reason)
self.assertEqual(len(self.git("worktree", "list").splitlines()), 1)
if __name__ == "__main__":