EasyAgentsPython 3

PR Readiness Gate

Decide whether an agent-created pull request has enough checks, approval, and proof artifacts to merge.

25m3 sample tests6 hidden tests

Implement pr_blockers(checks, reviews, artifacts, required_checks), a merge-readiness gate for agent-created pull requests.

Requirements

  • checks is a list of dictionaries with name and status.
  • Required check names must exist and have status "passed".
  • Missing checks produce missing_check:<name>.
  • Failing checks produce failing_check:<name> (any status other than "passed" counts as failing for a required check).
  • Checks whose names are not in required_checks are ignored, even if they failed.
  • If multiple checks share a name, the last entry in checks wins.
  • At least one review with state "approved" is required. Missing approval produces approval_required.
  • Any review with state "changes_requested" blocks merge and produces changes_requested (even when an approval is also present).
  • Artifacts must contain "diff" and "tests". Missing required artifacts produce missing_artifact:diff and missing_artifact:tests respectively.
  • Return blockers sorted lexicographically.

Example

python
1checks = [{"name": "test", "status": "passed"}] 2reviews = [{"user": "u", "state": "approved"}] 3assert pr_blockers(checks, reviews, ["diff", "tests"], ["test"]) == []

Constraints

  • Keep the result deterministic.
  • Leave inputs untouched.

Editor