From 13d15502996afddb4470732c88de8fdfbdabf45a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 11 Nov 2026 00:11:20 +0100 Subject: [PATCH] Name plan_reasons' first argument ref, since it can be a commit, and pin the emptied-release words in SKILL.md --- bin/larv_review/plan.py | 12 ++++++------ bin/larv_review/test_larv_review.py | 5 ++++- bin/larv_review/unmeasured.py | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index 5d478e51..7a0a3607 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -63,17 +63,17 @@ def emptied(before: list[Item], after: list[Item], shipped: list[Item], renamed: return sorted(named - {item.release for item in kept} - renamed) -def plan_reasons(default: str, ids: list[int] | None) -> list[str] | Failure: - """Why the plan calls a scoring run, from the default branch's todo.md and the checkout's; empty where the project opts out of the comprehension check. Where ids is None, the chunk ships each item the default branch's plan holds and the checkout's does not.""" +def plan_reasons(ref: str, ids: list[int] | None) -> list[str] | Failure: + """Why the plan calls a scoring run, from todo.md at ref and the checkout's; empty where the project opts out of the comprehension check. ref is the default branch, or the commit where the chunk began. Where ids is None, the chunk ships each item the plan at ref holds and the checkout's does not.""" checkout = top() if isinstance(checkout, Failure): return checkout - decisions = file_at(default, "docs/decisions.md", checkout) + decisions = file_at(ref, "docs/decisions.md", checkout) if isinstance(decisions, Failure): return decisions if OPTED_OUT.search(decisions): return [] - held = default_plan(checkout, default) + held = default_plan(checkout, ref) before = held.todo if isinstance(before, Failure): return before @@ -86,14 +86,14 @@ def plan_reasons(default: str, ids: list[int] | None) -> list[str] | Failure: if isinstance(planned, NoItemsTable): planned = [] if isinstance(planned, Failure): - return Failure(f"{default}'s todo.md: {planned.reason}") + return Failure(f"{ref}'s todo.md: {planned.reason}") renamed = renames(after) if isinstance(renamed, Failure): return Failure(f"the checkout's todo.md: {renamed.reason}") landed_release = landed_towards(planned, held.cut) if isinstance(landed_release, Failure): return landed_release - unmeasured = unmeasured_cut(default, checkout) + unmeasured = unmeasured_cut(ref, checkout) if isinstance(unmeasured, Failure): return unmeasured if ids is None: diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 5315285b..194284de 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -12,7 +12,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from larv_review.agreement import agreement_report, ruling_agreement, run_agreement from review_rules.comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat -from larv_review.plan import checkout_plan, landed_towards, plan_reasons, scoring_run_due +from larv_review.plan import checkout_plan, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due from review_rules import comprehension_history from larv_review.ruling import counted, ruling, split, surplus, votes from larv_review.history_commands import decided @@ -427,6 +427,9 @@ class LandedTowards(unittest.TestCase): class Shortfall(unittest.TestCase): + def test_skill_md_names_the_words_that_end_the_reason_a_release_empties(self): + self.assertIn(EMPTIED_WORDS, (pathlib.Path(__file__).resolve().parents[2] / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8")) + def test_a_chunk_that_empties_a_release_owes_two_runs_and_any_other_reason_one(self): emptied = ["leaves release 0.1.0 with no plan item"] floor = ["ships item 2, which names the comprehension floor"] diff --git a/bin/larv_review/unmeasured.py b/bin/larv_review/unmeasured.py index 97890639..f20d32c0 100644 --- a/bin/larv_review/unmeasured.py +++ b/bin/larv_review/unmeasured.py @@ -8,7 +8,7 @@ from git_cli.git_repo import file_at, git def unmeasured_cut(default: str, checkout: str) -> str | None | Failure: """Whether the default branch's newest release was cut unmeasured, as `v0.7.0, cut with no scoring run since v0.6.0`. It was where no scoring run in the default branch's history is newer than the second-newest v* tag. None where the branch holds fewer than two such tags, or a run since the earlier one. - The reason ends once a run follows the earlier tag, so it asks only after a release was cut with none; it lets the chunk that finds the gap record the run (item 296 filed the gap after v0.5.0 to v0.7.0). + The reason ends once a run follows the earlier tag, so it asks only after a release was cut with none; it lets the chunk that finds the gap record the run. A scoring run counts by the time its history heading records, against the tag's commit time; a heading whose time doesn't parse counts for nothing, so the run is asked for again. """