Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Merge batch 11-03 b1936: #2817 (#2818)

0xken15ba8f46c1e207
diff --git a/scripts/ci-plan.py b/scripts/ci-plan.py
index 97bf6bcd6..89cc0891f 100644
--- a/scripts/ci-plan.py
+++ b/scripts/ci-plan.py
@@ -483,7 +483,11 @@ def read_gate(client, run):
if not isinstance(suites, list) or not set(suites) <= SUITES:
raise ValueError("required-gate receipt has invalid suites")
reused = check_reused_records(receipt.get("reused", {}), suites, receipt["source_sha"], receipt["event"])
- if receipt["required_jobs"] != sorted({"process-checks"} | set().union(*(JOBS[name] for name in set(suites) - set(reused)))):
+ # Every job this planner requires must have run and passed (checked above for each listed job). A receipt may list more:
+ # the merge helper runs from main, so a PR that adds a CI job brings jobs main does not know yet (#2804, batch #2815).
+ required = receipt["required_jobs"]
+ if (required != sorted(set(required))
+ or not {"process-checks"} | set().union(*(JOBS[name] for name in set(suites) - set(reused))) <= set(required)):
raise ValueError("required-gate receipt does not run every suite it did not reuse")
after = client.api(f"actions/runs/{run['id']}")
ci.check_run(after, client.repository, run["id"])
diff --git a/scripts/tests/test_ci_plan.py b/scripts/tests/test_ci_plan.py
index 8b14afd9d..3441da490 100644
--- a/scripts/tests/test_ci_plan.py
+++ b/scripts/tests/test_ci_plan.py
@@ -933,6 +933,29 @@ class GitHubEvidenceTests(unittest.TestCase):
self.assertEqual(gate["receipt"]["suites"], ["backend", "mobile"])
self.assertIn("actions/jobs/120", self.github.reads)
+ def test_a_receipt_from_a_planner_that_adds_a_job_passes_the_older_helper(self):
+ # The merge helper runs from main; a PR that adds a CI job (#2804: backend-integration) brings a receipt listing a
+ # job main's JOBS does not know yet. Every job main requires ran and passed, so it may merge (batch #2815 refused).
+ self.github.add_run(12, self.head, self.tree, ["mobile", "backend"])
+ receipt = self.github.receipts[12]
+ receipt["required_jobs"] = sorted(receipt["required_jobs"] + ["backend-new-shards"])
+ receipt["results"]["backend-new-shards"] = "success"
+ gate = self.evidence.passed_gate(self.head)
+ self.assertIn("backend-new-shards", gate["receipt"]["required_jobs"])
+
+ def test_a_receipt_missing_a_job_main_requires_or_with_a_failed_extra_job_is_refused(self):
+ self.github.add_run(12, self.head, self.tree, ["mobile", "backend"])
+ receipt = self.github.receipts[12]
+ receipt["required_jobs"] = [job for job in receipt["required_jobs"] if job != "backend-desk"]
+ with self.assertRaisesRegex(ValueError, "does not run every suite"):
+ self.evidence.passed_gate(self.head)
+ self.github.add_run(13, self.head, self.tree, ["mobile", "backend"])
+ receipt = self.github.receipts[13]
+ receipt["required_jobs"] = sorted(receipt["required_jobs"] + ["backend-new-shards"])
+ receipt["results"]["backend-new-shards"] = "failure"
+ with self.assertRaisesRegex(ValueError, "inconsistent"):
+ self.evidence.passed_gate(self.head)
+
def test_a_failed_latest_check_is_not_rescued_by_an_older_pass(self):
self.github.add_run(12, self.head, self.tree, ["mobile"], conclusion="failure")
with self.assertRaisesRegex(ValueError, "not a pass"):