Bench a shipped feature whose branch landed by fast-forward from the commits after the item shipped before it
CI / tests (pull_request) Failing after 4m50s

This commit is contained in:
2026-11-24 02:09:49 +01:00
parent 6f5839479a
commit 280f7521d0
5 changed files with 78 additions and 32 deletions
+38 -15
View File
@@ -92,6 +92,22 @@ class ShippedFeaturesCase(BenchOfTasksCase):
self.env.pop(name, None)
def fast_forwarded_item_11(self):
"""Item 11 lands as a fast-forward leaves a branch: a plan commit, the feature and the commit that takes the item out, each
with the time it was written at, so each is a chunk of its own to branch_chunks. The head leaves the default branch after."""
self.git("checkout", "--quiet", "main")
self.plan(11)
self.landed(6, "Plan an item", written_then=True)
(self.repo / "third.go").write_text("package calc\n")
(self.repo / "third_test.go").write_text("test -e third.go\n")
self.landed(7, "Add Third", written_then=True)
self.plan()
self.landed(8, "Finish item 11 in the plan", written_then=True)
self.git("checkout", "--quiet", "-B", "item-1")
(self.repo / "calc.go").write_text(HEAD_CODE)
self.commit("Head")
class ShippedFeatureBenchTest(ShippedFeaturesCase):
def test_has_haiku_rebuild_each_shipped_feature_from_its_tagline_and_checks_it_with_the_tests_its_change_added(self):
report = self.bench()
@@ -175,23 +191,13 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase):
self.assertEqual(report.reason, "No shipped feature on the base's history counts; the lines above say why.")
self.assertIn("task-bench: passed over the shipped feature item 8: its revert doesn't apply at the head.", self.progress.getvalue().splitlines())
def test_passes_over_a_feature_whose_branch_landed_by_fast_forward(self):
# Each commit keeps the time it was written at, so the commit that takes the item out is a chunk of its own.
self.git("checkout", "--quiet", "main")
self.plan(11)
self.landed(6, "Plan an item")
(self.repo / "third.go").write_text("package calc\n")
(self.repo / "third_test.go").write_text("test -e third.go\n")
self.landed(7, "Add Third", written_then=True)
self.plan()
self.landed(8, "Finish item 11 in the plan", written_then=True)
# The bench's base is where the head left the default branch, so the head leaves it after item 11.
self.git("checkout", "--quiet", "-B", "item-1")
(self.repo / "calc.go").write_text(HEAD_CODE)
self.commit("Head")
def test_rebuilds_a_feature_whose_branch_landed_by_fast_forward_from_the_commits_after_the_item_shipped_before_it(self):
self.fast_forwarded_item_11()
report = self.bench(**{"--shipped": "1"})
self.assertNotIsInstance(report, Failure, report)
self.assertEqual(report[1], "Passed over the shipped feature item 11: its branch landed by fast-forward, so the history doesn't say which commits built it.")
# Nothing is passed over, and the feature has a row at each side.
self.assertEqual(report[1], "")
self.assertEqual([line[:23] for line in report if line.startswith("| 1: item 11")], ["| 1: item 11 | base | 0", "| 1: item 11 | head | 0"])
def test_fails_before_docker_runs_where_the_history_shipped_no_item(self):
self.git("branch", "--quiet", "--force", "main", "main~8")
@@ -221,6 +227,23 @@ class ReadShippedTest(ShippedFeaturesCase):
])
self.assertEqual(shipped.records, ["todo.md", "decisions.md", "score-anchors.md", "docs/comprehension-history.md", "docs/reading-cost.md", "changelog.md"])
def test_a_fast_forwarded_feature_starts_after_the_chunk_that_shipped_the_item_before_it(self):
self.fast_forwarded_item_11()
newest = self.read().found[0]
self.assertEqual((newest.name, newest.before, newest.tip), ("item 11", self.git("rev-parse", "main~3"), self.git("rev-parse", "main")))
def test_a_fast_forwarded_feature_with_no_item_shipped_before_it_has_no_start(self):
self.git("checkout", "--quiet", "--orphan", "fresh")
self.git("rm", "--quiet", "-r", "-f", ".")
self.plan(11)
self.landed(1, "Plan an item", written_then=True)
(self.repo / "third.go").write_text("package calc\n")
self.landed(2, "Add Third", written_then=True)
self.plan()
self.landed(3, "Finish item 11 in the plan", written_then=True)
self.git("branch", "--quiet", "--force", "main", "fresh")
self.assertEqual([(feature.name, feature.before) for feature in self.read().found], [("item 11", None)])
def test_a_chunk_that_shipped_two_items_is_one_feature_told_by_both_taglines(self):
self.git("checkout", "--quiet", "main")
self.plan(7, 8)