From fa0b91c2605caecbec821bb8a65c742990c11e91 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 13 Oct 2026 12:44:53 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1;=20pin=20an=20old-format=20rul?= =?UTF-8?q?ing=20and=20a=20bullet=20before=20any=20label,=20start=20places?= =?UTF-8?q?=20at=20the=20newest=20scoring=20run,=20and=20word=20the=20empt?= =?UTF-8?q?y=20result=20plainly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/comprehension_history.py | 6 +++--- bin/larv_review/main.py | 8 ++++---- bin/larv_review/record.py | 2 +- bin/larv_review/test_larv_review.py | 5 ++++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bin/comprehension_history.py b/bin/comprehension_history.py index e9f3f5c6..784b9817 100644 --- a/bin/comprehension_history.py +++ b/bin/comprehension_history.py @@ -40,7 +40,7 @@ class Place: @dataclasses.dataclass(frozen=True) 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 time: str commit: str @@ -104,9 +104,9 @@ def entries(history: str) -> list[Entry]: 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) - 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:]] return "\n".join(part for part in parts if part) or None diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index b4d85c5a..8c52019b 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -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. 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 -paired ruling's base. It appends the seats' scores and their means, rounded half up to two +`, against`, and the same item IDs, and exits 1 when they call no run: like any entry, a scoring +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:` naming each one. -places prints the places seats found hard from the history's newest entry, by time, that holds -scoring seats' places: in it and each later entry, every scoring seat's place, and each ruled place +places prints the places seats found hard from the history's newest entry, by time, that is a +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 under its heading, oldest first. With no such entry, it reads every ruling. diff --git a/bin/larv_review/record.py b/bin/larv_review/record.py index 138c61e5..9287764a 100644 --- a/bin/larv_review/record.py +++ b/bin/larv_review/record.py @@ -81,7 +81,7 @@ def show_places() -> Failure | None: history = history_file() if isinstance(history, Failure): 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 diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 26102888..eb53d0b8 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -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" 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", "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" 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) @@ -326,7 +329,7 @@ class LarvReviewTool(unittest.TestCase): 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): - 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")}) 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)