diff --git a/bin/chunk_pick.py b/bin/chunk_pick.py index 024b3a93..a6855d28 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 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 + + @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,53 @@ 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)) + upcoming = next_release(found, cut) + return standing(upcoming, 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(found: list[Item], cut: LastCut) -> Upcoming | Cut | Unknown: + """The next release after cut, and whether work has landed towards it. found holds the plan's items. - 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 - if tagged is None: - return Next(earliest, first) - cut_version = tuple(int(part) for part in tagged.groups()) + 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() - 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): - 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): + 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 version_of(tag: str | None | Failure) -> tuple[int, int, int] | 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]) + + +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 upcoming, the next release. first is next_item's pick, which the pick holds where it is Next. + + Unknown where the next release holds no item and the unreleased changes cannot be counted. + """ + if upcoming.is_earliest: + return Next(upcoming.release, first) + 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..c61f2776 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 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 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 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") + # 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..a11c2faa 100644 --- a/bin/test_chunk_pick.py +++ b/bin/test_chunk_pick.py @@ -9,39 +9,78 @@ 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 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", 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", (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(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([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), 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.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), 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, 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): + 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" @@ -56,16 +95,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 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.