ci: reconcile tracked downstream validation tasks (#10) #41

Merged
cflmy merged 10 commits from codex/issue-10-consumer-inputs into main 2026-11-27 22:23:46 +08:00
2 changed files with 13 additions and 2 deletions
Showing only changes of commit a93cb0e921 - Show all commits

No files matched your search

+3 -1
View File
@@ -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"<!-- marqdo:candidate-inputs {task['key']} -->"
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:
+10 -1
View File
@@ -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"]