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:
@@ -37,15 +37,15 @@ opens with its label, written exactly: `Junior A:`, `Mid A:`, `Maintainability s
|
||||
|
||||
Mid A: Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall worse
|
||||
|
||||
- `bin/x.py:12` `run`: Locality: three branches to hold at once
|
||||
- Locality: `bin/x.py:12` `run`: three branches to hold at once
|
||||
|
||||
Inherited architect: Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall worse
|
||||
|
||||
- `bin/x.py:12` `run`: Locality: ...
|
||||
- Locality: `bin/x.py:12` `run`: ...
|
||||
|
||||
record-ruling takes Mid A's and the inherited architect's votes on each dimension and overall,
|
||||
each better, same or worse. Each place names the dimensions it moves, or Overall, spelled as the
|
||||
seat's line spells them. A dimension's vote counts as same unless one of the seat's places in
|
||||
each better, same or worse. Each place opens with the dimensions it moves, or Overall, spelled as
|
||||
the seat's line spells them and joined by `, `, then `: `. A dimension's vote counts as same unless one of the seat's places in
|
||||
backticks, `path:line`, names that dimension; the overall vote counts as same unless the seat names
|
||||
any such place. The printed votes say so. When the two counted overall votes differ, it appends
|
||||
nothing and prints `Split:`, saying to add the maintainability senior's and Junior A's lines.
|
||||
@@ -59,7 +59,8 @@ architect's lines in that order, or a `Mean:` line alone for a run moved from a
|
||||
Each line is `Navigation <n>, Locality <n>, Shape <n>, Self-sufficiency <n>, Overall <n>`, each
|
||||
score from 1 to 10 and the overall at most 1 above the line's lowest dimension. Its first line
|
||||
names no `, against`. It appends the seats' scores and their means, rounded half up to two
|
||||
decimals, and prints the means and each one under the floor of {floor}. A `Floor:` line says the
|
||||
decimals, and prints the means and each one under the floor of {floor}. It exits 1 on a run with
|
||||
seats that no plan item, release or fall calls. A `Floor:` line says the
|
||||
means under the floor block the merge, as they do when needs-scoring-run would give a reason
|
||||
besides a fall. When the history ends on a
|
||||
paired ruling with a `Fell:` line, it says whether the ruling stands; when a dimension that fell is
|
||||
@@ -247,6 +248,8 @@ def record_scoring(default: str, seats_file: pathlib.Path, ids: list[int]) -> Fa
|
||||
blocking = due_reasons(default, ids, [])
|
||||
if isinstance(blocking, Failure):
|
||||
return blocking
|
||||
if not (blocking or given.moved_mean or pending_fall(recorded)):
|
||||
return Failure("no plan item, release or fall calls this scoring run; name the item IDs the chunk ships, as needs-scoring-run took them")
|
||||
print(f"Means: {', '.join(f'{name} {value}' for name, value in zip(DIMENSIONS, mean))}. {floor_verdict(under_floor(mean), blocking)}")
|
||||
outcome = fall_outcome([] if given.moved_mean else pending_fall(recorded), mean)
|
||||
if outcome:
|
||||
|
||||
@@ -23,8 +23,8 @@ def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure:
|
||||
line = vote_line(seat.name, seat.said)
|
||||
if isinstance(line, Failure):
|
||||
return line
|
||||
if unnamed := [place for place in seat.places if not any(re.search(rf"\b{name}\b", place) for name in DIMENSIONS)]:
|
||||
return Failure(f"{seat.name}'s place names none of {', '.join(DIMENSIONS)}, spelled so: {unnamed[0]}")
|
||||
if unnamed := [place for place in seat.places if not place_dimensions(place)]:
|
||||
return Failure(f"{seat.name}'s place does not open with the dimensions it moves, each one of {', '.join(DIMENSIONS)}, then `: `: {unnamed[0]}")
|
||||
said[seat.name] = line
|
||||
first, second, *more = (each[-1] for each in counted(seats, said).values())
|
||||
if more and first == second:
|
||||
@@ -38,7 +38,13 @@ def counted(seats: list[Seat], said: dict[str, list[str]]) -> dict[str, list[str
|
||||
|
||||
|
||||
def names_a_place(seat: Seat, dimension: str) -> bool:
|
||||
return any(PLACE.search(place) and (dimension == DIMENSIONS[-1] or re.search(rf"\b{dimension}\b", place)) for place in seat.places)
|
||||
return any(PLACE.search(place) and (dimension == DIMENSIONS[-1] or dimension in place_dimensions(place)) for place in seat.places)
|
||||
|
||||
|
||||
def place_dimensions(place: str) -> list[str]:
|
||||
"""The dimensions a place opens with, as in `Locality, Shape: `path:line` ...`; empty when any name before the first `: ` is no dimension."""
|
||||
named = place.partition(": ")[0].split(", ")
|
||||
return named if all(name in DIMENSIONS for name in named) else []
|
||||
|
||||
|
||||
def ruling(counted: list[str]) -> str | None:
|
||||
|
||||
+22
-11
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user