diff --git a/bin/larv_review/scoring_setup.py b/bin/larv_review/scoring_setup.py index 806ef509..2e7b77ab 100644 --- a/bin/larv_review/scoring_setup.py +++ b/bin/larv_review/scoring_setup.py @@ -137,17 +137,18 @@ 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 + values = project_values(rules, source.name) + # Where the working rules hold no values, as with AGENTS.md missing or this repo's decisions.md head, this repo keeps them in seat-prompts.md: .claude/rules/this-repo-keeps-no-agents-md.md. + if isinstance(values, Failure) and (own := pathlib.Path(worktree) / "skills" / "comprehension-panel" / "seat-prompts.md").is_file(): + own_text = read(own) + values = own_text if isinstance(own_text, Failure) else project_values(own_text, own.name) skill = read(PANEL / "SKILL.md") if isinstance(skill, Failure): return skill - values = project_values(rules, source.name) if isinstance(values, Failure): return values parts = prompt_parts() diff --git a/bin/larv_review/test_scoring_setup.py b/bin/larv_review/test_scoring_setup.py index 4e3eebc9..34561f3f 100644 --- a/bin/larv_review/test_scoring_setup.py +++ b/bin/larv_review/test_scoring_setup.py @@ -157,6 +157,17 @@ class PrepareScoring(unittest.TestCase): self.assertIn("Your background: ~2 years in Go,", junior) self.assertIn("every non-test tracked file: `bin/**`, `AGENTS.md` and `README.md`. Do NOT open plan/todo.md, docs/decisions.md or docs/reading-cost.md (the plan, the decision log and past chunks' reading cost), nor any review output.", junior) + def test_takes_the_values_from_seat_prompts_where_the_working_rules_hold_none_and_the_repo_keeps_them_there(self): + self.commit("# Working rules, with no values\n") + self.assertIsInstance(failed := self.prepare(), Failure, failed) + panel = self.checkout / "skills" / "comprehension-panel" + panel.mkdir(parents=True) + (panel / "seat-prompts.md").write_text("# Seats\n\n## The repo'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() + ran = self.prepare() + assert isinstance(ran, str), ran + self.assertIn("Your background: ~2 years in Go,", pathlib.Path(ran.splitlines()[2]).read_text()) + def test_forbids_any_record_of_a_past_panel_where_the_config_puts_every_record_outside_the_checkout(self): self.config.write_text(self.config.read_text().replace('"checkout:', '"folder:').replace('"folder:README.md"', '"checkout:README.md"')) (self.config.parent / "AGENTS.md").write_text("# A\n\n## Scoring run\n\n- Language: Go\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n")