Answer stability round 1: 0 🔴, 2 🟡 (0 misread); keep a finished chunk open until a person's merge is read and its worktree removed, and assert facts in place of sentences

This commit is contained in:
Lilleman
2026-11-19 18:07:54 +01:00
parent 2e0ceef6ae
commit 24bd382d48
7 changed files with 77 additions and 27 deletions
+3 -4
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, MERGE, NEW_REVIEW, Open
from do_epic.gates import APPROVAL, CHECKS, gate, Gate, MERGE, NEW_REVIEW, Open, Unopened
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"
@@ -77,8 +77,7 @@ class GateOfAChunk(unittest.TestCase):
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")
self.assertEqual(gate("ABC-21", "/code/billing", Forge(decision="APPROVED").at), Open("pull request #7 passed its checks and is approved"))
self.assertEqual(Forge(decision="APPROVED").gate(by_human=False), Open("pull request #7 passed its checks and is approved"))
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=""))
@@ -142,12 +141,12 @@ class GateOfAChunk(unittest.TestCase):
"a check on pull request 7 failed; fix it and push": Forge(buckets=("fail",)),
"a reviewer requested changes on pull request #7": Forge(decision="CHANGES_REQUESTED"),
"a reviewer's comment on pull request #7 waits for an answer, in a.py, b.py": Forge(threads=(thread(False, "reviewer", "b.py"), thread(False, "reviewer"), thread(True, "reviewer", "c.py"), thread(False, "worker", "d.py"))),
"no pull request from origin's ABC-21 is open at abcabcabcabc; it may be merged or closed already": Forge(pulls=""),
"no worktree of /code/billing has the branch ABC-21 checked out": Forge(worktrees="worktree /code/billing\nHEAD aaa\nbranch refs/heads/main\n"),
}
for news, forge in cases.items():
with self.subTest(news=news):
self.assertEqual(forge.gate(), Open(news))
self.assertEqual(Forge(pulls="").gate(), Unopened("no pull request from origin's ABC-21 is open at abcabcabcabc; it may be merged or closed already"))
def test_a_read_that_fails_is_a_failure_and_says_nothing_of_the_gate(self):
for command in ("git worktree", "git remote", "gh pr list", "gh pr view", "gh pr checks", "gh api graphql"):