Answer stability round 1: 0 🔴, 2 🟡 (0 misread); read non-ASCII paths with numstat -z, and say on stderr when a chunk's details cannot be read

This commit is contained in:
2026-11-08 23:16:15 +01:00
parent 8a62df6bf5
commit b18e63653c
5 changed files with 31 additions and 17 deletions
+10 -5
View File
@@ -46,9 +46,12 @@ L, E and I, as rank_todo.py does, and lists the 5 finished items whose guesses s
first: the least mean squared difference over the scores both hold, so R and S alone for an item
scored before L, E and I, the newest first among equals. Each line gives what the item's chunk
measured, which items shipped with it, and its tagline. Where the item's tagline or detail names
tracked files or folders, each in backticks such as `bin/rank_todo.py`, the line gives their size
before the chunk beside the item's S: how many files and their lines, which bound what the change
could touch.
tracked files or folders in backticks, each by its path from the repository root such as
`bin/rank_todo.py`, the line also gives their size after the item's scores: how many files they
held before the chunk, and how many lines. A named folder counts the files it holds. This is the
size of the code the item said it would change; the chunk's change may reach beyond it. Where the
todo.md a chunk started from holds a ## Details section that cannot be read, it says so on stderr
and sizes that chunk's items by their taglines alone.
Then the project's anchors, the shipped items its docs/score-anchors.md names for each level of L,
E and I, read from the checkout's working tree, each line as above, or that no chunk shipped it. A
@@ -184,13 +187,15 @@ def read_results(default: str) -> list[Result] | Failure:
if isinstance(plan, Failure):
return plan
found = item_details(plan)
if isinstance(found, Failure):
print(f"score-outcomes: the todo.md before {chunk.label} cannot be read for its details, so its items are sized by their taglines alone: {found.reason}", file=sys.stderr)
details = {} if isinstance(found, Failure) else found
tracked = run("ls-tree", "-r", "-z", "--name-only", chunk.before)
if isinstance(tracked, Failure):
return tracked
# Only the files the items name, since counting every file's lines for every chunk doubles the run.
# Count only the files the items name, since counting every file's lines for every chunk doubles the run.
named = list(dict.fromkeys(path for item in chunk.shipped for path in named_files(item_text(item, details), tracked.split("\0")[:-1])))
tree = run("--literal-pathspecs", "diff", "--numstat", empty_tree.strip(), chunk.before, "--", *named) if named else ""
tree = run("--literal-pathspecs", "diff", "--numstat", "-z", empty_tree.strip(), chunk.before, "--", *named) if named else ""
if isinstance(tree, Failure):
return tree
results += results_of(chunk, numstat, details, file_lines(tree))