Skip to content

feat: add report-only governed PR check - #20

Merged
hummbl-dev merged 3 commits into
mainfrom
feat/codex/governed-pr-check-report-only
Jul 4, 2026
Merged

feat: add report-only governed PR check#20
hummbl-dev merged 3 commits into
mainfrom
feat/codex/governed-pr-check-report-only

Conversation

@hummbl-dev

@hummbl-dev hummbl-dev commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Linked Issue

Refs hummbl-dev/hummbl-dev#56

Boundary

  • Public
  • Private
  • Internal-only
  • Sensitive / requires review

Source Status

  • No source/canon impact
  • Source candidate only
  • Prior art
  • Canon-bearing change
  • Deprecated/removal

Change Class

  • Docs-only
  • CI/CD
  • Source packet
  • Code/runtime
  • Governance
  • Public surface

Evidence

Tests/checks run:

  • python3 -m py_compile /Users/others/.codex-tmp/governed-pr-check/.github/scripts/governed_pr_check.py
  • local clean-template smoke case with object-shaped files payload: no report-only findings
  • local clean-template smoke case with GitHub API array-shaped files payload: no report-only findings
  • local missing-template smoke case: expected warnings for linked issue, boundary, source status, change class, evidence, and owner path
  • ruby -e 'require "yaml"; YAML.load_file(...)' for workflow parse

Receipt:

  • Branch: feat/codex/governed-pr-check-report-only
  • Commits: 10b10697b867c49febed97131c4d1498963293c0, 6fb5d175b4a3f77f93f1163a506555095926708e, 06a50ce8a2d3fa321a2e6a5afc8444385b69b693
  • Owner review path: CODEOWNERS/governance reviewer should review before merge because .github/workflows/ and .github/scripts/ are changed.

Notes

Adds a report-only checker and reusable workflow for the Governed Throughput pilot path. fail-on-findings remains false by default.

Adds a stdlib checker, reusable workflow wrapper, and pilot adoption docs for Governed Throughput report-only validation.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This 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.

Changes

Governed PR Check implementation

Layer / File(s) Summary
Script parsing and inputs
.github/scripts/governed_pr_check.py
Adds governance constants plus helpers for PR-body parsing, changed-file JSON parsing, and sensitive-path detection.
Validation and CLI output
.github/scripts/governed_pr_check.py
Adds the validation rules, markdown report formatting, CLI wiring, and executable entrypoint for report generation.
Workflow wiring
.github/workflows/governed-pr-check.yml
Adds the pull request and reusable workflow triggers, permissions, concurrency, and the job that runs the script and publishes its report.
Usage documentation
docs/GOVERNED_PR_CHECK.md
Describes what the check validates, how it reports findings, how to invoke the reusable workflow, and how to run the script locally.

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
Loading

Poem

I’m a rabbit with a checklist tune,
Hop-hop, I read the PR by moon,
Findings in markdown, neat and bright,
Warnings that keep the gates in sight,
🐇 No fluff, just signals clear and keen,
Governed hops across the screen.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the requested report-only governed-pr-check workflow, script, and docs, matching the linked issue's enforcement phase.
Out of Scope Changes check ✅ Passed The changes stay focused on the governed PR check, workflow, and documentation, with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: adding a report-only governed PR check.
Description check ✅ Passed The description matches the template and fills all required sections with relevant evidence and notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/codex/governed-pr-check-report-only

Comment @coderabbitai help to get the list of available commands.

Handles the GitHub pull-request files API array response shape in governed_pr_check.py while preserving object-shaped fixture support.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between aa01725 and 10b1069.

📒 Files selected for processing (3)
  • .github/scripts/governed_pr_check.py
  • .github/workflows/governed-pr-check.yml
  • docs/GOVERNED_PR_CHECK.md

Comment thread .github/scripts/governed_pr_check.py
Comment thread .github/workflows/governed-pr-check.yml
Adds workflow concurrency so superseded governed-pr-check runs for the same PR are canceled.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Paginate 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 reach pr-files.json. That can let governance-sensitive changes slip past governance_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

📥 Commits

Reviewing files that changed from the base of the PR and between 6fb5d17 and 06a50ce.

📒 Files selected for processing (1)
  • .github/workflows/governed-pr-check.yml

@hummbl-dev
hummbl-dev merged commit 228ffb7 into main Jul 4, 2026
3 checks passed
@hummbl-dev
hummbl-dev deleted the feat/codex/governed-pr-check-report-only branch July 4, 2026 21:54
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.

1 participant