diff --git a/bin/larv_review/main.py b/bin/larv_review/main.py index 28f9ca98..bd41c576 100644 --- a/bin/larv_review/main.py +++ b/bin/larv_review/main.py @@ -42,7 +42,7 @@ docs/decisions.md opts out of the comprehension check is never due one. scoring-run-owed prints `No scoring run owed.` or exits 1 naming the runs the chunk owes and has not recorded. chunk-pr merge runs it and refuses to merge on exit 1, so a due line read earlier in -the chunk can't stand in for it. It applies needs-scoring-run's rule to the branch as committed, against the +the chunk can't stand in for it. It applies needs-scoring-run's rule to the checkout's todo.md and the committed history, against the merge base with the default branch, so a default branch that has moved on adds nothing: the items the merge base's todo.md holds and the checkout's does not count as shipped. A chunk that empties a release owes two runs, any other due chunk one. The chunk has recorded the scoring runs that its diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index cf6fa332..5315285b 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -577,6 +577,10 @@ class LarvReviewTool(unittest.TestCase): self.git("rm", "-q", "todo.md") self.commit("Drop the plan") self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + (self.checkout / "todo.md").write_bytes(b"\xff\xfe") + self.git("add", "todo.md") + self.commit("Break the plan") + self.assertEqual(self.run_tool("scoring-run-owed").returncode, 1, "a plan that can't be read is no plan the gate may skip") def test_a_default_branch_that_moved_on_since_the_branch_began_adds_no_owed_run(self): self.git("switch", "-q", "main") @@ -586,6 +590,9 @@ class LarvReviewTool(unittest.TestCase): self.commit("Do some work") self.assertEqual(self.run_tool("needs-scoring-run").stdout, "No scoring run due.\n") self.assertEqual(self.run_tool("scoring-run-owed").stdout, "No scoring run owed.\n") + self.ship_item_1() + self.commit("Ship item 1 and record a run", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING.replace("PR #1", "PR #7")}) + self.assertIn("owes 2 scoring runs and the branch's committed history records 1:", self.run_tool("scoring-run-owed").stderr, "main's own run is no credit to the branch") def release(self, tag, date, files=None): """Cut tag on the default branch at a commit dated date."""