Answer architecture round 2: fail a place naming no dimension, keep a ratchet until a ruling follows, leave the base on a fall-called run, let record-scoring say whether the floor blocks, and name the missing dimension in a discounted vote

This commit is contained in:
2026-10-09 11:04:01 +02:00
parent 75b0e46326
commit 9de87e04cf
8 changed files with 95 additions and 56 deletions
+42 -31
View File
@@ -9,8 +9,8 @@ read origin as last fetched and say so on stderr; the other two exit 1. The hist
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 that adds a scoring run to the
history, or whose last added paired ruling, by heading time, is better; a merge commit counts as
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
ruling names; with no ruling either, it is the merge base of HEAD and the default branch.
@@ -37,30 +37,34 @@ 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`: three branches to hold at once
- `bin/x.py:12` `run`: Locality: three branches to hold at once
Inherited architect: Navigation same, Locality worse, Shape same, Self-sufficiency same, Overall worse
- `bin/x.py:12` `run`: ...
- `bin/x.py:12` `run`: Locality: ...
record-ruling takes Mid A's and the inherited architect's votes on each dimension and overall,
each better, same or worse. A dimension's vote counts as same unless one of the seat's places in
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
backticks, `path:line`, names that dimension; the overall vote counts as same unless the seat names
any place. The printed votes say so. When the two counted overall votes differ, it appends
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.
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.
record-scoring takes Junior A's, Mid A's, the maintainability senior's and the inherited
record-scoring takes a seats file and the IDs of the items the chunk ships, as needs-scoring-run
does. The file holds Junior A's, Mid A's, the maintainability senior's and the inherited
architect's lines in that order, or a `Mean:` line alone for a run moved from a decision entry.
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}. When the history ends on a
decimals, and prints the means and each one under the floor of {floor}. 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 until a paired ruling follows it. Both read only the entries the default
needs-scoring-run repeats as `Still standing:` until a paired ruling follows it. Both read only the entries the default
branch's history lacks.
Each record is appended to the history, created when missing, under a heading of the current UTC
@@ -79,14 +83,14 @@ 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, 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, 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
from rank_todo import ITEMS_HEADER
from file_writes import replace_file
USAGE = "usage: larv-review ruling-base | round-count | needs-scoring-run [<item ID>...] | record-ruling <seats file> | record-scoring <seats file>"
USAGE = "usage: larv-review ruling-base | round-count | needs-scoring-run [<item ID>...] | record-ruling <seats file> | record-scoring <seats file> [<item ID>...]"
def main(argv: list[str]) -> int:
@@ -102,10 +106,10 @@ def main(argv: list[str]) -> int:
done = with_default_branch(lambda default: needs_scoring_run(default, [int(id_) for id_ in given]), stale_ok=False)
elif command == "record-ruling" and len(given) == 1:
done = record_ruling(pathlib.Path(given[0]))
elif command == "record-scoring" and len(given) == 1:
done = with_default_branch(lambda default: record_scoring(default, pathlib.Path(given[0])), stale_ok=True)
elif command == "needs-scoring-run":
print(f"needs-scoring-run takes item IDs, the numbers in todo.md's ID column: {' '.join(given)}", file=sys.stderr)
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)
return 1
elif not argv:
print(USAGE, file=sys.stderr)
@@ -156,6 +160,20 @@ def round_count(default: str) -> Failure | None:
def needs_scoring_run(default: str, ids: list[int]) -> Failure | None:
recorded = chunk_history(default)
if isinstance(recorded, Failure):
return recorded
reasons = due_reasons(default, ids, pending_fall(recorded))
if isinstance(reasons, Failure):
return reasons
print(f"Scoring run due: the chunk {' and '.join(reasons)}." if reasons else "No scoring run due.")
if ratchet := standing_ratchet(recorded):
print(f"Still standing: {ratchet} Fix it and rule again.")
return None
def due_reasons(default: str, ids: list[int], fell: list[str]) -> list[str] | Failure:
"""Why the chunk is due a scoring run, from the default branch's plan and the checkout's."""
checkout = top()
if isinstance(checkout, Failure):
return checkout
@@ -176,16 +194,7 @@ def needs_scoring_run(default: str, ids: list[int]) -> Failure | None:
landed = landed_since_release(default)
if isinstance(landed, Failure):
return landed
recorded = chunk_history(default)
if isinstance(recorded, Failure):
return recorded
reasons = scoring_run_due(planned, chunk, ids, landed, pending_fall(recorded))
if isinstance(reasons, Failure):
return reasons
print(f"Scoring run due: the chunk {' and '.join(reasons)}." if reasons else "No scoring run due.")
if ratchet := standing_ratchet(recorded):
print(f"Still standing: {ratchet} Fix it and rule again.")
return None
return scoring_run_due(planned, chunk, ids, landed, fell)
def chunk_history(default: str) -> list[Entry] | Failure:
@@ -208,19 +217,19 @@ def record_ruling(seats_file: pathlib.Path) -> Failure | None:
if isinstance(said, Failure):
return said
count = counted(given.seats, said)
tally = ", ".join(f"{seat.name} {vote_text(said[seat.name][-1], count[seat.name][-1])}" for seat in given.seats)
tally = ", ".join(f"{seat.name} {vote_text(DIMENSIONS[-1], said[seat.name][-1], count[seat.name][-1])}" for seat in given.seats)
ruled = ruling([each[-1] for each in count.values()])
if ruled is None:
print(f"Split: {tally}. Launch the maintainability senior and Junior A together, add their lines to the seats file, and run this again.")
return None
fell = fallen(count)
fell = fallen(count) if ruled != "worse" else []
print(f"Ruling: {ruled}. Overall votes as counted: {tally}.")
if ruled != "worse" and fell:
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}.")
return append(ruling_entry(title, given.seats, said, count, ruled, fell))
def record_scoring(default: str, seats_file: pathlib.Path) -> Failure | None:
def record_scoring(default: str, seats_file: pathlib.Path, ids: list[int]) -> Failure | None:
read = read_seats(seats_file, paired=False)
if isinstance(read, Failure):
return read
@@ -232,11 +241,13 @@ def record_scoring(default: str, seats_file: pathlib.Path) -> Failure | None:
if isinstance(moved, Failure):
return moved
mean = means(list(found.values()) or [moved])
under = under_floor(mean)
print(f"Means: {', '.join(f'{name} {value}' for name, value in zip(DIMENSIONS, mean))}. {f'Under the floor of {FLOOR}: ' + ', '.join(under) if under else f'None under the floor of {FLOOR}'}.")
recorded = chunk_history(default)
if isinstance(recorded, Failure):
return recorded
blocking = due_reasons(default, ids, [])
if isinstance(blocking, Failure):
return blocking
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:
print(outcome[0])