Skip to content

feat(policy): enforce strict PR ready contract#39

Merged
ArchonVII merged 2 commits into
mainfrom
agent/codex/36-pr-contract-gate
May 31, 2026
Merged

feat(policy): enforce strict PR ready contract#39
ArchonVII merged 2 commits into
mainfrom
agent/codex/36-pr-contract-gate

Conversation

@ArchonVII

@ArchonVII ArchonVII commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add the shared PR contract validator and JSON/text CLI.
  • Add agent:close-preflight and agent:pr-ready wrappers so agents cannot promote malformed PRs through the blessed path.
  • Route repo-required-gate and pr-policy through the shared validator, and gate expensive PR jobs behind the cheap PR contract while preserving the explicit opt-out path.
  • Make bot PR body auto-injection scaffold-only so incomplete scaffolds cannot pass accidentally.

Verification

  • npm test
command: npm test
location: local
result: 5 files passed, 76 assertions completed successfully
timestamp: 2026-05-31T21:46:56Z
  • PR contract CLI smoke
command: node scripts/pr-contract.mjs --event-path $env:TEMP\pr-contract-event-valid.json --files-json '["scripts/pr-contract.mjs",".github/workflows/repo-required-gate.yml"]'
location: local
result: PR contract passed
timestamp: 2026-05-31T21:46:56Z
  • Agent wrapper smoke
command: npm run agent:close-preflight -- --repo ArchonVII/github-workflows --pr 39 --json; npm run agent:pr-ready -- --repo ArchonVII/github-workflows --pr 39 --dry-run --json
location: local
result: both wrappers returned ok=true against PR #39
timestamp: 2026-05-31T21:46:56Z
  • YAML parse smoke
command: python -c "import yaml; [yaml.safe_load(open(p, encoding='utf-8')) for p in ['.github/workflows/repo-required-gate.yml','.github/workflows/pr-policy.yml','.github/workflows/pr-body-autoinject.yml','examples/repo-required-gate.yml','examples/pr-policy.yml']]"
location: local
result: all targeted workflow YAML files parsed successfully
timestamp: 2026-05-31T21:46:56Z
  • Whitespace check
command: git diff --check
location: local
result: no whitespace errors; Git emitted line-ending normalization warnings for two touched files only
timestamp: 2026-05-31T21:46:56Z

Verification Notes

Vitest completed locally with 5 files and 76 assertions. The PR-contract CLI accepted a valid synthetic pull_request payload. The close-preflight and pr-ready wrapper scripts both validated PR #39 successfully; pr-ready was run with --dry-run. PyYAML parsed the modified reusable workflows and caller examples. actionlint was unavailable locally through PATH, npx actionlint, and Go tooling in this environment, so syntax coverage uses YAML parsing plus repository tests.

Docs / Changelog

README and contracts/pr-template.md document the new wrapper path and canonical scaffold. This repo does not currently use changelog fragments.

Linked Issue

Closes #36

ArchonVII and others added 2 commits May 31, 2026 16:01
Add a shared PR contract validator, local agent preflight/ready wrappers, and route reusable policy workflows through the same validator. Gate expensive repo-required-gate jobs behind the cheap PR contract on pull_request events and make bot body injection scaffold-only so placeholders cannot pass accidentally.

Refs #36
Declare repo-required-gate doc-only inputs consumed by the shared PR contract validator, and let run-pr-contract=false explicitly bypass contract-gated downstream jobs.

Refs #36

Co-Authored-By: Codex <noreply@openai.com>
@ArchonVII
ArchonVII marked this pull request as ready for review May 31, 2026 21:47
@ArchonVII
ArchonVII merged commit 90c0a89 into main May 31, 2026
1 check passed
@ArchonVII
ArchonVII deleted the agent/codex/36-pr-contract-gate branch May 31, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce PR contract before ready-for-review

1 participant