patchscan: add validate-pr script and unified PR Validation Report#386
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new PR-validation layer alongside the existing patchscan workflow, producing a single unified “PR Validation Report” comment that combines missing-fix detection and commit/metadata linting.
Changes:
- Add
.github/scripts/validate-prto lint commit trailers/subjects and PR metadata (title/body/target branch). - Update
patchscan.ymlto run both patchscan + validate-pr and post a unified report comment. - Extend workflow inputs/branch triggers to support additional tracked branches and an optional
repoinput for dispatch runs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/patchscan.yml |
Renames and expands the workflow to run patchscan + validate-pr and post a unified PR Validation Report comment, with workflow_dispatch inputs. |
.github/scripts/validate-pr |
New Python script that validates commit hygiene (trailers/SoB/merge commits/SAUCE rules) and PR title/body requirements; prints a digest table for cherry-picks. |
Comments suppressed due to low confidence (1)
.github/workflows/patchscan.yml:64
- The new
repoinput is used for API lookups and git fetches, butactions/checkoutstill checks out the current repository (default) atbase_ref. Wheninputs.repopoints at a different repo that doesn't have the same branch names/refs, this step will fail (or checkout the wrong code). If cross-repo scanning viaworkflow_dispatchis intended to work reliably, adjust checkout logic for the dispatch case (e.g., checkout a known ref in this repo, or conditionally setrepository:/ref:based onsteps.pr.outputs.pr_repo).
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: ${{ steps.pr.outputs.base_ref }}
fetch-depth: 0
persist-credentials: false
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a7a18da to
633b0c6
Compare
Update: lore.kernel.org diff verification + full commit tableTwo enhancements added since the initial version: 1. Mailing-list patch diff verification (b4-based)For commits using `(backported from )` trailers, the script now:
Statuses: `match`, `MISMATCH` (error), `noted` (differs but annotated — ok), `no-match` / `no-diff` / `fetch-err` (non-fatal fallbacks). Added `b4>=0.13` to `requirements.txt`. Confirmed working in GitHub Actions (b4 0.15.2 installs via pip). 2. All commits shown in digest tablePreviously only commits with upstream reference trailers appeared. Now SAUCE and Revert commits show as informational rows (`SAUCE` / `Revert` in the upstream column, `N/A` elsewhere), giving a complete view of the PR. Example: 14-commit LFA v2 bos branchThe `noted` row (`Move image rescanning`) has a `[Nirmoy Das: …]` annotation explaining an intentional deviation. All other backported patches match their lore originals exactly. |
Introduce .github/scripts/validate-pr, a standalone Python tool that checks commit hygiene for incoming PRs and produces a single structured report consumed by patchscan.yml. Checks performed: - Cherry-pick and backport attribution (cherry picked from / backported from) - Signed-off-by presence on all commits - PR title format: [<branch>] prefix requirement - PR body: Launchpad BugLink required for non-bos branches - SAUCE / Revert commits shown in digest with SoB authors Diff verification for backported-from-lore commits: - Uses b4 am to fetch the LKML series for each (backported from <url>) commit, caching per URL to avoid duplicate fetches - Computes a fingerprint over added/removed lines only (excludes @@ hunk headers whose line numbers differ between email and git-show contexts) - Reports match/mismatch in the digest table - Accepts [Author: reason] conflict annotations to allow intentional divergence without failing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ianm-nv
left a comment
There was a problem hiding this comment.
LGTM
Acked-by: Ian May <ianm@nvidia.com>
Add
.github/scripts/validate-pr: a new Python script that checks commit hygiene and PR metadata alongside the existingpatchscanscript.Checks performed
(cherry picked from commit <sha>)trailer, compare patch-ID, subject, and SoB chain against upstream. Unresolvable SHAs are fetched directly by object ID before failing (handles intra-tree cherry-picks from unfetched branches).E:missingSigned-off-by:trailerE:non-SAUCE/non-Revert commit lacks upstream reference trailerW:LKML in-review backport uses wrong trailer formE:merge commit in PR rangeW:subject line >72 chars (exempt: SAUCE and Reverts of SAUCE)W:non-canonical SAUCE subject prefixW:PR title missing[<branch>]prefixE:PR targets a tracked branch but body has noBugLink:orLP:lineWorkflow changes (
patchscan.yml)26.04_linux-nvidiaand26.04_linux-nvidia-bostopull_request_targetbranch list (was only24.04_linux-nvidia-6.17-next)repoinput for cross-repo PR scanning viaworkflow_dispatchactions/checkoutso files survive into later stepsvalidate-prinvocation stepsafeRead()guard for missing output filesAll fixes:section rather thanE:lines (avoids false failures on VR/intra-tree cherry-picks)E:findingsTesting
Validated end-to-end on fork PR nirmoy/NV-Kernels#11 (replica of upstream PR #384). All checks pass — example output: