Answer stability round 1: 0 🔴, 1 🟡; pin an old-format ruling and a bullet before any label, start places at the newest scoring run, and word the empty result plainly

This commit is contained in:
2026-10-13 12:44:53 +02:00
parent 7701b0917a
commit fa0b91c260
4 changed files with 12 additions and 9 deletions
+3 -3
View File
@@ -40,7 +40,7 @@ class Place:
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class Entry: class Entry:
"""One paired ruling, which names the commit it was against and its ruling, or one scoring run, which names neither. The places under a scoring seat's label are scored_places; a ruling recorded before PR #255 holds them too where a fallen dimension called the scoring seats.""" """One paired ruling, which names the commit it was against and its ruling, or one scoring run, which names neither. The places under a scoring seat's label are scored_places; a ruling recorded before PR #255 may hold them too, under a scoring seat's label."""
heading: str heading: str
time: str time: str
commit: str commit: str
@@ -104,9 +104,9 @@ def entries(history: str) -> list[Entry]:
def latest_places(history: str) -> str | None: def latest_places(history: str) -> str | None:
"""The places seats found hard from the newest entry, by time, that holds scoring seats' places: in it and each later entry, each ruled place opening with a dimension its seat's vote counted as worse, and every scoring seat's place. Each entry's places come under its heading, oldest first; with no such entry, every ruling's count. None when no place counts.""" """The places seats found hard from the newest entry, by time, that is a scoring run or holds scoring seats' places: in it and each later entry, each ruled place opening with a dimension its seat's vote counted as worse, and every scoring seat's place. Each entry's places come under its heading, oldest first; with no such entry, every ruling's count. None when no place counts."""
found = sorted(entries(history), key=lambda entry: entry.time) found = sorted(entries(history), key=lambda entry: entry.time)
newest = max((index for index, entry in enumerate(found) if entry.scored_places), default=0) newest = max((index for index, entry in enumerate(found) if not entry.paired or entry.scored_places), default=0)
parts = [placed(entry, worse_places(entry) + labelled_bullets(entry.body, SCORED_PLACES)) for entry in found[newest:]] parts = [placed(entry, worse_places(entry) + labelled_bullets(entry.body, SCORED_PLACES)) for entry in found[newest:]]
return "\n".join(part for part in parts if part) or None return "\n".join(part for part in parts if part) or None
+4 -4
View File
@@ -62,13 +62,13 @@ Otherwise the ruling is the overall vote that leads each other vote by two or mo
prints `Ruling:` and appends the ruling. prints `Ruling:` and appends the ruling.
record-scoring takes the scores file of a run needs-scoring-run calls, whose first line names no record-scoring takes the scores file of a run needs-scoring-run calls, whose first line names no
`, against`, and the same item IDs, and exits 1 when they call no run: each scoring run moves the `, against`, and the same item IDs, and exits 1 when they call no run: like any entry, a scoring
paired ruling's base. It appends the seats' scores and their means, rounded half up to two run moves the paired ruling's base. It appends the seats' scores and their means, rounded half up to two
decimals, prints the means and, when a mean is under the floor of {floor}, a line opening `Floor:` decimals, prints the means and, when a mean is under the floor of {floor}, a line opening `Floor:`
naming each one. naming each one.
places prints the places seats found hard from the history's newest entry, by time, that holds places prints the places seats found hard from the history's newest entry, by time, that is a
scoring seats' places: in it and each later entry, every scoring seat's place, and each ruled place scoring run or holds scoring seats' places: in it and each later entry, every scoring seat's place, and each ruled place
that opens with a dimension, or Overall, its seat's vote counted as worse. Each entry's places come that opens with a dimension, or Overall, its seat's vote counted as worse. Each entry's places come
under its heading, oldest first. With no such entry, it reads every ruling. under its heading, oldest first. With no such entry, it reads every ruling.
+1 -1
View File
@@ -81,7 +81,7 @@ def show_places() -> Failure | None:
history = history_file() history = history_file()
if isinstance(history, Failure): if isinstance(history, Failure):
return history return history
print((latest_places(history[1]) or "The comprehension history names no places seats found hard since its newest scoring run, or ever when it holds none.").rstrip("\n")) print((latest_places(history[1]) or "No places that seats found hard since the newest scoring run.").rstrip("\n"))
return None return None
+4 -1
View File
@@ -141,6 +141,9 @@ class History(unittest.TestCase):
older = paired("2026-10-07T12:00:00Z", "worse") + "\n| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |\n|---|---|---|---|---|---|\n| Mid A | same | worse | same | same | worse |\n\nMid A, decided by:\n\n- Locality: `bin/e.py:1` `n`: old\n" older = paired("2026-10-07T12:00:00Z", "worse") + "\n| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |\n|---|---|---|---|---|---|\n| Mid A | same | worse | same | same | worse |\n\nMid A, decided by:\n\n- Locality: `bin/e.py:1` `n`: old\n"
self.assertIsNone(latest_places("")) self.assertIsNone(latest_places(""))
self.assertIsNone(latest_places(appended("", paired("2026-10-07T12:00:00Z", "same")))) self.assertIsNone(latest_places(appended("", paired("2026-10-07T12:00:00Z", "same"))))
self.assertIsNone(latest_places(appended("", paired("2026-10-07T12:00:00Z", "worse") + "\n| Seat | Vote |\n|---|---|\n| Mid A | worse |\n\n- Locality: `bin/k.py:1` `t`: before any label\n\nMid A, decided by:\n\n- Locality: `bin/e.py:1` `n`: old\n")))
unscored = "## 2026-10-11T12:00:00Z, PR #4 at eeeeeee\n\n| Seat | Overall |\n|---|---|\n| Mean | 7.00 |\n"
self.assertIsNone(latest_places(appended(appended("", scored), unscored)))
hard_since = "## 2026-10-10T12:00:00Z, PR #2 at bbbbbbb, against aaaaaaa\n\nMid A, decided by:\n\n- Locality, Shape: `bin/a.py:3` `f`: held at once\n" hard_since = "## 2026-10-10T12:00:00Z, PR #2 at bbbbbbb, against aaaaaaa\n\nMid A, decided by:\n\n- Locality, Shape: `bin/a.py:3` `f`: held at once\n"
self.assertEqual(latest_places(appended(appended(appended("", older), ruled), scored)), "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\nJunior A, hardest first:\n\n- `bin/b.py:4` `h`: long\n and wrapped\n\nInherited architect, would restructure first:\n\n- `bin/c.py:1` `k`: tangled\n\n" + hard_since) self.assertEqual(latest_places(appended(appended(appended("", older), ruled), scored)), "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\nJunior A, hardest first:\n\n- `bin/b.py:4` `h`: long\n and wrapped\n\nInherited architect, would restructure first:\n\n- `bin/c.py:1` `k`: tangled\n\n" + hard_since)
self.assertEqual(latest_places(appended(appended("", ruled), older)), "## 2026-10-07T12:00:00Z, PR #2 at bbbbbbb, against aaaaaaa\n\nMid A, decided by:\n\n- Locality: `bin/e.py:1` `n`: old\n\n" + hard_since) self.assertEqual(latest_places(appended(appended("", ruled), older)), "## 2026-10-07T12:00:00Z, PR #2 at bbbbbbb, against aaaaaaa\n\nMid A, decided by:\n\n- Locality: `bin/e.py:1` `n`: old\n\n" + hard_since)
@@ -326,7 +329,7 @@ class LarvReviewTool(unittest.TestCase):
self.assertEqual(entries(text)[0].scored_places, [Place("bin/a.py", "f")] * 4) self.assertEqual(entries(text)[0].scored_places, [Place("bin/a.py", "f")] * 4)
def test_prints_the_places_seats_found_hard_since_the_newest_scoring_run(self): def test_prints_the_places_seats_found_hard_since_the_newest_scoring_run(self):
self.assertEqual(self.run_tool("places").stdout, "The comprehension history names no places seats found hard since its newest scoring run, or ever when it holds none.\n") self.assertEqual(self.run_tool("places").stdout, "No places that seats found hard since the newest scoring run.\n")
self.commit("Record a scoring run", {"docs/comprehension-history.md": appended("", SCORING + "\nJunior A, hardest first:\n\n- `bin/b.py:4` `h`: long\n")}) self.commit("Record a scoring run", {"docs/comprehension-history.md": appended("", SCORING + "\nJunior A, hardest first:\n\n- `bin/b.py:4` `h`: long\n")})
ran = self.run_tool("places") ran = self.run_tool("places")
self.assertEqual((ran.returncode, ran.stdout), (0, "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\nJunior A, hardest first:\n\n- `bin/b.py:4` `h`: long\n"), ran.stderr) self.assertEqual((ran.returncode, ran.stdout), (0, "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\nJunior A, hardest first:\n\n- `bin/b.py:4` `h`: long\n"), ran.stderr)