From a93cb0e921a772318cf0d225ddeb01896c53d2ce Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 27 Nov 2026 22:06:24 +0800 Subject: [PATCH] ci: refresh open task evidence when the accepted root moves --- scripts/reconcile-releases.py | 4 +++- tests/integration/test_reconcile_releases.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/reconcile-releases.py b/scripts/reconcile-releases.py index b3cd758..958bb26 100755 --- a/scripts/reconcile-releases.py +++ b/scripts/reconcile-releases.py @@ -396,7 +396,9 @@ def register_consumer_tasks(client, root_sha, entry, issue_cache): if issue["state"] == "open": comments = tracking_comments(client, issues_url, issue) key_line = f"" - if not any(key_line in note.splitlines() for note in [issue["body"], *comments]): + baselines = [note.splitlines() for note in [issue["body"], *comments] + if note.splitlines()[:1] == [marker]] + if not {key_line, f"- Root candidate: {root_sha}"} <= set(baselines[-1]): verify_root_base(client, root_sha) client.post(f"{issues_url}/{issue['number']}/comments", {"body": body}) else: diff --git a/tests/integration/test_reconcile_releases.py b/tests/integration/test_reconcile_releases.py index a0b9d50..2a0f767 100644 --- a/tests/integration/test_reconcile_releases.py +++ b/tests/integration/test_reconcile_releases.py @@ -53,6 +53,7 @@ class FakeForge: "published_at": PUBLISHED} self.releases = [self.release] self.protected = True + self.root_sha = BASE self.tag_sha = SOURCE self.pipeline_sha = SOURCE self.wrong_account = False @@ -90,7 +91,7 @@ class FakeForge: f"/repos/{REPO}/tags/{TAG}": {"name": TAG, "commit": {"sha": self.tag_sha}}, "/repos/cflmy/marqdo": {"default_branch": "main"}, "/repos/cflmy/marqdo/branches/main": {"protected": self.protected, - "commit": {"id": BASE}}, + "commit": {"id": self.root_sha}}, "/user": ({"login": "admin", "is_admin": True} if self.wrong_account else {**ACTOR, "is_admin": False}), }[path] @@ -193,6 +194,14 @@ class ReconcileTest(unittest.TestCase): self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1) self.run_scan(apply=True) self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1) + new_root = "f" * 40 + self.forge.root_sha = new_root + with patch.object(reconcile, "managed_repositories", return_value=(new_root, graph, {REPO: COMPONENT})): + self.run_scan(apply=True) + self.run_scan(apply=True) + notes = self.forge.comments[CONSUMER_ISSUES + "/100/comments"] + self.assertEqual(len(notes), 2) + self.assertIn(f"- Root candidate: {new_root}", notes[-1]["body"]) def test_apply_creates_one_verified_tracker_then_rechecks_it(self): entry, = self.run_scan(apply=True)["results"]