Answer principles round 1: 0 🔴, 6 🟡; average the overall over the newest scored commit's runs, re-rank through rank_todo's functions and say not to record again, tie the help to UNDER_FLOOR and FLOOR, add code health to the working loop's premises, loop-claude's first prompt and two more agents, and fix items 114, 124 and 125's details

This commit is contained in:
2026-10-18 20:29:19 +02:00
parent 3081d50f0f
commit 390d1f1f83
15 changed files with 93 additions and 42 deletions
+15 -3
View File
@@ -54,16 +54,28 @@ def record_scoring(default: str, scores_file: pathlib.Path, ids: list[int]) -> F
def rerank() -> Failure | None:
"""Rank the checkout's todo.md again, since the overall sets code health's weight."""
"""Rank the checkout's todo.md again, since the overall sets code health's weight. The run stays recorded whatever happens, so a failure says to rank todo.md, not to record the run again."""
checkout = top()
if isinstance(checkout, Failure):
return checkout
todo = pathlib.Path(checkout, "todo.md")
if rank_todo.main([str(todo)]):
return Failure(f"recorded the run, but rank_todo.py exited 1 on {todo}, saying why above; settle that before committing the run")
texts = rank_todo.read_all(todo)
if isinstance(texts, Failure):
return unranked(todo, texts)
ranked = rank_todo.rank(*texts)
if isinstance(ranked, Failure):
return unranked(todo, ranked)
if ranked.text != texts[0] and (unwritten := rank_todo.write(todo, ranked.text)):
return Failure(f"recorded the run, but {unwritten.reason}; run rank_todo.py on {todo}")
for line in ranked.notes + ranked.under_bar:
print(f"{todo}: {line}")
return None
def unranked(todo: pathlib.Path, why: Failure) -> Failure:
return Failure(f"recorded the run, but rank_todo.py cannot rank {todo}: {why.reason}. Repair it and run rank_todo.py on it, not record-scoring again")
def scored_seats(given: SeatsFile) -> ScoringRun | Failure:
found = scores(given.seats)
if isinstance(found, Failure):
+17 -4
View File
@@ -438,10 +438,9 @@ class LarvReviewTool(unittest.TestCase):
uncalled = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats))
self.assertEqual(uncalled.returncode, 1)
self.assertIn("no plan item or release calls this scoring run", uncalled.stderr)
self.plan()
ran = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats), "1")
# This checkout's todo.md, beside no README.md, does not rank, so the run is recorded and the re-rank fails.
self.assertEqual(ran.returncode, 1)
self.assertIn(f"recorded the run, but rank_todo.py exited 1 on {self.checkout / 'todo.md'}", ran.stderr)
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("\nFloor: Locality 6.50, Self-sufficiency 6.50 under the floor of 7.0.\n", ran.stdout)
self.assertIn("not /", self.run_tool("record-scoring", "1", self.seats_file(f"PR #2 at {self.start}\n" + seats)).stderr)
text = (self.checkout / "docs" / "comprehension-history.md").read_text()
@@ -449,12 +448,26 @@ class LarvReviewTool(unittest.TestCase):
self.assertIn("Inherited architect, would restructure first:", text)
self.assertEqual(entries(text)[0].scored_places, [Place("bin/a.py", "f")] * 4)
def test_reranks_todo_md_by_the_overall_it_records(self):
def plan(self):
"""Commit and push a README.md and a todo.md that rank, item 1 alone in release 0.1.0, as ranked before any scoring run."""
header = "| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |\n|---|---|---|---|---|---|---|---|---|---|---|---|\n"
# Before any scoring run code health weighs four times its weight at an overall of 7.0: 4 / 1.97 against goal 1's 0.97 / 1.97.
rows = "| 1 | 0.1.0 | | | **Read easier.** | 1 | 1 | 1 | 1 | 1 | code health by 1 | 101.5 |\n| 2 | 0.2.0 | | | **Do A.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 24.6 |\n"
self.commit("Plan", {"README.md": "# P\n\n## Goals\n\n1. **Achieve:** A.\n", "todo.md": "# todo\n\n## Scoring\n\n`Score = 100 * V / 2**S`\n\n`Bar = 0.1`\n\n`Next ID = 3`\n\n## Items\n\n" + header + rows})
self.git("push", "-q", "origin", "HEAD:main")
def test_reports_a_plan_it_cannot_rank_yet_keeps_the_run(self):
line = "Navigation 7, Locality 7, Shape 7, Self-sufficiency 7, Overall 7"
seats = "".join(f"\n{seat}: {line}\n" for seat in ("Junior A", "Mid A", "Maintainability senior", "Inherited architect"))
# This checkout's todo.md, beside no README.md, does not rank.
ran = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats), "1")
self.assertEqual(ran.returncode, 1)
self.assertIn(f"recorded the run, but rank_todo.py cannot rank {self.checkout / 'todo.md'}: {self.checkout / 'README.md'}: not found", ran.stderr)
self.assertIn("not record-scoring again", ran.stderr)
self.assertEqual(len(entries((self.checkout / "docs" / "comprehension-history.md").read_text())), 1)
def test_reranks_todo_md_by_the_overall_it_records(self):
self.plan()
line = "Navigation 7, Locality 7, Shape 7, Self-sufficiency 7, Overall 7"
seats = "".join(f"\n{seat}: {line}\n" for seat in ("Junior A", "Mid A", "Maintainability senior", "Inherited architect"))
ran = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats), "1")