From 885396370a040709955a8e33a66e4416387db91d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 9 Oct 2026 11:40:13 +0200 Subject: [PATCH] Answer architecture round 5: give record_scoring's moved Mean its own path, and take pending_fall from a paired entry alone --- bin/larv_review/main.py | 73 ++++++++++++++-------- bin/larv_review/rules.py | 9 ++- bin/test_larv_review.py | 7 ++- docs/comprehension-history.md | 59 +++++++++++++++++ skills/comprehension-panel/seat-prompts.md | 2 +- skills/larv-review/SKILL.md | 2 +- 6 files changed, 121 insertions(+), 31 deletions(-) diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index 0cbe9280..688a5b7f 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -10,8 +10,8 @@ docs/comprehension-history.md in the checkout. ruling-base prints the commit a paired ruling reads against, then which of these found it. The last measured commit is the default branch's newest merged change whose last added paired ruling, by -heading time, is better, or that adds a scoring run to the history while that ruling names no fall; a merge commit counts as -one change against its first parent. With none, the base is the one the history's first paired +heading time, is better, or that adds a scoring run to the history while that ruling names no +fall; a merge commit counts as one change against its first parent. With none, the base is the one the history's first paired ruling names; with no ruling either, it is the merge base of HEAD and the default branch. round-count prints each pass's count: the highest among the titles opening @@ -23,8 +23,8 @@ prints why the chunk is due a scoring run, or `No scoring run due.` The chunk's 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 +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. @@ -36,12 +36,14 @@ opens with its label, written exactly: `Junior A:`, `Mid A:`, `Maintainability s PR #231 at abc1234, against def5678 - Mid A: Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall worse + Mid A: Navigation better, Locality worse, Shape same, Self-sufficiency same, Overall better + - Navigation, Overall: `README.md:40` "Tools": names the tool a symptom leads to - 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 + Inherited architect: Navigation better, Locality worse, Shape same, Self-sufficiency same, Overall better + - Navigation: `README.md:40` "Tools": ... - Locality: `bin/x.py:12` `run`: ... record-ruling takes Mid A's and the inherited architect's votes on each dimension and overall, @@ -50,8 +52,7 @@ joined by `, ` and followed by `: `. A dimension's vote counts as same unless on 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 +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. @@ -61,13 +62,14 @@ architect's lines in that order, or a `Mean:` line alone for a run moved from a Each line is `Navigation , Locality , Shape , Self-sufficiency , Overall `, 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}. 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. 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. +decimals, and prints the means, the item IDs it read, and each mean under the floor of {floor}. It +exits 1 on a run with seats that no plan item, release or fall calls. A line opening `Floor:` 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, prefixed with `Still standing:`, until a paired ruling follows it. Once a scoring run follows +a fall, the fall calls no other. 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 @@ -78,6 +80,7 @@ Exit 1, saying why, on unknown arguments, an unknown item ID, a seats file it ca breaks the shape above, or when git cannot start, finds no checkout or no default branch, cannot fetch origin for ruling-base or needs-scoring-run, or cannot read or write the history or todo.md. """ +import decimal import pathlib import re import sys @@ -85,7 +88,7 @@ import time import typing from larv_review.history import appended, Entry, heading, ruling_entry, scoring_entry, vote_text -from larv_review.rules import base, CAP, chunk_entries, counted, fall_outcome, fallen, FLOOR, floor_verdict, means, PASSES, pending_fall, plan_items, round_counts, ruling, scoring_run_due, standing_ratchet, under_floor, votes +from larv_review.rules import base, CAP, chunk_entries, counted, fall_outcome, fallen, FLOOR, floor_verdict, means, PASSES, pending_fall, plan_items, round_counts, ruling, scoring_run_due, standing_ratchet, uncalled, under_floor, votes from larv_review.git import commit_exists, default_branch, file_at, git, HISTORY, history_changes, landed_since_release, top from larv_review.seats import DIMENSIONS, MEAN, Report, report, score_line, scores from failure import Failure @@ -111,7 +114,8 @@ def main(argv: list[str]) -> int: elif command == "record-scoring" and given and all(re.fullmatch(r"[0-9]+", id_) for id_ in given[1:]): done = with_default_branch(lambda default: record_scoring(default, pathlib.Path(given[0]), [int(id_) for id_ in given[1:]]), stale_ok=True) elif command in ("needs-scoring-run", "record-scoring") and given: - print(f"{command} takes item IDs, the numbers in todo.md's ID column: {' '.join(given)}", file=sys.stderr) + named = given[1:] if command == "record-scoring" else given + print(f"{command} takes item IDs, the numbers in todo.md's ID column, not {' '.join(id_ for id_ in named if not re.fullmatch(r'[0-9]+', id_))}; {USAGE}", file=sys.stderr) return 1 elif not argv: print(USAGE, file=sys.stderr) @@ -236,28 +240,43 @@ def record_scoring(default: str, seats_file: pathlib.Path, ids: list[int]) -> Fa if isinstance(read, Failure): return read title, given = read - found = scores(given.seats) if given.moved_mean is None else {} + if given.moved_mean is not None: + return record_moved_mean(title, given.moved_mean) + found = scores(given.seats) if isinstance(found, Failure): return found - moved = [] if given.moved_mean is None else score_line(MEAN, given.moved_mean) - if isinstance(moved, Failure): - return moved - mean = means(list(found.values()) or [moved]) + mean = means(list(found.values())) recorded = chunk_history(default) if isinstance(recorded, Failure): return recorded - blocking = [] if given.moved_mean else due_reasons(default, ids, []) + 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) + fell = pending_fall(recorded) + if not (blocking or fell): + return Failure(uncalled(recorded)) + print(f"Means: {means_text(mean)}.") + print(f"Item IDs read: {', '.join(map(str, ids)) or 'none'}.") + print(floor_verdict(under_floor(mean), blocking)) + outcome = fall_outcome(fell, mean) if outcome: print(outcome[0]) return append(scoring_entry(title, given.seats, found, [str(value) for value in mean], outcome[1] if outcome else [])) +def record_moved_mean(title: str, line: str) -> Failure | None: + moved = score_line(MEAN, line) + if isinstance(moved, Failure): + return moved + mean = means([moved]) + print(f"Means: {means_text(mean)}.") + return append(scoring_entry(title, [], {}, [str(value) for value in mean], [])) + + +def means_text(mean: list[decimal.Decimal]) -> str: + return ", ".join(f"{name} {value}" for name, value in zip(DIMENSIONS, mean)) + + def read_seats(seats_file: pathlib.Path, paired: bool) -> tuple[str, Report] | Failure: """The seats file, and the heading its record goes under, once each commit it names is in the checkout.""" try: diff --git a/bin/larv_review/rules.py b/bin/larv_review/rules.py index d9639f19..c4a330f9 100644 --- a/bin/larv_review/rules.py +++ b/bin/larv_review/rules.py @@ -70,7 +70,14 @@ def chunk_entries(default_history: str, history: str) -> list[Entry]: def pending_fall(chunk: list[Entry]) -> list[str]: """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 [] + return chunk[-1].fell if chunk and chunk[-1].paired else [] + + +def uncalled(chunk: list[Entry]) -> str: + """Why a scoring run nothing calls fails, and what to do instead.""" + if chunk and not chunk[-1].paired: + return "the chunk's newest entry is already a scoring run; record a paired ruling first, or name the item IDs the chunk ships" + return "no plan item, release or fall calls this scoring run; name the item IDs the chunk ships, as needs-scoring-run took them" def standing_ratchet(chunk: list[Entry]) -> str | None: diff --git a/bin/test_larv_review.py b/bin/test_larv_review.py index e9783b0b..76dd868f 100644 --- a/bin/test_larv_review.py +++ b/bin/test_larv_review.py @@ -319,6 +319,8 @@ class LarvReviewTool(unittest.TestCase): 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:")) + again = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats)) + self.assertIn("already a scoring run; record a paired ruling first", again.stderr) 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"))) @@ -338,7 +340,10 @@ class LarvReviewTool(unittest.TestCase): 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) + self.assertIn("\nItem IDs read: 1.\nFloor: 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.\n", due.stdout) + swapped = self.run_tool("record-scoring", "1", self.seats_file(f"PR #3 at {self.start}\n" + seats)) + self.assertEqual(swapped.returncode, 1) + self.assertIn("not /", swapped.stderr) text = (self.checkout / "docs" / "comprehension-history.md").read_text() self.assertIn("| Mean | 7.00 | 6.50 | 7.00 | 6.50 | 7.00 |", text) self.assertIn("Inherited architect, would restructure first:", text) diff --git a/docs/comprehension-history.md b/docs/comprehension-history.md index c74868ce..7521e6cb 100644 --- a/docs/comprehension-history.md +++ b/docs/comprehension-history.md @@ -561,3 +561,62 @@ Inherited architect, decided by: - `bin/larv_review/git.py:56` `file_at` and `bin/larv_review/main.py:247` `history_text`: Locality: two histories, the default branch's and the checkout's - `skills/larv-review/SKILL.md:97` "Seats": Self-sufficiency, against the skill: it needs the tool's help open beside it - `bin/rank_todo.py:386` `parse_row`: Shape, a small gain + +## 2026-10-09T09:35:29Z, PR #232 at 6a8bbcf, against 12d6d75 + +Ruling: same + +Fell: Locality, Shape + +| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall | +|---|---|---|---|---|---| +| Mid A | better | worse | same | better | better | +| Inherited architect | better | worse | worse | same | worse | +| Maintainability senior | better | worse | worse | better | same | +| Junior A | better | worse | worse | better | worse | + +Mid A, decided by: + +- Navigation, Self-sufficiency, Overall: `bin/larv_review/rules.py:118` `round_counts`, with `bin/larv_review/main.py:155` `round_count`: the fourth-round symptom leads from the README's Tools list to a named, tested function, where the base had `skills/larv-review/SKILL.md:58` "Count" +- Self-sufficiency, Overall: `bin/larv_review/history.py:117` `ruling_entry` and `:130` `scoring_entry`: the history format is produced by code and checked by a regex, where the base had `skills/larv-review/SKILL.md:92` "History" +- Locality: `bin/larv_review/main.py:234` `record_scoring`: five conditionals on `given.moved_mean` weave a one-off migration into the main scoring path +- Locality: `bin/metric_bench/main.py:38` and `bin/larv_review/history.py:31` `Entry`: places are parsed in larv_review but used only by metric_bench; `bin/metric_bench/bench.py:87` `resolved` copes with old paths +- Locality: `bin/larv_review/main.py:1` the module docstring: rules compressed into one dense block; the fall, Ratchet and Still standing chain reaches across `bin/larv_review/rules.py:95` `fall_outcome`, `:76` `standing_ratchet` and `bin/larv_review/main.py:164` `needs_scoring_run` +- Navigation: `README.md:66` "Tools": lists larv-review and metric-bench; `skills/larv-review/SKILL.md:46` points at `--help` +- Shape: `bin/larv_review/rules.py:155` `plan_items` and `:169` `scoring_run_due`: a catch-all module, offset by the clean package split and the truthful `skills/comprehension-panel/seat-prompts.md:1` name + +Inherited architect, decided by: + +- Locality: `bin/larv_review/main.py:234` `record_scoring`: whether a run is allowed and whether the floor blocks depend on the plan diff, a pending fall read from the history, and `moved_mean`, checked five times in 25 lines +- Locality: `bin/larv_review/rules.py:71` `pending_fall` and `:76` `standing_ratchet`: commands talk only through the history file, so the outcome depends on the order they ran in +- Locality, Shape: `bin/larv_review/rules.py:127` `measured_commit`: re-parses the history around every merged change and applies a two-clause rule; where it rots first +- Shape: `bin/larv_review/rules.py:1` the module: vote counting, round counting, base search, plan parsing and release emptying under a name that says as little as utils; `HistoryChange` defined in history but built in `bin/larv_review/git.py:66` `history_changes` +- Shape: `bin/metric_bench/main.py:38`: a second tool no review runs, depending on larv_review's history parser; `bin/` gains two packages +- Shape: `bin/metric_bench/bench.py:87` `resolved`: a shim for old path formats +- Navigation: `bin/larv_review/rules.py:118` `round_counts` and `bin/larv_review/main.py:155` `round_count`: the 3am symptom lands on a named command, where the base had `skills/larv-review/SKILL.md:58` "Count" +- Navigation: `README.md:66` "Tools": lists every tool +- Navigation: `skills/comprehension-panel/seat-prompts.md:1`: a truthful name +- Self-sufficiency: `bin/larv_review/main.py:1` the module docstring and `skills/larv-review/SKILL.md:93` "Paired ruling": the code explains itself, but the skill's ratchet text needs the docstring open beside it; ruled same + +Maintainability senior, decided by: + +- Locality: `bin/larv_review/main.py:234` `record_scoring`: tests `given.moved_mean` five times, each branch tied to `chunk_history`, `due_reasons` and `pending_fall` +- Locality: `bin/larv_review/rules.py:71` `pending_fall`: its docstring holds only because `bin/larv_review/history.py:62` `entries` gives scoring runs an empty `fell`; the Fell, Ratchet and Still standing chain spans four files +- Locality, Shape: `bin/metric_bench/main.py:38` `main`: metric-bench imports larv_review's history internals; `bin/metric_bench/main.py:143` `git` repeats `bin/larv_review/git.py:10` `git` +- Shape: `bin/larv_review/rules.py:35` `counted`: a function and a parameter share the name; the module name says nothing of its contents +- Shape: `bin/larv_review/main.py:177` `due_reasons`: main holds commands plus I/O helpers, and the vocabulary grew to seven concepts +- Navigation: `README.md:66` "Tools": every tool listed with its `--help` +- Self-sufficiency, Navigation: `bin/larv_review/rules.py:118` `round_counts`: the round count, vote count and trigger state their rules in code, where the base had `skills/larv-review/SKILL.md:58` "Count" +- Self-sufficiency: `bin/larv_review/main.py:1` the module docstring: an 80-line block of every rule at once, partly cancelling the gain + +Junior A, decided by: + +- Locality, Overall: `bin/larv_review/main.py:234` `record_scoring`: the moved-Mean case is checked five times and decides four things +- Locality, Overall: `bin/larv_review/rules.py:76` `standing_ratchet` and `:71` `pending_fall`: a merge block depends on state earlier commands wrote into the history +- Locality, Shape: `bin/larv_review/rules.py:127` `measured_commit`: walks every merged change's history; restated at `bin/larv_review/main.py:11`, the hardest sentence in the repo +- Shape: `bin/larv_review/rules.py:1` the module: a grab-bag name beside truthfully named siblings +- Shape: `bin/larv_review/seats.py:31` `Report`: the field `read` looks like a verb; `said`, `counted`, `given` and `found` at `bin/larv_review/main.py:217` `record_ruling` need tracing +- Shape: `bin/metric_bench/main.py:38`: the history format is a contract between two tool packages +- Navigation, Self-sufficiency: `bin/larv_review/rules.py:118` `round_counts`: the 3am question lands on one named function, where the base had `skills/larv-review/SKILL.md:58` "Count" +- Navigation: `README.md:66` "Tools": the README lists larv-review and metric-bench +- Self-sufficiency: `bin/larv_review/history.py:62` `entries` and `:117` `ruling_entry`: the history format is enforced in code; the skill needs `--help` open beside it diff --git a/skills/comprehension-panel/seat-prompts.md b/skills/comprehension-panel/seat-prompts.md index 602178c7..f53b8df5 100644 --- a/skills/comprehension-panel/seat-prompts.md +++ b/skills/comprehension-panel/seat-prompts.md @@ -90,5 +90,5 @@ Same means a reader of either version would find it as easy to understand and ch Report, in this shape: 1. Your rulings, each better, same or worse, in this shape: Navigation , Locality , Shape , Self-sufficiency , Overall -2. The places that decided them, most decisive first. Each opens with the names from your rulings line that it moves, joined by ", " and followed by ": ", such as `Locality, Shape: `. Then `path:line` and the unit's name, each in backticks, in the version the place is in, and one or two sentences on what reads easier or harder there than in the other version. A ruling that no place opens with counts as same. +2. The places that decided them, most decisive first. Each opens with the names from your rulings line that it moves, joined by ", " and followed by ": ", such as `Locality, Shape: `. Then `path:line` and the unit's name, each in backticks, in the version the place is in, and one or two sentences on what reads easier or harder there than in the other version. A dimension's ruling that no place opens with counts as same, and the overall ruling does unless you name a place. ``` diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index 59492a69..84b7a578 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -101,7 +101,7 @@ Then the comprehension check: simulated readers, launched per `~/.claude/skills/ The chunk does not merge while either holds: -- **Ratchet.** The paired ruling is worse, or `record-scoring` prints `Ratchet:`, because a dimension that fell is under the floor. `needs-scoring-run` repeats that line as `Still standing:` until a paired ruling follows it. +- **Ratchet.** The paired ruling is worse, or `record-scoring` prints `Ratchet:`, because a dimension that fell is under the floor. `needs-scoring-run` repeats that line, prefixed with `Still standing:`, until a paired ruling follows it. - **Floor.** `record-scoring` prints `Floor:`, naming means under the floor of 7.0. Each is a 🔴 of the comprehension check. It is never filed, and stands until a later run clears it or, for the floor, a decision to ship answers it.