Add the project setting merge = "human", under which chunk-pr merge leaves the pull request ready and a do-epic chunk parks on your merge

This commit is contained in:
Lilleman
2026-11-19 15:51:44 +01:00
parent 017cf33611
commit e2f5661760
15 changed files with 240 additions and 58 deletions
+16 -3
View File
@@ -5,7 +5,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from do_epic.gates import APPROVAL, CHECKS, gate, Gate, NEW_REVIEW, Open
from do_epic.gates import APPROVAL, CHECKS, gate, Gate, MERGE, NEW_REVIEW, Open
from failure import Failure
WORKTREES = "worktree /code/billing\nHEAD aaa\nbranch refs/heads/main\n\nworktree /code/billing-ABC-21\nHEAD abc\nbranch refs/heads/ABC-21\n"
@@ -58,8 +58,8 @@ class Forge:
return Failure(f"{key} failed") if self.fails and key.startswith(self.fails) else self.answers[key]
return run
def gate(self) -> Gate | Open | Failure:
return gate("ABC-21", "/code/billing", self.at)
def gate(self, by_human: bool = False) -> Gate | Open | Failure:
return gate("ABC-21", "/code/billing", self.at, by_human)
class GateOfAChunk(unittest.TestCase):
@@ -72,6 +72,19 @@ class GateOfAChunk(unittest.TestCase):
self.assertIn(["gh", "pr", "checks", "7", "--json", "bucket"], forge.commands)
self.assertTrue(any(command[:3] == ["gh", "api", "graphql"] and "number=7" in command for command in forge.commands), forge.commands)
def test_where_a_person_merges_a_pull_request_with_nothing_else_to_wait_on_awaits_that_merge(self):
gitea = "https://gitea.larvit.se/o/billing.git"
for forge in (Forge(decision="APPROVED"), Forge(decision=""), Forge(gitea)):
with self.subTest(forge.answers["git remote"]):
self.assertEqual(forge.gate(by_human=True), Gate("/code/billing-ABC-21", "7", MERGE))
self.assertEqual(MERGE, "your merge")
def test_where_a_person_merges_every_other_gate_and_all_news_stay_as_they_are(self):
same = (Forge(), Forge(buckets=("pending",)), Forge(draft=True), Forge(decision="CHANGES_REQUESTED"), Forge(threads=(thread(False, "reviewer"),)), Forge(buckets=("fail",)), Forge(pulls=""))
for forge in same:
with self.subTest(forge.answers):
self.assertEqual(forge.gate(by_human=True), forge.gate())
def test_a_review_decision_gh_prints_in_no_known_shape_is_a_failure(self):
forge = Forge()
forge.answers["gh pr view"] = "[1]"