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:
2026-10-09 01:44:53 +02:00
parent efed78bf5e
commit c1133edf39
9 changed files with 143 additions and 92 deletions
+4 -4
View File
@@ -34,10 +34,10 @@ import statistics
import subprocess
import sys
from metric_bench.bench import bench, co_changed, medians, METRICS, RunScores, Score
from metric_bench.bench import bench, co_changed, medians, METRICS, resolved, RunScores, Score
from larv_review.history import entries, Entry
from failure import Failure
from metric_bench.python_units import measured, python_units, Unit
from larv_review.history import resolved, scoring_runs, ScoringRun
def main(argv: list[str]) -> int:
@@ -81,7 +81,7 @@ def bench_runs(text: str, top: str) -> tuple[list[tuple[str, RunScores]], list[s
"""Each scored run's heading and scores, and a note for each run skipped or not scored and each file left out."""
rows = []
notes = []
for run in scoring_runs(text):
for run in [entry for entry in entries(text) if not entry.paired]:
if isinstance(missing := git(["cat-file", "-e", f"{run.commit}^{{commit}}"], top), Failure):
notes.append(f"Skipped, its commit is not in {top}: {run.heading} ({missing.reason})")
continue
@@ -101,7 +101,7 @@ def noted(notes: list[str]) -> str:
return "\n\n" + "\n".join(notes) if notes else ""
def run_scores(run: ScoringRun, top: str) -> tuple[RunScores | None, list[str]] | Failure:
def run_scores(run: Entry, top: str) -> tuple[RunScores | None, list[str]] | Failure:
"""The run's scores, and why each file that does not parse was left out."""
listed = git(["ls-tree", "-r", "-z", "--name-only", run.commit], top)
if isinstance(listed, Failure):