Skip to content

ci(pr-policy): require verified isolated QA reports on external PRs - #323

Open
TNT-Likely wants to merge 1 commit into
mainfrom
codex/pr-policy-qa-report
Open

TNT-Likely wants to merge 1 commit into
mainfrom
codex/pr-policy-qa-report

Conversation

@TNT-Likely

Copy link
Copy Markdown
Owner

Background

PR policy previously only verified that Acceptance evidence fields were non-empty text, so external pull requests touching production code could pass the mechanical gate without running the repository's isolated QA skill (.agents/skills/panwatch-local-delivery) or attaching a verifiable offline test report. At the same time, repository owner PRs (TNT-Likely) and docs/test-only PRs should remain frictionless and exempt from the mandatory attachment check.

Changes

  • .github/pr-policy.json: add qaReport configuration (required: true, exemptAuthors: ["TNT-Likely"], minSkillVersion: "1.3.0", archive size/entry/timeout limits) and the pr:qa-exempt maintainer override label.
  • .github/scripts/pr-policy.cjs:
    • Enforce isolated QA report ZIP attachment (https://github.com/user-attachments/files/.../*.zip + ZIP SHA256: <64-hex>) for external pull requests with productionFiles > 0.
    • Automatically exempt PRs authored by configured exemptAuthors (TNT-Likely, case-insensitive), PRs with 0 production files, and PRs carrying a head-bound pr:qa-exempt maintainer label (revoked automatically on a new push).
    • Implement a zero-dependency, read-only ZIP verifier (parseZipEntries + verifyQaReportZip + SSRF-safe downloadAttachmentZip) that checks ZIP SHA256, index.html, manifest.json (base_sha matching the current PR head, non-empty run_id, skill_version >= 1.3.0, no recorded failures), SHA256SUMS integrity, and redaction/secret-leak rules (rejecting credentials.json, .env*, *.db, keys, and unredacted tokens).
    • Throw on transient 5xx/network errors without starting a 14-day closure clock.
  • .github/scripts/pr-policy.test.cjs: expand the Node test suite from 39 to 52 tests covering owner exemption, docs/test-only exemption, pr:qa-exempt head-binding and revocation, SSRF URL rejection, stored/deflated ZIP verification, stale base_sha, tampered SHA256SUMS, failing summaries, leaked secrets/private files, 404 failures, and transient 503 handling.
  • .github/PULL_REQUEST_TEMPLATE.md, docs/pr-policy.md, docs/pr-policy.zh-CN.md, .agents/skills/panwatch-local-delivery/references/delivery.md: document the required ### Test report fields, manifest.json keys (base_sha, run_id, skill_version, summary.failed), and exemption rules.

Scope

Audited head SHA: 84b13233b265b49fe8344bd6e5adc493f0642864.
Production scale: 2 production files (.github/pr-policy.json, .github/scripts/pr-policy.cjs), 475 added + deleted production lines (within the 20 files / 800 lines budget). Tests and Markdown docs are excluded from the production budget.

Excluded: no changes to application runtime code, frontend code, or other GitHub Actions workflows.

Validation

Tested commit: 84b13233b265b49fe8344bd6e5adc493f0642864

Commands and results:

$ node --test .github/scripts/pr-policy.test.cjs
ℹ tests 52
ℹ pass 52
ℹ fail 0

$ python3 -m unittest discover -s .agents/skills/panwatch-local-delivery/scripts -p 'test_*.py' -v
Ran 15 tests in 1.518s
OK

$ git diff --check
(clean, no output)

Acceptance evidence

Steps:

  1. Run node --test .github/scripts/pr-policy.test.cjs on commit 84b1323.
  2. Verify owner exemption (TNT-Likely), docs/test-only exemption, external production PR rejection without ZIP, SSRF rejection for non-GitHub URLs, valid stored/deflated ZIP verification, tamper/stale-head/secret-leak rejection, and head-bound pr:qa-exempt behavior.
  3. Run python3 -m unittest discover -s .agents/skills/panwatch-local-delivery/scripts -p 'test_*.py' -v to confirm skill isolation tests remain green.

Expected:
All 52 PR policy tests and 15 skill isolation tests pass; owner PRs bypass the mandatory QA ZIP gate while external production PRs must pass full read-only ZIP verification unless exempted with pr:qa-exempt.

Observed:
All 52 tests in .github/scripts/pr-policy.test.cjs passed (0 failed), all 15 tests in test_isolation.py passed (OK), and git diff --check returned clean.

Evidence:
Sanitized command results above; full automated test cases are in .github/scripts/pr-policy.test.cjs and exercised by the PR policy tests workflow on this PR. Application UI/backend tests are not applicable because this change touches only repository PR policy tooling and documentation.

Boundaries and risks

  • External fork PRs that already passed PR policy prior to merging this change (e.g. open external production PRs) will be asked for an isolated QA report ZIP on their next event or daily sweep unless a maintainer applies pr:qa-exempt for their current head.
  • The ZIP verifier only supports standard Stored (0) and Deflated (8) ZIP entries (the formats produced by zip and Python zipfile) up to 20 MB compressed / 50 MB uncompressed and 500 entries; archives using exotic compression methods are rejected.
  • downloadAttachmentZip downloads unauthenticated public GitHub PR attachments; if the repository is ever made private, unauthenticated fetches would return 404.
  • PR policy executes trusted code from the default branch (main), so the new rules take effect only after this PR is merged into main.

Follow-up

None.

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