feat: add report-only governed PR check - #20
Conversation
Adds a stdlib checker, reusable workflow wrapper, and pilot adoption docs for Governed Throughput report-only validation.
📝 WalkthroughWalkthroughThis PR adds a report-only governed PR validation script, a GitHub Actions workflow to run it on pull requests, and documentation covering the check criteria and local usage. ChangesGoverned PR Check implementation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant governed-pr-check workflow
participant governed_pr_check.py
participant gh api
governed-pr-check workflow->>gh api: fetch changed files JSON
governed-pr-check workflow->>governed_pr_check.py: pass PR body and files JSON
governed_pr_check.py->>governed_pr_check.py: validate body and file signals
governed_pr_check.py-->>governed-pr-check workflow: markdown findings
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Handles the GitHub pull-request files API array response shape in governed_pr_check.py while preserving object-shaped fixture support.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/scripts/governed_pr_check.py:
- Around line 118-128: The crash comes from `changed_files_from_json` assuming
the `--files-json` payload is a dict with a "files" field, but `gh api
repos/.../pulls/.../files` returns a JSON array. Update
`changed_files_from_json` in `governed_pr_check.py` to handle the array shape
directly (iterating the parsed list of file objects) and only extract `filename`
from each item when it is a string, instead of calling `payload.get(...)` on the
top-level payload.
In @.github/workflows/governed-pr-check.yml:
- Around line 3-12: The workflow triggers for repeated pull_request updates
without any run cancellation, so rapid synchronize events can stack redundant
executions. Add a concurrency configuration to the governed-pr-check workflow so
that runs for the same pull request share a stable group and cancel in-progress
runs when a newer update arrives, keeping only the latest execution active;
place this alongside the existing on: block and use the workflow’s pull_request
context to identify the PR.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c7a50a93-305b-4b75-b3d6-2af59e6afdf9
📒 Files selected for processing (3)
.github/scripts/governed_pr_check.py.github/workflows/governed-pr-check.ymldocs/GOVERNED_PR_CHECK.md
Adds workflow concurrency so superseded governed-pr-check runs for the same PR are canceled.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/governed-pr-check.yml (1)
37-43: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPaginate the PR files fetch — PRs with more than 100 changed files truncate at 100.
gh api "repos/${REPOSITORY}/pulls/${PR_NUMBER}/files?per_page=100"only fetches one page, so any files beyond the first 100 never reachpr-files.json. That can let governance-sensitive changes slip pastgovernance_sensitive_files()on large PRs.🐛 Proposed fix
- name: Fetch changed files env: GH_TOKEN: ${{ github.token }} PR_NUMBER: ${{ github.event.pull_request.number }} REPOSITORY: ${{ github.repository }} run: | - gh api "repos/${REPOSITORY}/pulls/${PR_NUMBER}/files?per_page=100" > pr-files.json + gh api --paginate --slurp "repos/${REPOSITORY}/pulls/${PR_NUMBER}/files?per_page=100" | jq -c '[.[][]]' > pr-files.json🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/governed-pr-check.yml around lines 37 - 43, The Fetch changed files step only requests the first page from the pull request files API, so large PRs can miss files beyond 100. Update the workflow command in the Fetch changed files step to paginate through all pages when calling gh api for the pull files endpoint, ensuring pr-files.json contains every changed file before governance_sensitive_files() runs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/governed-pr-check.yml:
- Around line 37-43: The Fetch changed files step only requests the first page
from the pull request files API, so large PRs can miss files beyond 100. Update
the workflow command in the Fetch changed files step to paginate through all
pages when calling gh api for the pull files endpoint, ensuring pr-files.json
contains every changed file before governance_sensitive_files() runs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 63c8ab49-57f1-4d31-b132-5d00b014c86b
📒 Files selected for processing (1)
.github/workflows/governed-pr-check.yml
Linked Issue
Refs hummbl-dev/hummbl-dev#56
Boundary
Source Status
Change Class
Evidence
Tests/checks run:
python3 -m py_compile /Users/others/.codex-tmp/governed-pr-check/.github/scripts/governed_pr_check.pyruby -e 'require "yaml"; YAML.load_file(...)'for workflow parseReceipt:
feat/codex/governed-pr-check-report-only10b10697b867c49febed97131c4d1498963293c0,6fb5d175b4a3f77f93f1163a506555095926708e,06a50ce8a2d3fa321a2e6a5afc8444385b69b693.github/workflows/and.github/scripts/are changed.Notes
Adds a report-only checker and reusable workflow for the Governed Throughput pilot path.
fail-on-findingsremains false by default.