Answer architecture round 5: return the heading as a dataclass, read the Mean line as its own field, mark an entry paired explicitly, move metric-bench's path resolution back to metric_bench, and split the scoring trigger into named steps
This commit is contained in:
+15
-12
@@ -8,10 +8,10 @@ branch, or else the local main or master, as the default branch. When the fetch
|
||||
reads origin as last fetched and says so on stderr; the other two exit 1. The history is
|
||||
docs/comprehension-history.md in the checkout.
|
||||
|
||||
ruling-base prints the commit a paired ruling reads against, then a line saying how it found it.
|
||||
The base 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 one change
|
||||
against its first parent. With no such change, the base is the one the history's first paired
|
||||
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
|
||||
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 <n> among the titles opening
|
||||
@@ -73,7 +73,7 @@ import typing
|
||||
from larv_review.history import appended, heading, ruling_entry, scoring_entry, vote_text
|
||||
from larv_review.rules import base, CAP, FLOOR, means, PASSES, plan_items, round_counts, ruling, scoring_run_due, 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, scores
|
||||
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
|
||||
@@ -128,13 +128,13 @@ def ruling_base(default: str) -> Failure | None:
|
||||
history = file_at(default, HISTORY)
|
||||
if isinstance(history, Failure):
|
||||
return history
|
||||
if found := base(changes, history, default):
|
||||
if found := base(changes, history):
|
||||
print("\n".join(found))
|
||||
return None
|
||||
merge_base = git("merge-base", "HEAD", default)
|
||||
if isinstance(merge_base, Failure):
|
||||
return merge_base
|
||||
print(f"{merge_base.strip()}\nNo merged change on {default} adds a scoring run or a paired ruling; the merge base of HEAD and {default}.")
|
||||
print(f"{merge_base.strip()}\nthe merge base of HEAD and {default}")
|
||||
return None
|
||||
|
||||
|
||||
@@ -197,10 +197,13 @@ def record_scoring(seats_file: pathlib.Path) -> Failure | None:
|
||||
if isinstance(read, Failure):
|
||||
return read
|
||||
title, given = read
|
||||
found = scores(given.seats)
|
||||
found = scores(given.seats) if given.moved_mean is None else {}
|
||||
if isinstance(found, Failure):
|
||||
return found
|
||||
mean = means(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])
|
||||
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}'}.")
|
||||
return append(scoring_entry(title, given.seats, found, [str(value) for value in mean]))
|
||||
@@ -214,12 +217,12 @@ def read_seats(seats_file: pathlib.Path, paired: bool) -> tuple[str, Report] | F
|
||||
return Failure(f"could not read {seats_file}: {failure}")
|
||||
if isinstance(given, Failure):
|
||||
return given
|
||||
named = heading(time.time(), given.read, paired, [seat.name for seat in given.seats] == [MEAN])
|
||||
named = heading(time.time(), given.read, paired, given.moved_mean is not None)
|
||||
if isinstance(named, Failure):
|
||||
return named
|
||||
if unknown := [commit for commit in named.group(3, 4) if commit and not commit_exists(commit)]:
|
||||
if unknown := [commit for commit in (named.commit, named.against) if commit and not commit_exists(commit)]:
|
||||
return Failure(f"the seats file names {', '.join(unknown)}, which is no commit in this checkout")
|
||||
return named.group(0), given
|
||||
return named.title, given
|
||||
|
||||
|
||||
def append(entry: str) -> Failure | None:
|
||||
|
||||
Reference in New Issue
Block a user