Answer architecture round 3: open each place with the dimensions it moves, fail a scoring run nothing calls, test the base rule and a standing ratchet, and state the base rule whole

This commit is contained in:
2026-10-09 11:07:12 +02:00
parent 9de87e04cf
commit 030e29a52d
6 changed files with 43 additions and 23 deletions
+22 -11
View File
@@ -48,19 +48,21 @@ class Seats(unittest.TestCase):
self.assertIsInstance(report(""), Failure)
def test_counts_each_vote_of_a_seat_naming_no_place_as_same(self):
seats = [Seat("Mid A", said("worse", "worse"), ["Locality: the whole skill"]), Seat("Inherited architect", said("better"), ["`a.py:3` `f`: Overall: shorter"])]
seats = [Seat("Mid A", said("worse", "worse"), ["Locality: the whole skill"]), Seat("Inherited architect", said("better"), ["Overall: `a.py:3` `f`: shorter"])]
written = votes(seats)
self.assertEqual(written, {"Mid A": ["same", "worse", "same", "same", "worse"], "Inherited architect": ["same", "same", "same", "same", "better"]})
self.assertEqual(counted(seats, written)["Mid A"], ["same"] * 5)
def test_counts_a_dimensions_vote_only_where_a_place_names_that_dimension(self):
seats = [Seat("Mid A", said("better", "worse"), ["`a.py:3` `f`: Shape, reshaped"]), Seat("Inherited architect", said("better", "worse"), ["`a.py:3` `f`: Locality, held at once"])]
seats = [Seat("Mid A", said("better", "worse"), ["Shape: `a.py:3` `f`: the Locality of it, reshaped"]), Seat("Inherited architect", said("better", "worse"), ["Locality, Shape: `a.py:3` `f`: held at once"])]
written = {seat.name: ["same", "worse", "same", "same", "better"] for seat in seats}
self.assertEqual(counted(seats, written), {"Mid A": ["same", "same", "same", "same", "better"], "Inherited architect": written["Inherited architect"]})
self.assertIsInstance(votes([Seat("Mid A", said("better"), ["`a.py:3` `f`: self sufficiency"]), seats[1]]), Failure)
self.assertIsInstance(votes([Seat("Mid A", said("better"), ["Locality, self sufficiency: `a.py:3` `f`: x"]), seats[1]]), Failure)
self.assertIsInstance(votes([Seat("Mid A", said("better"), ["`a.py:3` `f`: Locality: x"]), seats[1]]), Failure)
self.assertEqual(votes(seats), {seat.name: written[seat.name] for seat in seats})
def test_refuses_two_more_seats_once_the_first_two_agree_overall(self):
seats = [Seat(name, said(vote), ["`f.py:1` `f`: x"]) for name, vote in (("Mid A", "worse"), ("Inherited architect", "worse"), ("Maintainability senior", "better"), ("Junior A", "better"))]
seats = [Seat(name, said(vote), ["Overall: `f.py:1` `f`: x"]) for name, vote in (("Mid A", "worse"), ("Inherited architect", "worse"), ("Maintainability senior", "better"), ("Junior A", "better"))]
self.assertIsInstance(votes(seats), Failure)
def test_takes_the_first_two_seats_then_the_other_two_in_order_and_each_dimensions_vote(self):
@@ -135,6 +137,9 @@ class PendingFall(unittest.TestCase):
self.assertEqual(standing_ratchet(chunk_entries("", fell + later)), "Ratchet: worse.")
self.assertEqual(pending_fall(chunk_entries("", SCORING + paired("2026-10-08T13:00:00Z", "same\n\nFell: Locality"))), ["Locality"])
self.assertEqual(pending_fall(chunk_entries("", "")), [])
rescored = SCORING.replace("12:00:00Z", "15:00:00Z")
self.assertEqual(standing_ratchet(chunk_entries("", fell + later + rescored)), "Ratchet: worse.")
self.assertIsNone(standing_ratchet(chunk_entries("", fell + later + paired("2026-10-08T16:00:00Z", "same"))))
def test_reads_only_the_entries_the_default_branch_lacks(self):
fell = paired("2026-10-08T13:00:00Z", "better\n\nFell: Locality")
@@ -153,6 +158,11 @@ class Base(unittest.TestCase):
worse_last = HistoryChange("worse", SCORING, SCORING + paired("2026-10-08T13:00:00Z", "better") + paired("2026-10-08T14:00:00Z", "worse"))
self.assertEqual(measured_commit([worse_last, older]), "old")
self.assertIsNone(measured_commit([same]))
run = SCORING.replace("12:00:00Z", "14:00:00Z").replace("PR #1", "PR #2")
same_fell = HistoryChange("same fell", SCORING, SCORING + paired("2026-10-08T13:00:00Z", "same\n\nFell: Locality") + run)
self.assertEqual(measured_commit([same_fell, older]), "old")
better_fell = HistoryChange("better fell", SCORING, SCORING + paired("2026-10-08T13:00:00Z", "better\n\nFell: Locality") + run)
self.assertEqual(measured_commit([better_fell, older]), "better fell")
def test_falls_back_to_the_first_rulings_base_then_to_none(self):
ruled = paired("2026-10-08T13:00:00Z", "worse")
@@ -277,7 +287,7 @@ class LarvReviewTool(unittest.TestCase):
Mid A: {worse}
- `bin/a.py:3` `f`: Overall: three branches
- Overall: `bin/a.py:3` `f`: three branches
Inherited architect: {same}
"""
@@ -287,7 +297,7 @@ class LarvReviewTool(unittest.TestCase):
self.assertTrue(split.stdout.startswith("Split: Mid A worse, Inherited architect same."))
history = self.checkout / "docs" / "comprehension-history.md"
self.assertFalse(history.exists())
lines += f"\n\t\t\tMaintainability senior: {said('worse')}\n\n\t\t\t- `bin/a.py:3` `f`: Overall: hard\n\n\t\t\tJunior A: {said('worse')}\n"
lines += f"\n\t\t\tMaintainability senior: {said('worse')}\n\n\t\t\t- Overall: `bin/a.py:3` `f`: hard\n\n\t\t\tJunior A: {said('worse')}\n"
ran = self.run_tool("record-ruling", self.seats_file(lines))
self.assertEqual(ran.stdout.splitlines()[0], "Ruling: same. Overall votes as counted: Mid A worse, Inherited architect same, Maintainability senior worse, Junior A same (voted worse, naming no place).")
recorded = entries(history.read_text())
@@ -296,7 +306,7 @@ class LarvReviewTool(unittest.TestCase):
self.assertIn("| Junior A | same | same | same | same | same (voted worse, naming no place) |", history.read_text())
def test_holds_a_better_ruling_that_hides_a_fall_until_a_scoring_run_decides_it(self):
place = "\n\n- `bin/a.py:3` `f`: Locality, shorter\n\n"
place = "\n\n- Locality, Overall: `bin/a.py:3` `f`: shorter\n\n"
ran = self.run_tool("record-ruling", self.seats_file(f"PR #2 at {self.start}, against {self.start}\n\nMid A: {said('better', 'worse')}{place}Inherited architect: {said('better', 'worse')}{place}"))
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("Fell: Locality. A scoring run is due", ran.stdout)
@@ -314,7 +324,7 @@ class LarvReviewTool(unittest.TestCase):
self.assertIn("The paired ruling stands: Locality fell and stays at or above the floor of 7.0.", stands.stdout)
def test_names_no_fall_on_a_worse_ruling(self):
place = "\n\n- `bin/a.py:3` `f`: Locality, longer\n\n"
place = "\n\n- Locality, Overall: `bin/a.py:3` `f`: longer\n\n"
ran = self.run_tool("record-ruling", self.seats_file(f"PR #2 at {self.start}, against {self.start}\n\nMid A: {said('worse', 'worse')}{place}Inherited architect: {said('worse', 'worse')}{place}"))
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertNotIn("Fell:", ran.stdout + (self.checkout / "docs" / "comprehension-history.md").read_text())
@@ -322,10 +332,11 @@ class LarvReviewTool(unittest.TestCase):
def test_records_a_scoring_run_with_its_means(self):
line = "Navigation 7, Locality 6.5, Shape 7, Self-sufficiency 6.5, Overall 7"
seats = "".join(f"\n{seat}: {line}\n\n- `bin/a.py:3` `f`: long\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))
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("Under the floor of 7.0, blocking nothing on a run due for no reason besides a fall: Locality 6.50, Self-sufficiency 6.50.", ran.stdout)
uncalled = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats))
self.assertEqual(uncalled.returncode, 1)
self.assertIn("name the item IDs the chunk ships", uncalled.stderr)
due = self.run_tool("record-scoring", self.seats_file(f"PR #3 at {self.start}\n" + seats), "1")
self.assertEqual(due.returncode, 0, due.stderr)
self.assertIn("Floor: Locality 6.50, Self-sufficiency 6.50 under the floor of 7.0 block the merge, as the chunk leaves release 0.1.0 with no plan item.", due.stdout)
text = (self.checkout / "docs" / "comprehension-history.md").read_text()
self.assertIn("| Mean | 7.00 | 6.50 | 7.00 | 6.50 | 7.00 |", text)