Answer stability round 1: 1 🔴, 3 🟡; read chunks by one pure function, and skip chunks that never changed todo.md

This commit is contained in:
2026-10-21 17:02:21 +02:00
parent 3d51ebc5df
commit 58939766d3
4 changed files with 51 additions and 22 deletions
+4 -2
View File
@@ -15,6 +15,8 @@ NOT_WORK = ("todo.md", HISTORY, RECORD)
# How a chunk reached the default branch; rebase and push leave no merge commit to bound it.
Landing = typing.Literal["merge", "rebase", "push"]
# A chunk's first and last commit as short hashes, its commit time, and how it reached the default branch.
Chunk = tuple[str, str, int, Landing]
@dataclasses.dataclass(frozen=True)
@@ -28,7 +30,7 @@ class Outcome:
files: int
rounds_past_first: int
findings: tuple[int, int] | None
landed: Landing = "merge"
landed: Landing
# An outcome's name and how to read it from an Outcome, None where the chunk did not record it.
@@ -50,7 +52,7 @@ def shipped(before: str, after: str) -> list[Item]:
return sorted((item for item in planned if item.id not in kept), key=lambda item: item.id)
def outcomes_of(shipped: list[Item], merge: str, merged: str, numstat: str, titles: list[str], landed: Landing = "merge") -> list[Outcome]:
def outcomes_of(shipped: list[Item], merge: str, merged: str, numstat: str, titles: list[str], landed: Landing) -> list[Outcome]:
"""What one chunk measured for each item it shipped, from `git diff --numstat` against the commit before it and its commit titles; none where it changed nothing but the plan and the records."""
changed = [row.split("\t", 2) for row in numstat.splitlines()]
work = [row for row in changed if len(row) == 3 and row[2] not in NOT_WORK]