Answer prose round 1: 0 🔴, 5 🟡; say what landed_towards returns and fails on, point --help at it, reword the changelog entry and two test names, and leave the README as it was

This commit is contained in:
2026-10-22 02:07:24 +02:00
parent 68c44f3128
commit 31fb1a0093
5 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -7,7 +7,7 @@ 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 unreleased changes have 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. 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.
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.
"""
@@ -25,16 +25,16 @@ 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 release that unreleased changes on the default branch landed towards."""
"""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."""
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 unreleased changes on the default branch have landed towards: the next release, as chunk-preflight names it (`chunk_pick.chunk_item`), where it holds items and `chunk_pick.unreleased_changes` counts one or more. None otherwise; a Failure where either cannot be read. found is the default branch's plan."""
"""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 from the default branch's tags and todo.md history")
# Only Next names a release a chunk can empty after work landed: Cut's is already cut, and Finished's and Unplanned's hold no item.
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):
return None
changes = unreleased_changes(cut)