Split metric-bench's main into run_scores and measured, find the checkout from the history, drop an ambiguous shortened path, write places from the repository root, and give item 85 the history's reader

This commit is contained in:
2026-10-08 21:35:54 +02:00
parent 382472bd39
commit 8a2dbd70f1
7 changed files with 56 additions and 38 deletions
+4 -5
View File
@@ -57,14 +57,13 @@ def bullet_places(bullet: str) -> list[Place]:
def resolved(places: list[Place], tracked: list[str]) -> list[Place]:
"""Seats shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one sharing most of the path resolved before it; a place naming no tracked file is dropped."""
"""Seats shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place resolved before it; a place naming no file, or several, is dropped."""
found = []
before = ""
for place in places:
candidates = [path for path in tracked if path == place.path or path.endswith("/" + place.path)]
if len(candidates) > 1:
candidates = [max(candidates, key=lambda path: len(os.path.commonprefix([path, before])))]
if candidates:
before = candidates[0]
nearest = [path for path in candidates if path.startswith(os.path.dirname(before) + "/")] if len(candidates) > 1 else candidates
if len(nearest) == 1:
before = nearest[0]
found.append(Place(before, place.name))
return found