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
checksis a list of dictionaries withnameandstatus.- 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_checksare ignored, even if they failed. - If multiple checks share a name, the last entry in
checkswins. - At least one review with state
"approved"is required. Missing approval producesapproval_required. - Any review with state
"changes_requested"blocks merge and produceschanges_requested(even when an approval is also present). - Artifacts must contain
"diff"and"tests". Missing required artifacts producemissing_artifact:diffandmissing_artifact:testsrespectively. - 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