Answer product-owner round 1: 1 🔴, 1 🟡 (0 misread); label the named files' size apart from the lines changed, and file the S scale as question item 277

This commit is contained in:
2026-11-08 23:19:32 +01:00
parent 8a184c97ae
commit 71653b2069
5 changed files with 25 additions and 11 deletions
+2 -2
View File
@@ -47,8 +47,8 @@ first: the least mean squared difference over the scores both hold, so R and S a
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 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
`bin/rank_todo.py`, the line also gives their size, after the later fixes: how many files they
are, and how many lines they held before the chunk. 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.
+8 -3
View File
@@ -152,12 +152,17 @@ def ranks(values: list[int]) -> list[float]:
def render(result: Result) -> str:
scores = ", ".join(f"{name} {result.item.scores[name]}" for name in SHOWN if name in result.item.scores)
if result.named:
scores += f", naming code of {plural(result.named.lines, 'line')} in {plural(result.named.files, 'file')}"
merged = {"merge": f"merged {result.merged} in {result.merge}", "rebase": f"merged {result.merged} by rebase in {result.merge}", "push": f"committed {result.merged} in {result.merge}, never replayed, so perhaps part of a pull request"}[result.landing]
others = result.shipped_with
together = f", with item{'s' if len(others) > 1 else ''} {', '.join(map(str, others))}" if others else ""
return f"- Item {result.item.id}, {scores}: {plural(result.lines, 'line')} in {plural(result.files, 'file')}, {at_least(result)}{plural(result.rounds_past_first, 'round')} past each pass's first, {counted(result)}, {later(result)}; {merged}{together}. {result.item.tagline}"
return f"- Item {result.item.id}, {scores}: {plural(result.lines, 'line')} in {plural(result.files, 'file')}, {at_least(result)}{plural(result.rounds_past_first, 'round')} past each pass's first, {counted(result)}, {later(result)}{named(result)}; {merged}{together}. {result.item.tagline}"
def named(result: Result) -> str:
"""The size of the code the item names, labelled apart from the lines its chunk changed, which S is checked against."""
if result.named is None:
return ""
return f", and the {plural(result.named.files, 'file')} it names held {plural(result.named.lines, 'line')} before"
def at_least(result: Result) -> str:
+4 -4
View File
@@ -116,9 +116,9 @@ class Render(unittest.TestCase):
self.assertEqual(render(result(4, 2, 3, 4, findings=(1, 2))), "- Item 4, R 2, S 3, C 4: 10 lines in 1 file, 1 round past each pass's first, 1 🔴, 2 🟡, 0 later fixes; merged 2026-10-13T10:00:00Z in aaaaaaa. **Item 4.**")
self.assertIn("1 round past each pass's first, 0 🔴, 0 🟡, 0 later fixes; merged 2026-10-13T10:00:00Z in aaaaaaa, with item 5. ", render(result(4, 2, 3, 4, rounds=1, shipped_with=(5,))))
def test_gives_the_size_of_the_code_the_item_names_after_its_scores(self):
self.assertTrue(render(result(4, 2, 3, 4, named=NamedCode(2, 40))).startswith("- Item 4, R 2, S 3, C 4, naming code of 40 lines in 2 files: 10 lines in 1 file,"))
self.assertTrue(render(result(4, 2, 3, None, named=NamedCode(1, 1))).startswith("- Item 4, R 2, S 3, naming code of 1 line in 1 file: 10 lines"))
def test_gives_the_size_of_the_code_the_item_names_after_what_its_chunk_measured(self):
self.assertIn("- Item 4, R 2, S 3, C 4: 10 lines in 1 file, 1 round past each pass's first, 0 🔴, 0 🟡, 0 later fixes, and the 2 files it names held 40 lines before; merged ", render(result(4, 2, 3, 4, named=NamedCode(2, 40))))
self.assertIn("0 later fixes, and the 1 file it names held 1 line before; merged ", render(result(4, 2, 3, None, named=NamedCode(1, 1))))
def test_counts_the_later_fixes_of_the_chunk_that_shipped_it(self):
self.assertIn("0 🔴, 0 🟡, 1 later fix; merged", render(result(4, 2, 3, None, fixed_by=("bbbbbbb",))))
@@ -333,7 +333,7 @@ class ScoreOutcomesTool(unittest.TestCase):
self.git("merge", "-q", "--no-ff", "-m", "Merge chunk", "chunk")
ran = self.run_tool("1", "2", "1", "3")
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("- Item 4, R 2, S 3, C 10, naming code of 5 lines in 2 files: 1 line in 1 file, ", ran.stdout)
self.assertIn("- Item 4, R 2, S 3, C 10: 1 line in 1 file, 0 rounds past each pass's first, findings unknown, 0 later fixes, and the 2 files it names held 5 lines before; merged ", ran.stdout)
def test_says_on_stderr_when_a_chunks_details_cannot_be_read_and_sizes_its_items_by_their_taglines(self):
self.commit("Break the details", {"todo.md": todo(FIRST, SECOND) + "\n## Details\n\nloose text\n\n### 4. Do it.\n\nChange `a.py`.\n", "a.py": "1\n"})