Answer prose round 1: split the record-scoring help into one idea per sentence, name the chunk's entries once, fold the changelog bullet into the bullets it changes, and give the decision's amendment its own paragraph
This commit is contained in:
@@ -115,7 +115,7 @@ def appended(history: str, entry: str) -> str:
|
||||
|
||||
|
||||
def ruling_entry(title: str, seats: list[Seat], said: dict[str, list[str]], counted: dict[str, list[str]], ruled: str, fell: list[str]) -> str:
|
||||
"""A paired ruling's entry, with a `Fell:` line when fell names dimensions; a seat's vote that counted as same for want of a place says so."""
|
||||
"""A paired ruling's entry; a seat's vote that counted as same for want of a place says so."""
|
||||
votes = [[seat.name, *map(vote_text, DIMENSIONS, said[seat.name], counted[seat.name])] for seat in seats]
|
||||
lines = [f"Ruling: {ruled}"] + ([f"Fell: {', '.join(fell)}"] if fell else [])
|
||||
return entry_text(title, lines, [["Seat", *DIMENSIONS], *votes], [(f"{seat.name}, {DECIDED_BY}:", seat.places) for seat in seats])
|
||||
|
||||
+19
-18
@@ -1,6 +1,6 @@
|
||||
"""Hold larv-review's mechanical rules: the paired ruling's base and vote count, each pass's rounds, the scoring run's trigger, and the comprehension history's format.
|
||||
|
||||
usage: larv-review ruling-base | round-count | needs-scoring-run [<item ID>...] | record-ruling <seats file> | record-scoring <seats file>
|
||||
usage: larv-review ruling-base | round-count | needs-scoring-run [<item ID>...] | record-ruling <seats file> | record-scoring <seats file> [<item ID>...]
|
||||
|
||||
Run it inside a project checkout or one of its worktrees. Each command but record-ruling first
|
||||
fetches origin, when the checkout has that remote, and takes origin's default branch, or else the
|
||||
@@ -19,10 +19,11 @@ round-count prints each pass's count: the highest <n> among the titles opening
|
||||
cap of {cap} rounds, and each name in such a title that is not a pass.
|
||||
|
||||
needs-scoring-run takes the IDs of the todo.md items the chunk ships, none when it ships none, and
|
||||
prints why the chunk is due a scoring run, or `No scoring run due.` It is due when the chunk ships
|
||||
an item whose tagline names the comprehension floor, when the checkout's history ends on a paired
|
||||
ruling with a `Fell:` line, or when it leaves a release with no item in
|
||||
the checkout's todo.md, less the shipped items, and work has landed towards that release. Work has
|
||||
prints why the chunk is due a scoring run, or `No scoring run due.` The chunk's entries are those
|
||||
the checkout's history holds and the default branch's lacks. It is due when the chunk ships an
|
||||
item whose tagline names the comprehension floor, when the chunk's newest entry is a paired ruling
|
||||
with a `Fell:` line, or when it leaves a release with no item in the checkout's todo.md, less the
|
||||
shipped items, and work has landed towards that release. Work has
|
||||
landed when the chunk ships one of the release's items, or when the release is the earliest the
|
||||
default branch's todo.md names and the default branch has a commit after its newest v* tag, or has
|
||||
no v* tag.
|
||||
@@ -44,11 +45,12 @@ opens with its label, written exactly: `Junior A:`, `Mid A:`, `Maintainability s
|
||||
- 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 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.
|
||||
each better, same or worse. Each place opens with the names from the seat's line that it moves,
|
||||
joined by `, ` and followed by `: `. A dimension's vote counts as same unless one of the seat's
|
||||
places opens with that dimension and holds a `path:line` in backticks; the overall vote counts as
|
||||
same unless any place holds one. 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.
|
||||
Otherwise the ruling is the overall vote that leads each other vote by two or more, else same; it
|
||||
prints `Ruling:` and appends the ruling. A dimension falls when its worse votes lead each other
|
||||
vote by two or more. Unless the ruling is worse, it prints and records a `Fell:` line naming each.
|
||||
@@ -60,13 +62,12 @@ Each line is `Navigation <n>, Locality <n>, Shape <n>, Self-sufficiency <n>, Ove
|
||||
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}. 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
|
||||
under the floor, the ruling counts as worse, and it prints and records a `Ratchet:` line, which
|
||||
needs-scoring-run repeats as `Still standing:` until a paired ruling follows it. Both read only the entries the default
|
||||
branch's history lacks.
|
||||
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. It reads the
|
||||
chunk's entries as needs-scoring-run does. When a fall is pending, it says whether the paired
|
||||
ruling stands. When a fallen dimension's mean is under the floor, the ruling counts as worse, and
|
||||
it prints and records a `Ratchet:` line. needs-scoring-run repeats that line as `Still standing:`
|
||||
until a paired ruling follows it.
|
||||
|
||||
Each record is appended to the history, created when missing, under a heading of the current UTC
|
||||
time and the seats file's first line. A file holding a `Mean:` line alone opens with the date or
|
||||
@@ -226,7 +227,7 @@ def record_ruling(seats_file: pathlib.Path) -> Failure | None:
|
||||
fell = fallen(count) if ruled != "worse" else []
|
||||
print(f"Ruling: {ruled}. Overall votes as counted: {tally}.")
|
||||
if fell:
|
||||
print(f"Fell: {', '.join(fell)}. A scoring run is due; the ruling counts as worse if it puts {' or '.join(fell)} under the floor of {FLOOR}.")
|
||||
print(f"Fell: {', '.join(fell)}. A scoring run is due; the ruling counts as worse if that run scores {' or '.join(fell)} under the floor of {FLOOR}.")
|
||||
return append(ruling_entry(title, given.seats, said, count, ruled, fell))
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure:
|
||||
|
||||
|
||||
def counted(seats: list[Seat], said: dict[str, list[str]]) -> dict[str, list[str]]:
|
||||
"""Each seat's votes as they count: a dimension's vote counts as same unless one of the seat's `path:line` places names that dimension, and the overall vote unless the seat names any such place."""
|
||||
"""Each seat's votes as they count: a dimension's vote counts as same unless one of the seat's `path:line` places opens with that dimension, and the overall vote unless the seat names any such place."""
|
||||
return {seat.name: [vote if names_a_place(seat, name) else "same" for name, vote in zip(DIMENSIONS, said[seat.name])] for seat in seats}
|
||||
|
||||
|
||||
@@ -63,13 +63,13 @@ def fallen(counted: dict[str, list[str]]) -> list[str]:
|
||||
|
||||
|
||||
def chunk_entries(default_history: str, history: str) -> list[Entry]:
|
||||
"""The checkout's entries whose headings the default branch's history lacks, oldest first; of entries with one time, the later in the file is newer."""
|
||||
"""The checkout's entries whose headings the default branch's history lacks, oldest first; entries sharing a time keep their file order."""
|
||||
held = {entry.heading for entry in entries(default_history)}
|
||||
return sorted((entry for entry in entries(history) if entry.heading not in held), key=lambda entry: entry.time)
|
||||
|
||||
|
||||
def pending_fall(chunk: list[Entry]) -> list[str]:
|
||||
"""The dimensions that fell in the chunk's newest entry: a paired ruling no scoring run has followed yet."""
|
||||
"""The dimensions that fell in the chunk's newest entry, empty unless that entry is a paired ruling."""
|
||||
return chunk[-1].fell if chunk else []
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ def floor_verdict(under: list[str], reasons: list[str]) -> str:
|
||||
return f"None under the floor of {FLOOR}."
|
||||
if reasons:
|
||||
return f"Floor: {', '.join(under)} under the floor of {FLOOR} block the merge, as the chunk {' and '.join(reasons)}."
|
||||
return f"Under the floor of {FLOOR}, blocking nothing on a run due for no reason besides a fall: {', '.join(under)}."
|
||||
return f"Under the floor of {FLOOR}, blocking nothing, as only a fall called this run: {', '.join(under)}."
|
||||
|
||||
|
||||
def fall_outcome(fell: list[str], found: list[decimal.Decimal]) -> tuple[str, list[str]] | None:
|
||||
@@ -99,7 +99,7 @@ def fall_outcome(fell: list[str], found: list[decimal.Decimal]) -> tuple[str, li
|
||||
if dropped := [f"{name} is {value}" for name, value in zip(DIMENSIONS, found) if name in fell and value < FLOOR]:
|
||||
line = f"Ratchet: the paired ruling counts as worse, as {' and '.join(fell)} fell and {', '.join(dropped)}, under the floor of {FLOOR}."
|
||||
return line, [line]
|
||||
return f"The paired ruling stands: {' and '.join(fell)} fell and stays at or above the floor of {FLOOR}.", []
|
||||
return f"The paired ruling stands: {' and '.join(fell)} fell and each stays at or above the floor of {FLOOR}.", []
|
||||
|
||||
|
||||
def means(lines: list[list[str]]) -> list[decimal.Decimal]:
|
||||
|
||||
@@ -80,7 +80,7 @@ class Seats(unittest.TestCase):
|
||||
found = [decimal.Decimal(score) for score in ("6", "6.5", "7", "6", "6")]
|
||||
ratchet = "Ratchet: the paired ruling counts as worse, as Locality and Shape fell and Locality is 6.5, under the floor of 7.0."
|
||||
self.assertEqual(fall_outcome(["Locality", "Shape"], found), (ratchet, [ratchet]))
|
||||
self.assertEqual(fall_outcome(["Shape"], found), ("The paired ruling stands: Shape fell and stays at or above the floor of 7.0.", []))
|
||||
self.assertEqual(fall_outcome(["Shape"], found), ("The paired ruling stands: Shape fell and each stays at or above the floor of 7.0.", []))
|
||||
self.assertIsNone(fall_outcome([], found))
|
||||
|
||||
def test_rules_by_a_lead_of_two_and_splits_two_seats_that_differ(self):
|
||||
@@ -315,14 +315,14 @@ class LarvReviewTool(unittest.TestCase):
|
||||
seats = "".join(f"\n{seat}: {line}\n" for seat in ("Junior A", "Mid A", "Maintainability senior", "Inherited architect"))
|
||||
scored = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats))
|
||||
self.assertIn("Ratchet: the paired ruling counts as worse, as Locality fell and Locality is 6.50, under the floor of 7.0.", scored.stdout)
|
||||
self.assertIn("blocking nothing on a run due for no reason besides a fall: Locality 6.50.", scored.stdout)
|
||||
self.assertIn("blocking nothing, as only a fall called this run: Locality 6.50.", scored.stdout)
|
||||
|
||||
self.assertIn("\n\nRatchet: the paired ruling counts as worse", (self.checkout / "docs" / "comprehension-history.md").read_text())
|
||||
self.assertTrue(self.run_tool("needs-scoring-run", "2").stdout.startswith("No scoring run due.\nStill standing: Ratchet:"))
|
||||
same = self.run_tool("record-ruling", self.seats_file(f"PR #3 at {self.start}, against {self.start}\n\nMid A: {said('same', 'worse')}{place}Inherited architect: {said('same', 'worse')}{place}"))
|
||||
self.assertIn("Fell: Locality.", same.stdout, same.stderr)
|
||||
stands = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats.replace("Locality 6.5", "Locality 7")))
|
||||
self.assertIn("The paired ruling stands: Locality fell and stays at or above the floor of 7.0.", stands.stdout)
|
||||
self.assertIn("The paired ruling stands: Locality fell and each stays at or above the floor of 7.0.", stands.stdout)
|
||||
|
||||
def test_names_no_fall_on_a_worse_ruling(self):
|
||||
place = "\n\n- Locality, Overall: `bin/a.py:3` `f`: longer\n\n"
|
||||
|
||||
Reference in New Issue
Block a user