From 20c231457d59e1ce1184afc801fb25385d39675a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 21:10:41 +0200 Subject: [PATCH 1/5] Compute the next release, and whether work has landed towards it, in one function that chunk_pick and larv-review's scoring trigger share --- bin/chunk_pick.py | 61 +++++++++++++++-------- bin/chunk_preflight/choices.py | 6 +-- bin/larv_review/plan.py | 27 ++++++----- bin/larv_review/test_larv_review.py | 7 ++- bin/test_chunk_pick.py | 75 +++++++++++++++++++++-------- docs/reading-cost.md | 4 ++ todo.md | 2 +- 7 files changed, 124 insertions(+), 58 deletions(-) diff --git a/bin/chunk_pick.py b/bin/chunk_pick.py index 024b3a93..95c6de2f 100644 --- a/bin/chunk_pick.py +++ b/bin/chunk_pick.py @@ -4,7 +4,7 @@ import re from git_repo import commits_since, file_at, git, newest_release_tag from failure import Failure -from todo_table import Item, items, next_item, renames +from todo_table import Item, items, next_item, release_of, renames from markdown_text import sections @dataclasses.dataclass(frozen=True) @@ -20,9 +20,20 @@ class LastCut: todos_since: list[str] | Failure +@dataclasses.dataclass(frozen=True) +class Upcoming: + """The next release, and whether work has landed towards it, as `~/.claude/CLAUDE.md` → "Working loop" uses both.""" + # The earliest release after the last cut that todo.md has named since that cut or the plan holds; without a cut, the plan's earliest. None where there is none. + release: tuple[int, int, int] | None + # Whether work has landed towards it: one or more changes are unreleased, as unreleased_changes counts them. + landed: bool | Failure + # The last cut's version x.y.z, None where the newest v* tag names none. + cut: tuple[int, int, int] | None + + @dataclasses.dataclass(frozen=True) class Next: - """The plan's earliest release is the next release: the earliest after the last cut that todo.md has named since that cut. Without a cut, the plan's earliest release is the next.""" + """The plan's earliest release is the next release.""" # None where the plan holds no item. release: tuple[int, int, int] | None # The item the next chunk takes first, next_item's pick; None where every item waits or the plan holds none. @@ -36,15 +47,15 @@ class Cut: @dataclasses.dataclass(frozen=True) -class Finished: - """The next release holds no item, and changes are unreleased.""" +class ReadyToCut: + """The next release holds no item, and work has landed towards it.""" # The next release, None where todo.md has named none since the cut. release: tuple[int, int, int] | None @dataclasses.dataclass(frozen=True) class Unplanned: - """The next release holds no item, and no change is unreleased.""" + """The next release holds no item, and no work has landed towards it.""" # The next release, None where todo.md has named none since the cut. release: tuple[int, int, int] | None @@ -54,8 +65,8 @@ class Unknown: """todo.md's texts since the cut, or the changes since it, cannot be read.""" -# How the plan stands to the last cut, the version x.y.z the newest v* tag names, with the item the next chunk takes first where there is one. -Pick = Next | Cut | Finished | Unplanned | Unknown +# How the plan stands to the last cut, with the item the next chunk takes first where there is one. +Pick = Next | Cut | ReadyToCut | Unplanned | Unknown @dataclasses.dataclass(frozen=True) @@ -91,29 +102,41 @@ def todos_since(tag: str | None | Failure, ref: str, cwd: str) -> list[str] | Fa def chunk_item(found: list[Item], cut: LastCut) -> Pick: """The pick from todo.md's items, weighed against the last cut. Routing and chunk-preflight both pick with it, so they name one item.""" - return standing(cut.tag, unreleased_changes(cut), min((item.release for item in found), default=None), next_item(found), named_releases(cut.todos_since)) + earliest = min((item.release for item in found), default=None) + upcoming = next_release(cut, earliest) + return standing(upcoming, earliest, next_item(found)) if isinstance(upcoming, Upcoming) else upcoming -def standing(tag: str | None | Failure, changes: int | Failure, earliest: tuple[int, int, int] | None, first: Item | None, named: set[tuple[int, int, int]] | Failure) -> Pick: - """How the plan stands to tag, the newest v* tag. +def next_release(cut: LastCut, earliest: tuple[int, int, int] | None) -> Upcoming | Cut | Unknown: + """The next release after cut, and whether work has landed towards it. earliest is the plan's earliest release, None where the plan holds no item. - earliest is the plan's earliest release, None where the plan holds no item, and first is next_item's pick. changes counts the unreleased changes. named holds each release todo.md named since the tag. + Cut where the plan files items under the last cut's version or earlier, and Unknown where todo.md's texts since the cut cannot be read. """ - tagged = re.fullmatch(r"v([0-9]+)\.([0-9]+)\.([0-9]+)", tag) if isinstance(tag, str) else None + tagged = re.fullmatch(r"v([0-9]+\.[0-9]+\.[0-9]+)", cut.tag) if isinstance(cut.tag, str) else None + changes = unreleased_changes(cut) + landed = changes if isinstance(changes, Failure) else changes > 0 if tagged is None: - return Next(earliest, first) - cut_version = tuple(int(part) for part in tagged.groups()) + return Upcoming(earliest, landed, None) + cut_version = release_of(tagged[1]) if earliest is not None and earliest <= cut_version: return Cut(earliest) + named = named_releases(cut.todos_since) if isinstance(named, Failure): return Unknown() - first_named = min((release for release in named if release > cut_version), default=None) - if earliest is not None and (first_named is None or earliest <= first_named): + after = {release for release in named if release > cut_version} | ({earliest} if earliest is not None else set()) + return Upcoming(min(after, default=None), landed, cut_version) + + +def standing(upcoming: Upcoming, earliest: tuple[int, int, int] | None, first: Item | None) -> Next | ReadyToCut | Unplanned | Unknown: + """How the plan stands to the next release, upcoming. earliest is the plan's earliest release, None where the plan holds no item, and first is next_item's pick. + + Without a cut, or where the plan's earliest release is the next, the next chunk takes first. Else the next release holds no item, and is ready to cut once work has landed towards it, or else to plan. + """ + if upcoming.cut is None or (earliest is not None and earliest == upcoming.release): return Next(earliest, first) - # The plan's earliest release is past the next release, or the plan holds none: the next release holds no item. - if isinstance(changes, Failure): + if isinstance(upcoming.landed, Failure): return Unknown() - return Finished(first_named) if changes else Unplanned(first_named) + return ReadyToCut(upcoming.release) if upcoming.landed else Unplanned(upcoming.release) def unreleased_changes(cut: LastCut) -> int | Failure: diff --git a/bin/chunk_preflight/choices.py b/bin/chunk_preflight/choices.py index db531dff..9796495b 100644 --- a/bin/chunk_preflight/choices.py +++ b/bin/chunk_preflight/choices.py @@ -2,7 +2,7 @@ import pathlib import re -from chunk_pick import chunk_item, Cut, Finished, LastCut, Unknown, Unplanned +from chunk_pick import chunk_item, Cut, LastCut, ReadyToCut, Unknown, Unplanned from failure import Failure from chunk_preflight.gathered import Forge, NoItem, Plan from todo_table import item_details, items, NoItemsTable, version @@ -26,9 +26,9 @@ def planned(todo: str | Failure, cut: LastCut, default: str) -> Plan | NoItem: return NoItem(f"{where} files items under release {version(pick.release)}, which is not after the last cut, {cut.tag}; ask the human which release they belong to.") if isinstance(pick, Unknown): return NoItem(f"{where} may hold no item for the next release after the last cut, {cut.tag}: todo.md's texts since then, or the count of changes since then, cannot be read. Find the next release yourself.") - if isinstance(pick, Finished | Unplanned): + if isinstance(pick, ReadyToCut | Unplanned): upcoming = f"release {version(pick.release)}, the next after the last cut, {cut.tag}" if pick.release else f"the next release after the last cut, {cut.tag}" - if isinstance(pick, Finished): + if isinstance(pick, ReadyToCut): return NoItem(f"{where} holds no item for {upcoming}, and changes are unreleased, so that release is finished and ready to cut. The working loop stops here. If todo.md renamed that release instead, add `- renamed to ` to todo.md's `## Renamed` section.") return NoItem(f"{where} holds no item for {upcoming}, and no change is unreleased, so that release is to be planned first.") first = pick.item diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index 798bc8d4..b064c8e1 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -1,15 +1,17 @@ import pathlib -from chunk_pick import chunk_item, default_plan, LastCut, Next, Unknown, unreleased_changes +from chunk_pick import Cut, default_plan, LastCut, next_release, Unknown from failure import Failure from todo_table import Item, items, NoItemsTable, renames, version from git_repo import top def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed: tuple[int, int, int] | None, renamed: set[tuple[int, int, int]]) -> list[str] | Failure: - """Why the plan calls a scoring run, empty when it does not. before is the default branch's plan, after the chunk's, ships the IDs of the items the chunk ships, landed the release that unreleased changes landed towards (`landed_towards`), and renamed the releases the chunk's plan marks renamed. + """Why the plan calls a scoring run, empty when it does not. A chunk that ships an item naming the floor is due one, so it can prove the floor met. So is a chunk that empties a release after work has landed towards it, so no release ends unmeasured. A release the chunk's plan marks renamed is due none. + + before is the default branch's plan and after the chunk's. ships holds the IDs of the items the chunk ships. landed is the next release where work has landed towards it, else None (`landed_towards`). renamed holds the releases the chunk's plan marks renamed. """ plan = {item.id: item for item in before + after} if unknown := sorted(set(ships) - set(plan)): @@ -25,22 +27,21 @@ def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], lan # larv-review --help points here rather than restating the rule, so the rule is written once. def work_landed(release: tuple[int, int, int], shipped: list[Item], landed: tuple[int, int, int] | None) -> bool: - """Whether work has landed towards release, for the scoring-run trigger. It has when the chunk ships one of the release's items. It has too when release is the one `landed_towards` names.""" + """Whether work has landed towards release, for the scoring-run trigger. It has when the chunk ships one of the release's items. It has too when release is landed, the next release where work landed on the default branch.""" return any(item.release == release for item in shipped) or release == landed def landed_towards(found: list[Item], cut: LastCut) -> tuple[int, int, int] | None | Failure: - """The release that unreleased changes on the default branch have landed towards, None where there is none. It is the next release, as chunk-preflight names it (`chunk_pick.chunk_item`), once `chunk_pick.unreleased_changes` counts one or more changes. A Failure where chunk_item's pick is Unknown, or is Next and the count cannot be read. found is the default branch's plan.""" - pick = chunk_item(found, cut) - if isinstance(pick, Unknown): - return Failure("could not tell the next release: the default branch's todo.md history or its unreleased changes cannot be read") - # Only Next names a release a chunk can empty after work landed: Cut's is the last cut's version or earlier, and Finished's and Unplanned's hold no item. - if not isinstance(pick, Next): + """The next release where work has landed towards it on the default branch, as `chunk_pick.next_release` tells both; None where there is none, or work has not landed. found is the default branch's plan.""" + upcoming = next_release(cut, min((item.release for item in found), default=None)) + if isinstance(upcoming, Unknown): + return Failure("could not tell the next release: the default branch's todo.md history cannot be read") + # Cut's release is the last cut's version or earlier, so no work lands towards it. + if isinstance(upcoming, Cut): return None - changes = unreleased_changes(cut) - if isinstance(changes, Failure): - return changes - return pick.release if changes else None + if isinstance(upcoming.landed, Failure): + return Failure(f"could not tell whether work landed towards the next release: {upcoming.landed.reason}") + return upcoming.release if upcoming.landed else None def emptied(before: list[Item], after: list[Item], shipped: list[Item], renamed: set[tuple[int, int, int]]) -> list[tuple[int, int, int]]: diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index e60a2baf..b2f426d8 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -323,11 +323,16 @@ class LandedTowards(unittest.TestCase): self.assertEqual(landed_towards(plan, LastCut("v0.1.0", "", 3, [])), (0, 2, 0)) self.assertEqual(landed_towards(plan, LastCut(None, "", 0, [])), None) - def test_names_no_release_unless_chunk_preflight_names_a_next_release_with_items(self): + def test_names_no_release_where_the_plan_files_items_under_the_last_cut_or_names_none_after_it(self): changelog = "# Changelog\n\n## Unreleased\n\n- Did a thing.\n" self.assertIsNone(landed_towards([item(1, (0, 1, 0))], LastCut("v0.1.0", changelog, 0, []))) self.assertIsNone(landed_towards([], LastCut("v0.1.0", changelog, 0, [""]))) + def test_names_the_next_release_where_the_plan_holds_no_item_for_it(self): + named = "| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |\n|---|---|---|---|---|---|---|---|---|---|---|---|\n| 1 | 0.2.0 | | | **Do 1.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |\n" + changelog = "# Changelog\n\n## Unreleased\n\n- Did a thing.\n" + self.assertEqual(landed_towards([item(2, (0, 3, 0))], LastCut("v0.1.0", changelog, 0, [f"## Items\n\n{named}"])), (0, 2, 0)) + def test_fails_where_the_changes_or_the_next_release_cannot_be_read(self): plan = [item(1, (0, 2, 0))] self.assertIsInstance(landed_towards(plan, LastCut("v0.1.0", Failure("unreadable"), Failure("count unreadable"), [])), Failure) diff --git a/bin/test_chunk_pick.py b/bin/test_chunk_pick.py index 7d599d0b..f7b6bb72 100644 --- a/bin/test_chunk_pick.py +++ b/bin/test_chunk_pick.py @@ -1,3 +1,4 @@ +import dataclasses import pathlib import sys import unittest @@ -9,8 +10,46 @@ from failure import Failure import todo_table -class Standing(unittest.TestCase): - def test_takes_the_earliest_release_where_it_is_the_earliest_named_since_the_last_cut_and_names_the_next_release(self): +HEADER = "## Items\n\n| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |\n|---|---|---|---|---|---|---|---|---|---|---|---|\n" +ROW = "| {id} | {release} | | | **Do {id}.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |\n" + + +def naming(named: set[tuple[int, int, int]] | Failure) -> list[str] | Failure: + """LastCut.todos_since holding one todo.md text that files an item under each release in named.""" + if isinstance(named, Failure): + return named + return [HEADER + "".join(ROW.format(id=id_, release=todo_table.version(release)) for id_, release in enumerate(sorted(named), 1))] + + +def planned(earliest: tuple[int, int, int] | None) -> list[todo_table.Item]: + return [] if earliest is None else [todo_table.Item(1, earliest, "", "**Do 1.**", {}, (), ())] + + +class NextRelease(unittest.TestCase): + def test_names_the_earliest_release_after_the_last_cut_that_todo_md_named_since_it_or_the_plan_holds(self): + cases = ( + ("v1.2.3", (1, 3, 0), {(1, 2, 4), (1, 3, 0)}, chunk_pick.Upcoming((1, 2, 4), True, (1, 2, 3))), + ("v1.2.3", (1, 2, 4), {(1, 3, 0)}, chunk_pick.Upcoming((1, 2, 4), True, (1, 2, 3))), + ("v1.2.3", None, {(1, 2, 2), (1, 3, 0)}, chunk_pick.Upcoming((1, 3, 0), True, (1, 2, 3))), + ("v1.2.3", None, set(), chunk_pick.Upcoming(None, True, (1, 2, 3))), + (None, (0, 2, 0), set(), chunk_pick.Upcoming((0, 2, 0), True, None)), + ("v1.2.3-rc.1", (1, 2, 3), set(), chunk_pick.Upcoming((1, 2, 3), True, None)), + ("v1.2.3", (1, 2, 3), Failure("log unreadable"), chunk_pick.Cut((1, 2, 3))), + ("v1.2.3", (1, 3, 0), Failure("log unreadable"), chunk_pick.Unknown()), + ) + for tag, earliest, named, upcoming in cases: + with self.subTest(tag=tag, earliest=earliest, named=named): + self.assertEqual(chunk_pick.next_release(chunk_pick.LastCut(tag, "", 4, naming(named)), earliest), upcoming) + + def test_says_work_has_landed_towards_it_where_a_change_is_unreleased(self): + cut = lambda changes: chunk_pick.LastCut("v1.2.3", "", changes, naming({(1, 3, 0)})) + self.assertEqual(chunk_pick.next_release(cut(4), (1, 3, 0)), chunk_pick.Upcoming((1, 3, 0), True, (1, 2, 3))) + self.assertEqual(chunk_pick.next_release(cut(0), (1, 3, 0)), chunk_pick.Upcoming((1, 3, 0), False, (1, 2, 3))) + self.assertEqual(chunk_pick.next_release(cut(Failure("count unreadable")), (1, 3, 0)), chunk_pick.Upcoming((1, 3, 0), Failure("count unreadable"), (1, 2, 3))) + + +class ChunkItem(unittest.TestCase): + def test_takes_the_earliest_release_where_it_is_the_next_and_else_says_whether_the_next_is_ready_to_cut_or_to_plan(self): cases = ( ("v1.2.3", 4, (1, 2, 4), set(), chunk_pick.Next((1, 2, 4), None)), ("v1.2.3", 4, (1, 3, 0), {(1, 3, 0)}, chunk_pick.Next((1, 3, 0), None)), @@ -23,25 +62,23 @@ class Standing(unittest.TestCase): (Failure("tags unreadable"), 4, (0, 2, 0), set(), chunk_pick.Next((0, 2, 0), None)), ("v1.2.3", 4, (1, 2, 3), set(), chunk_pick.Cut((1, 2, 3))), ("v1.2.3", 4, (1, 2, 2), {(1, 2, 4)}, chunk_pick.Cut((1, 2, 2))), - ("v1.2.3", 4, (1, 3, 0), {(1, 2, 4), (1, 3, 0)}, chunk_pick.Finished((1, 2, 4))), - ("v0.9.2", 4, (1, 0, 0), {(0, 9, 3)}, chunk_pick.Finished((0, 9, 3))), - ("v1.2.3", 4, (1, 4, 0), {(1, 2, 2), (1, 3, 0)}, chunk_pick.Finished((1, 3, 0))), - ("v1.2.3", 4, None, {(1, 3, 0)}, chunk_pick.Finished((1, 3, 0))), - ("v1.2.3", 4, None, set(), chunk_pick.Finished(None)), + ("v1.2.3", 4, (1, 3, 0), {(1, 2, 4), (1, 3, 0)}, chunk_pick.ReadyToCut((1, 2, 4))), + ("v0.9.2", 4, (1, 0, 0), {(0, 9, 3)}, chunk_pick.ReadyToCut((0, 9, 3))), + ("v1.2.3", 4, (1, 4, 0), {(1, 2, 2), (1, 3, 0)}, chunk_pick.ReadyToCut((1, 3, 0))), + ("v1.2.3", 4, None, {(1, 3, 0)}, chunk_pick.ReadyToCut((1, 3, 0))), + ("v1.2.3", 4, None, set(), chunk_pick.ReadyToCut(None)), ("v1.2.3", 0, (1, 3, 0), {(1, 2, 4)}, chunk_pick.Unplanned((1, 2, 4))), ("v1.2.3", 0, None, set(), chunk_pick.Unplanned(None)), ("v1.2.3", Failure("count unreadable"), None, set(), chunk_pick.Unknown()), + ("v1.2.3", Failure("count unreadable"), (1, 3, 0), {(1, 3, 0)}, chunk_pick.Next((1, 3, 0), None)), ("v1.2.3", 4, (1, 3, 0), Failure("log unreadable"), chunk_pick.Unknown()), ("v1.2.3", 4, (1, 2, 3), Failure("log unreadable"), chunk_pick.Cut((1, 2, 3))), ) - for tag, landed, earliest, named, stands in cases: - with self.subTest(tag=tag, landed=landed, earliest=earliest, named=named): - self.assertEqual(chunk_pick.standing(tag, landed, earliest, None, named), stands) - - def test_takes_the_first_item_only_where_the_earliest_release_is_next(self): - first = todo_table.Item(1, (1, 2, 4), "", "**Do 1.**", {}, (), ()) - self.assertEqual(chunk_pick.standing("v1.2.3", 4, (1, 2, 4), first, set()), chunk_pick.Next((1, 2, 4), first)) - self.assertEqual(chunk_pick.standing("v1.2.3", 4, (1, 2, 3), first, set()), chunk_pick.Cut((1, 2, 3))) + for tag, changes, earliest, named, stands in cases: + with self.subTest(tag=tag, changes=changes, earliest=earliest, named=named): + found = planned(earliest) + first = found[0] if earliest is not None and stands == chunk_pick.Next(earliest, None) else None + self.assertEqual(chunk_pick.chunk_item(found, chunk_pick.LastCut(tag, "", changes, naming(named))), dataclasses.replace(stands, item=first) if first else stands) def test_counts_the_changes_unreleased_since_the_last_cut_by_unreleased_entries_and_else_by_commits(self): changelog = "# Changelog\n\n## Unreleased\n\n- One.\n - A nested line.\n- Two.\n\n## 0.1.0\n\n- Old.\n" @@ -56,16 +93,12 @@ class Standing(unittest.TestCase): self.assertIsNone(chunk_pick.unreleased_entries("# Changelog\n\n## 0.1.0\n\n- Old.\n")) def test_names_each_release_a_todo_md_since_the_last_cut_filed_items_under(self): - row = "| {id} | {release} | | | **Do {id}.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |\n" - header = "## Items\n\n| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |\n|---|---|---|---|---|---|---|---|---|---|---|---|\n" - texts = [header + row.format(id=1, release="0.2.0"), "", "not a table | x |", header + row.format(id=2, release="0.3.0")] + texts = [HEADER + ROW.format(id=1, release="0.2.0"), "", "not a table | x |", HEADER + ROW.format(id=2, release="0.3.0")] self.assertEqual(chunk_pick.named_releases(texts), {(0, 2, 0), (0, 3, 0)}) self.assertEqual(chunk_pick.named_releases(Failure("log unreadable")), Failure("log unreadable")) def test_leaves_out_a_release_the_plan_marks_renamed_and_keeps_one_whose_items_moved_unmarked(self): - row = "| {id} | {release} | | | **Do {id}.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |\n" - header = "## Items\n\n| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |\n|---|---|---|---|---|---|---|---|---|---|---|---|\n" - plan = lambda *rows, renamed=(): header + "".join(row.format(id=id_, release=release) for id_, release in rows) + ("\n## Renamed\n\n" + "".join(f"- {old} renamed to {new}\n" for old, new in renamed) if renamed else "") + plan = lambda *rows, renamed=(): HEADER + "".join(ROW.format(id=id_, release=release) for id_, release in rows) + ("\n## Renamed\n\n" + "".join(f"- {old} renamed to {new}\n" for old, new in renamed) if renamed else "") cases = ( ("renamed", [plan((1, "0.2.1")), plan((1, "0.3.0"), renamed=[("0.2.1", "0.3.0")])], {(0, 3, 0)}), ("deferred: its items moved without a mark", [plan((1, "0.2.1"), (2, "0.3.0")), plan((1, "0.3.0"), (2, "0.3.0"))], {(0, 2, 1), (0, 3, 0)}), diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 87619da7..0b7b2429 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -787,3 +787,7 @@ Read most (opens and searches): - `skills/larv-review/SKILL.md` 3 - `rules/todo-items.md` 2 + +## Reading cost, chunk fc21489c7990, finished 2026-10-22T18:57:09Z + +55808 new input tokens before the first commit. diff --git a/todo.md b/todo.md index bd71a082..a872fced 100644 --- a/todo.md +++ b/todo.md @@ -349,7 +349,7 @@ The key names the project's session, archive folder and models entry. `project_k ### 155. Lower the reading cost of the files a chunk reads most before its first commit. -`bin/reading-cost` on 2026-10-22: the median of the last 5 chunks is 73,910 new input tokens before their first commit, up from 63,554 for the 5 before them. Its list of the files read most over the last 5 was empty, so the chunk that takes this item first finds which files those chunks read. The chunk that ships this item runs `bin/reading-cost --reset`. +`bin/reading-cost` on 2026-10-22, at item 213's chunk: the median of the last 5 chunks is 81,812 new input tokens before their first commit, up from 71,637 for the 5 before them. The files those 5 chunks opened or searched most were `skills/larv-review/SKILL.md`, 3 times, and `rules/todo-items.md`, twice. The chunk that ships this item runs `bin/reading-cost --reset`. ### 51. Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints. -- 2.52.0 From f690eb24779d8ce99bcfb6dddca62eec59f6ef1e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 21:15:07 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Answer=20principles=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=204=20=F0=9F=9F=A1;=20have=20next=5Frelease=20tak?= =?UTF-8?q?e=20the=20plan's=20items=20and=20spell=20out=20each=20expected?= =?UTF-8?q?=20pick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/chunk_pick.py | 52 +++++++++++++++++++++++--------------- bin/larv_review/plan.py | 4 +-- bin/test_chunk_pick.py | 56 +++++++++++++++++++++-------------------- 3 files changed, 63 insertions(+), 49 deletions(-) diff --git a/bin/chunk_pick.py b/bin/chunk_pick.py index 95c6de2f..4eb3edb0 100644 --- a/bin/chunk_pick.py +++ b/bin/chunk_pick.py @@ -25,10 +25,10 @@ class Upcoming: """The next release, and whether work has landed towards it, as `~/.claude/CLAUDE.md` → "Working loop" uses both.""" # The earliest release after the last cut that todo.md has named since that cut or the plan holds; without a cut, the plan's earliest. None where there is none. release: tuple[int, int, int] | None + # Whether it is the plan's earliest release, as it always is without a cut, even where the plan holds no item. + is_earliest: bool # Whether work has landed towards it: one or more changes are unreleased, as unreleased_changes counts them. landed: bool | Failure - # The last cut's version x.y.z, None where the newest v* tag names none. - cut: tuple[int, int, int] | None @dataclasses.dataclass(frozen=True) @@ -102,38 +102,50 @@ def todos_since(tag: str | None | Failure, ref: str, cwd: str) -> list[str] | Fa def chunk_item(found: list[Item], cut: LastCut) -> Pick: """The pick from todo.md's items, weighed against the last cut. Routing and chunk-preflight both pick with it, so they name one item.""" - earliest = min((item.release for item in found), default=None) - upcoming = next_release(cut, earliest) - return standing(upcoming, earliest, next_item(found)) if isinstance(upcoming, Upcoming) else upcoming + upcoming = next_release(found, cut) + return standing(upcoming, next_item(found)) if isinstance(upcoming, Upcoming) else upcoming -def next_release(cut: LastCut, earliest: tuple[int, int, int] | None) -> Upcoming | Cut | Unknown: - """The next release after cut, and whether work has landed towards it. earliest is the plan's earliest release, None where the plan holds no item. +def next_release(found: list[Item], cut: LastCut) -> Upcoming | Cut | Unknown: + """The next release after cut, and whether work has landed towards it, for the plan whose items are found. Cut where the plan files items under the last cut's version or earlier, and Unknown where todo.md's texts since the cut cannot be read. """ - tagged = re.fullmatch(r"v([0-9]+\.[0-9]+\.[0-9]+)", cut.tag) if isinstance(cut.tag, str) else None - changes = unreleased_changes(cut) - landed = changes if isinstance(changes, Failure) else changes > 0 - if tagged is None: - return Upcoming(earliest, landed, None) - cut_version = release_of(tagged[1]) + earliest = min((item.release for item in found), default=None) + cut_version = version_of(cut.tag) + if cut_version is None: + return Upcoming(earliest, True, landed(cut)) if earliest is not None and earliest <= cut_version: return Cut(earliest) named = named_releases(cut.todos_since) if isinstance(named, Failure): return Unknown() - after = {release for release in named if release > cut_version} | ({earliest} if earliest is not None else set()) - return Upcoming(min(after, default=None), landed, cut_version) + after = {release for release in named if release > cut_version} + if earliest is not None: + after.add(earliest) + release = min(after, default=None) + return Upcoming(release, earliest is not None and earliest == release, landed(cut)) -def standing(upcoming: Upcoming, earliest: tuple[int, int, int] | None, first: Item | None) -> Next | ReadyToCut | Unplanned | Unknown: - """How the plan stands to the next release, upcoming. earliest is the plan's earliest release, None where the plan holds no item, and first is next_item's pick. +def version_of(tag: str | None | Failure) -> tuple[int, int, int] | None: + """The version x.y.z that tag, the newest v* tag, names; None where it names none.""" + tagged = re.fullmatch(r"v([0-9]+\.[0-9]+\.[0-9]+)", tag) if isinstance(tag, str) else None + return None if tagged is None else release_of(tagged[1]) - Without a cut, or where the plan's earliest release is the next, the next chunk takes first. Else the next release holds no item, and is ready to cut once work has landed towards it, or else to plan. + +def landed(cut: LastCut) -> bool | Failure: + """Whether work has landed since cut: one or more changes are unreleased.""" + changes = unreleased_changes(cut) + return changes if isinstance(changes, Failure) else changes > 0 + + +def standing(upcoming: Upcoming, first: Item | None) -> Next | ReadyToCut | Unplanned | Unknown: + """How the plan stands to the next release, upcoming, with first, next_item's pick. + + Where the next release is the plan's earliest, the pick is Next, holding first. Else the next release holds no item: it is ready to cut once work has landed towards it, and else it is to plan. """ - if upcoming.cut is None or (earliest is not None and earliest == upcoming.release): - return Next(earliest, first) + if upcoming.is_earliest: + return Next(upcoming.release, first) if isinstance(upcoming.landed, Failure): return Unknown() return ReadyToCut(upcoming.release) if upcoming.landed else Unplanned(upcoming.release) diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index b064c8e1..6cccaf70 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -32,8 +32,8 @@ def work_landed(release: tuple[int, int, int], shipped: list[Item], landed: tupl def landed_towards(found: list[Item], cut: LastCut) -> tuple[int, int, int] | None | Failure: - """The next release where work has landed towards it on the default branch, as `chunk_pick.next_release` tells both; None where there is none, or work has not landed. found is the default branch's plan.""" - upcoming = next_release(cut, min((item.release for item in found), default=None)) + """The next release on the default branch, once work has landed towards it; None where there is none, or work has not landed. `chunk_pick.next_release` tells the next release and whether work landed. found is the default branch's plan.""" + upcoming = next_release(found, cut) if isinstance(upcoming, Unknown): return Failure("could not tell the next release: the default branch's todo.md history cannot be read") # Cut's release is the last cut's version or earlier, so no work lands towards it. diff --git a/bin/test_chunk_pick.py b/bin/test_chunk_pick.py index f7b6bb72..a11c2faa 100644 --- a/bin/test_chunk_pick.py +++ b/bin/test_chunk_pick.py @@ -1,4 +1,3 @@ -import dataclasses import pathlib import sys import unittest @@ -21,45 +20,50 @@ def naming(named: set[tuple[int, int, int]] | Failure) -> list[str] | Failure: return [HEADER + "".join(ROW.format(id=id_, release=todo_table.version(release)) for id_, release in enumerate(sorted(named), 1))] -def planned(earliest: tuple[int, int, int] | None) -> list[todo_table.Item]: - return [] if earliest is None else [todo_table.Item(1, earliest, "", "**Do 1.**", {}, (), ())] +def one(release: tuple[int, int, int]) -> todo_table.Item: + """The plan's only item, filed under release.""" + return todo_table.Item(1, release, "", "**Do 1.**", {}, (), ()) + + +def plan_under(earliest: tuple[int, int, int] | None) -> list[todo_table.Item]: + """A plan holding one item under earliest, or none where earliest is None.""" + return [] if earliest is None else [one(earliest)] class NextRelease(unittest.TestCase): def test_names_the_earliest_release_after_the_last_cut_that_todo_md_named_since_it_or_the_plan_holds(self): cases = ( - ("v1.2.3", (1, 3, 0), {(1, 2, 4), (1, 3, 0)}, chunk_pick.Upcoming((1, 2, 4), True, (1, 2, 3))), - ("v1.2.3", (1, 2, 4), {(1, 3, 0)}, chunk_pick.Upcoming((1, 2, 4), True, (1, 2, 3))), - ("v1.2.3", None, {(1, 2, 2), (1, 3, 0)}, chunk_pick.Upcoming((1, 3, 0), True, (1, 2, 3))), - ("v1.2.3", None, set(), chunk_pick.Upcoming(None, True, (1, 2, 3))), - (None, (0, 2, 0), set(), chunk_pick.Upcoming((0, 2, 0), True, None)), - ("v1.2.3-rc.1", (1, 2, 3), set(), chunk_pick.Upcoming((1, 2, 3), True, None)), - ("v1.2.3", (1, 2, 3), Failure("log unreadable"), chunk_pick.Cut((1, 2, 3))), - ("v1.2.3", (1, 3, 0), Failure("log unreadable"), chunk_pick.Unknown()), + ("v1.2.3", (1, 3, 0), {(1, 2, 4), (1, 3, 0)}, chunk_pick.Upcoming((1, 2, 4), False, True)), + ("v1.2.3", (1, 2, 4), {(1, 3, 0)}, chunk_pick.Upcoming((1, 2, 4), True, True)), + ("v1.2.3", None, {(1, 2, 2), (1, 3, 0)}, chunk_pick.Upcoming((1, 3, 0), False, True)), + ("v1.2.3", None, set(), chunk_pick.Upcoming(None, False, True)), + (None, (0, 2, 0), set(), chunk_pick.Upcoming((0, 2, 0), True, True)), + (None, None, set(), chunk_pick.Upcoming(None, True, True)), + ("v1.2.3-rc.1", (1, 2, 3), set(), chunk_pick.Upcoming((1, 2, 3), True, True)), ) for tag, earliest, named, upcoming in cases: with self.subTest(tag=tag, earliest=earliest, named=named): - self.assertEqual(chunk_pick.next_release(chunk_pick.LastCut(tag, "", 4, naming(named)), earliest), upcoming) + self.assertEqual(chunk_pick.next_release(plan_under(earliest), chunk_pick.LastCut(tag, "", 4, naming(named))), upcoming) def test_says_work_has_landed_towards_it_where_a_change_is_unreleased(self): cut = lambda changes: chunk_pick.LastCut("v1.2.3", "", changes, naming({(1, 3, 0)})) - self.assertEqual(chunk_pick.next_release(cut(4), (1, 3, 0)), chunk_pick.Upcoming((1, 3, 0), True, (1, 2, 3))) - self.assertEqual(chunk_pick.next_release(cut(0), (1, 3, 0)), chunk_pick.Upcoming((1, 3, 0), False, (1, 2, 3))) - self.assertEqual(chunk_pick.next_release(cut(Failure("count unreadable")), (1, 3, 0)), chunk_pick.Upcoming((1, 3, 0), Failure("count unreadable"), (1, 2, 3))) + self.assertEqual(chunk_pick.next_release([one((1, 3, 0))], cut(4)), chunk_pick.Upcoming((1, 3, 0), True, True)) + self.assertEqual(chunk_pick.next_release([one((1, 3, 0))], cut(0)), chunk_pick.Upcoming((1, 3, 0), True, False)) + self.assertEqual(chunk_pick.next_release([one((1, 3, 0))], cut(Failure("count unreadable"))), chunk_pick.Upcoming((1, 3, 0), True, Failure("count unreadable"))) class ChunkItem(unittest.TestCase): def test_takes_the_earliest_release_where_it_is_the_next_and_else_says_whether_the_next_is_ready_to_cut_or_to_plan(self): cases = ( - ("v1.2.3", 4, (1, 2, 4), set(), chunk_pick.Next((1, 2, 4), None)), - ("v1.2.3", 4, (1, 3, 0), {(1, 3, 0)}, chunk_pick.Next((1, 3, 0), None)), - ("v1.2.3", 4, (1, 2, 4), {(1, 3, 0)}, chunk_pick.Next((1, 2, 4), None)), - ("v1.2.3", 4, (1, 3, 0), {(1, 2, 3), (1, 3, 0)}, chunk_pick.Next((1, 3, 0), None)), - ("v0.2.0", 4, (0, 4, 0), set(), chunk_pick.Next((0, 4, 0), None)), - (None, 4, (0, 2, 0), set(), chunk_pick.Next((0, 2, 0), None)), + ("v1.2.3", 4, (1, 2, 4), set(), chunk_pick.Next((1, 2, 4), one((1, 2, 4)))), + ("v1.2.3", 4, (1, 3, 0), {(1, 3, 0)}, chunk_pick.Next((1, 3, 0), one((1, 3, 0)))), + ("v1.2.3", 4, (1, 2, 4), {(1, 3, 0)}, chunk_pick.Next((1, 2, 4), one((1, 2, 4)))), + ("v1.2.3", 4, (1, 3, 0), {(1, 2, 3), (1, 3, 0)}, chunk_pick.Next((1, 3, 0), one((1, 3, 0)))), + ("v0.2.0", 4, (0, 4, 0), set(), chunk_pick.Next((0, 4, 0), one((0, 4, 0)))), + (None, 4, (0, 2, 0), set(), chunk_pick.Next((0, 2, 0), one((0, 2, 0)))), (None, 4, None, set(), chunk_pick.Next(None, None)), - ("v1.2.3-rc.1", 4, (1, 2, 3), set(), chunk_pick.Next((1, 2, 3), None)), - (Failure("tags unreadable"), 4, (0, 2, 0), set(), chunk_pick.Next((0, 2, 0), None)), + ("v1.2.3-rc.1", 4, (1, 2, 3), set(), chunk_pick.Next((1, 2, 3), one((1, 2, 3)))), + (Failure("tags unreadable"), 4, (0, 2, 0), set(), chunk_pick.Next((0, 2, 0), one((0, 2, 0)))), ("v1.2.3", 4, (1, 2, 3), set(), chunk_pick.Cut((1, 2, 3))), ("v1.2.3", 4, (1, 2, 2), {(1, 2, 4)}, chunk_pick.Cut((1, 2, 2))), ("v1.2.3", 4, (1, 3, 0), {(1, 2, 4), (1, 3, 0)}, chunk_pick.ReadyToCut((1, 2, 4))), @@ -70,15 +74,13 @@ class ChunkItem(unittest.TestCase): ("v1.2.3", 0, (1, 3, 0), {(1, 2, 4)}, chunk_pick.Unplanned((1, 2, 4))), ("v1.2.3", 0, None, set(), chunk_pick.Unplanned(None)), ("v1.2.3", Failure("count unreadable"), None, set(), chunk_pick.Unknown()), - ("v1.2.3", Failure("count unreadable"), (1, 3, 0), {(1, 3, 0)}, chunk_pick.Next((1, 3, 0), None)), + ("v1.2.3", Failure("count unreadable"), (1, 3, 0), {(1, 3, 0)}, chunk_pick.Next((1, 3, 0), one((1, 3, 0)))), ("v1.2.3", 4, (1, 3, 0), Failure("log unreadable"), chunk_pick.Unknown()), ("v1.2.3", 4, (1, 2, 3), Failure("log unreadable"), chunk_pick.Cut((1, 2, 3))), ) for tag, changes, earliest, named, stands in cases: with self.subTest(tag=tag, changes=changes, earliest=earliest, named=named): - found = planned(earliest) - first = found[0] if earliest is not None and stands == chunk_pick.Next(earliest, None) else None - self.assertEqual(chunk_pick.chunk_item(found, chunk_pick.LastCut(tag, "", changes, naming(named))), dataclasses.replace(stands, item=first) if first else stands) + self.assertEqual(chunk_pick.chunk_item(plan_under(earliest), chunk_pick.LastCut(tag, "", changes, naming(named))), stands) def test_counts_the_changes_unreleased_since_the_last_cut_by_unreleased_entries_and_else_by_commits(self): changelog = "# Changelog\n\n## Unreleased\n\n- One.\n - A nested line.\n- Two.\n\n## 0.1.0\n\n- Old.\n" -- 2.52.0 From aa8b12b89651cd40fdf0f0cfc93bfa42c06fe591 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 21:16:14 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Answer=20principles=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1;=20approved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From a6fb79dabbc6d73f2e3f89c84b57c3a6c7611a41 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 21:24:57 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1;=20define=20work=20landing=20i?= =?UTF-8?q?n=20landed=5Ftowards=20again=20and=20reword=20the=20docstrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/chunk_pick.py | 10 +++++----- bin/larv_review/plan.py | 4 ++-- todo.md | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/chunk_pick.py b/bin/chunk_pick.py index 4eb3edb0..a6855d28 100644 --- a/bin/chunk_pick.py +++ b/bin/chunk_pick.py @@ -25,7 +25,7 @@ class Upcoming: """The next release, and whether work has landed towards it, as `~/.claude/CLAUDE.md` → "Working loop" uses both.""" # The earliest release after the last cut that todo.md has named since that cut or the plan holds; without a cut, the plan's earliest. None where there is none. release: tuple[int, int, int] | None - # Whether it is the plan's earliest release, as it always is without a cut, even where the plan holds no item. + # Whether it is the plan's earliest release. Without a cut, it always is, even where the plan holds no item. is_earliest: bool # Whether work has landed towards it: one or more changes are unreleased, as unreleased_changes counts them. landed: bool | Failure @@ -107,7 +107,7 @@ def chunk_item(found: list[Item], cut: LastCut) -> Pick: def next_release(found: list[Item], cut: LastCut) -> Upcoming | Cut | Unknown: - """The next release after cut, and whether work has landed towards it, for the plan whose items are found. + """The next release after cut, and whether work has landed towards it. found holds the plan's items. Cut where the plan files items under the last cut's version or earlier, and Unknown where todo.md's texts since the cut cannot be read. """ @@ -128,7 +128,7 @@ def next_release(found: list[Item], cut: LastCut) -> Upcoming | Cut | Unknown: def version_of(tag: str | None | Failure) -> tuple[int, int, int] | None: - """The version x.y.z that tag, the newest v* tag, names; None where it names none.""" + """The version x.y.z named by tag, the newest v* tag; None where it names none.""" tagged = re.fullmatch(r"v([0-9]+\.[0-9]+\.[0-9]+)", tag) if isinstance(tag, str) else None return None if tagged is None else release_of(tagged[1]) @@ -140,9 +140,9 @@ def landed(cut: LastCut) -> bool | Failure: def standing(upcoming: Upcoming, first: Item | None) -> Next | ReadyToCut | Unplanned | Unknown: - """How the plan stands to the next release, upcoming, with first, next_item's pick. + """How the plan stands to upcoming, the next release. first is next_item's pick, which the pick holds where it is Next. - Where the next release is the plan's earliest, the pick is Next, holding first. Else the next release holds no item: it is ready to cut once work has landed towards it, and else it is to plan. + Unknown where the next release holds no item and the unreleased changes cannot be counted. """ if upcoming.is_earliest: return Next(upcoming.release, first) diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index 6cccaf70..c61f2776 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -27,12 +27,12 @@ def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], lan # larv-review --help points here rather than restating the rule, so the rule is written once. def work_landed(release: tuple[int, int, int], shipped: list[Item], landed: tuple[int, int, int] | None) -> bool: - """Whether work has landed towards release, for the scoring-run trigger. It has when the chunk ships one of the release's items. It has too when release is landed, the next release where work landed on the default branch.""" + """Whether work has landed towards release, for the scoring-run trigger. It has when the chunk ships one of the release's items. It has too when release equals landed: the default branch's next release, once work has landed towards it.""" return any(item.release == release for item in shipped) or release == landed def landed_towards(found: list[Item], cut: LastCut) -> tuple[int, int, int] | None | Failure: - """The next release on the default branch, once work has landed towards it; None where there is none, or work has not landed. `chunk_pick.next_release` tells the next release and whether work landed. found is the default branch's plan.""" + """The next release on the default branch, once work has landed towards it: once one or more changes are unreleased, as `chunk_pick.unreleased_changes` counts them. None where there is no next release, or no change is unreleased. found is the default branch's plan.""" upcoming = next_release(found, cut) if isinstance(upcoming, Unknown): return Failure("could not tell the next release: the default branch's todo.md history cannot be read") diff --git a/todo.md b/todo.md index a872fced..d36861b7 100644 --- a/todo.md +++ b/todo.md @@ -349,7 +349,7 @@ The key names the project's session, archive folder and models entry. `project_k ### 155. Lower the reading cost of the files a chunk reads most before its first commit. -`bin/reading-cost` on 2026-10-22, at item 213's chunk: the median of the last 5 chunks is 81,812 new input tokens before their first commit, up from 71,637 for the 5 before them. The files those 5 chunks opened or searched most were `skills/larv-review/SKILL.md`, 3 times, and `rules/todo-items.md`, twice. The chunk that ships this item runs `bin/reading-cost --reset`. +`bin/reading-cost` on 2026-10-22: the median of the last 5 chunks is 81,812 new input tokens before their first commit, up from 71,637 for the 5 before them. The files those 5 chunks opened or searched most were `skills/larv-review/SKILL.md`, 3 times, and `rules/todo-items.md`, twice. The chunk that ships this item runs `bin/reading-cost --reset`. ### 51. Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints. -- 2.52.0 From 277a52f0cb32cb29e02104e94a0607715273e1ea Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 21:28:42 +0200 Subject: [PATCH 5/5] Remove item 213 from the plan --- todo.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/todo.md b/todo.md index a5f1ea5d..81e0b816 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 213 | 0.4.0 | | | **Compute the next release, and whether work has landed towards it, in one function that both `chunk_pick.standing` and `larv_review/plan.py`'s `scoring_run_due` call.** | 3 | 2 | 3 | 6 | 3 | code health by 9 | 40.4 | | 137 | 0.4.0 | | | **Archive a chunk's route as a record loop-claude reads back field by field, in place of the `Worker:` prose `ROUTED` parses, and name `stepped` and the judge's `bundled` by what they do.** | 4 | 2 | 3 | 7 | 4 | code health by 9, 1.4 by 9 | 32.9 | | 211 | 0.4.0 | | | **State each routing rule once, in the docstring of the code that enforces it, and cut `loop-claude --help`'s routing paragraph to what the human running the loop needs.** | 2 | 2 | 1 | 3 | 4 | code health by 9, 1.4 by 9 | 32.9 | | 212 | 0.4.0 | | | **Split `review_launches` into a choice of each pass's rung, made in `bin/model_routing` beside `ladder.review_rungs`, and whole prompt sentences that render that choice.** | 2 | 2 | 3 | 5 | 4 | code health by 9 | 26.9 | @@ -77,10 +76,6 @@ ## Details -### 213. Compute the next release, and whether work has landed towards it, in one function that both `chunk_pick.standing` and `larv_review/plan.py`'s `scoring_run_due` call. - -Release 0.3.0's scoring runs named `bin/chunk_pick.py:97` `standing` at three seats (first run: PR #324 at c713910; rerun: PR #324 rerun at c713910). Inherited architect, first run: "'next release' is computed two ways, here and in larv_review/plan.py's scoring_run_due, which may diverge after a rename". Junior A, rerun: "two separate notions of the next release and of work having landed". This lowers Locality: changing what the next release is means changing both places, which may diverge. The seats also found `standing` itself hard: "five inputs, three of which may be Failure, produce five outcomes, the order of the Failure checks carrying meaning" (Maintainability senior, rerun), and `chunk_pick.Finished` "shares its name with judge.Finished" (Junior A, first run). Rename `chunk_pick.Finished`. Make `standing` and `scoring_run_due` easier to read. - ### 137. Archive a chunk's route as a record loop-claude reads back field by field, in place of the `Worker:` prose `ROUTED` parses, and name `stepped` and the judge's `bundled` by what they do. PR #262's paired ruling found the project reads worse: a rerun resumes on its rung only by parsing `Rung.__str__`'s and `Route.__str__`'s wording back with `bin/loop_claude/routing.py`'s `ROUTED`, a string contract over four files, where a reword silently routes afresh. Write the route as a structured line, such as JSON after `Worker:`, that `transcript_archive` reads into fields. `stepped` both raises to a bundled item's rung and counts towards a one-rung step, and release 0.3.0's Maintainability senior named `bin/loop_claude/routing.py:64` `stepped` for "seven one-line rung functions each defined by the others, four inputs held together, and an import cycle steering the interface" (rerun). `Reply.bundled` names neither L nor highest. Release 0.3.0's scoring runs found the same contract (first run: PR #324 at c713910; rerun: PR #324 rerun at c713910): `bin/model_routing/route.py:13` `ROUTED`, "parsed back by regexes in four places, so rewording one string silently changes routing" (Junior A, first run), and `:86` `Route.__str__`, "parsed back by ROUTED, routing_figures, reading_cost, score_outcomes and judge_replay" (inherited architect, rerun). That lowers Locality, the lowest dimension. Make `ROUTED`, `Route.__str__`, `stepped`, `Reply.bundled` and `bin/loop_claude/loop/main.py`'s `run_loop` easier to read. The structured line must keep the escalation's mark, archived today as `escalated at transcript entry N`: without it, a trigger that already stepped the worker could step it again. -- 2.52.0