Skip to content

fix(osv): make PR gate differential so pre-existing debt can't block PRs#51

Open
JacobPEvans-personal wants to merge 1 commit into
mainfrom
fix/osv-differential-pr-gate
Open

fix(osv): make PR gate differential so pre-existing debt can't block PRs#51
JacobPEvans-personal wants to merge 1 commit into
mainfrom
fix/osv-differential-pr-gate

Conversation

@JacobPEvans-personal

Copy link
Copy Markdown
Member

Problem

_osv-scan.yml ran a full repo scan on every trigger and failed on any finding. Wired as a required PR gate (e.g. nix-ai ci-gate.yml, if: always(), not in the Merge Gate allowed-skips), a single open advisory on a transitive dependency anywhere in the tree red-flagged every open PR — including unrelated ones (e.g. chore(deps): lock file maintenance that only touches flake.lock) that can never clear that debt. This is the root cause of nix-ai's lock-file-maintenance PRs always failing CI.

Change

Two modes, selected by trigger:

Trigger Behavior
pull_request Differential — scan base ref + head ref, fail only on vulnerabilities the PR introduces (official osv-scannerosv-reporter diff pattern). Pre-existing base findings no longer block the PR.
push / schedule / other Full scan (previous behavior) — the default branch still surfaces accumulated/drift debt.

Central-vs-local osv-scanner.toml resolution is unchanged and applies in both modes (and to both refs in differential mode — the file persists across the in-place ref switches). Action digests stay pinned to v2.3.8 (9a49870), matching the existing scanner pin; osv-reporter-action added at the same pin.

Blast radius

  • Callers on @main (nix-ai, mlx-benchmarks) pick this up immediately — their PR gate becomes differential, their push/schedule runs keep full-scan behavior.
  • docs/osv-scan.yml pins this workflow to a SHA, so it is unaffected until intentionally bumped. It runs on pull_request + push + schedule; when bumped it gains differential PRs and keeps full push/schedule scans.

Validation

  • actionlint .github/workflows/_osv-scan.yml → clean.
  • Differential mechanism mirrors google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml (checkout base → scan → checkout head → scan → osv-reporter --old --new --fail-on-vuln=true).
  • run: steps use only GitHub-controlled $GITHUB_BASE_REF / $GITHUB_SHA (quoted) — no untrusted input.

Companion: dryvist/nix-ai#1033 clears the current fixable uv.lock debt and adds a twice-weekly uv lock --upgrade auto-merge workflow, plus a scheduled full-scan caller of this workflow.

The reusable _osv-scan.yml ran a full repo scan on every trigger and failed
on ANY finding. Because it is wired as a required PR gate (e.g. nix-ai
ci-gate.yml, `if: always()`, not in the Merge Gate allowed-skips), a single
open advisory on a transitive dependency anywhere in the tree red-flagged
EVERY open PR — including unrelated ones that only touch flake.lock and can
never clear that debt.

Split into two modes by trigger:

- pull_request -> DIFFERENTIAL. Scan the base ref and the head ref and fail
  ONLY on vulnerabilities the PR introduces, using the official osv-scanner /
  osv-reporter diff pattern (osv-scanner-reusable-pr.yml). Pre-existing base
  findings no longer block the PR.
- push / schedule / other -> FULL scan (previous behavior), so the default
  branch still surfaces accumulated/drift debt. Callers that run this on
  `push:`/`schedule:` (docs/osv-scan.yml) are unaffected.

Central-vs-local osv-scanner.toml resolution is unchanged and applies in both
modes (and to both refs in differential mode — the file persists across the
in-place ref switches). Action digests pinned to v2.3.8 (9a49870), matching
the existing scanner pin.

Note: docs/osv-scan.yml pins this workflow to a SHA, so it is unaffected until
intentionally bumped; nix-ai and mlx-benchmarks track @main and get the change.

Assisted-by: Claude:claude-opus-4-8[1m]
Claude-Session: https://claude.ai/code/session_01CYau7MWswJikoctB9MUgcZ
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

JacobPEvans-personal added a commit to dryvist/nix-ai that referenced this pull request Jun 26, 2026
Complements the now-differential PR gate (dryvist/.github#51): the PR gate
fails only on vulnerabilities a PR introduces, so this weekly full scan of the
default branch is what surfaces drift — a new advisory landing against an
unchanged dependency shows up as a failed scheduled run. uv.lock drift is
normally auto-remediated by uv-lock-upgrade.yml; this is the backstop for
everything else. Reuses the org _osv-scan.yml (full-scan mode on schedule).

Assisted-by: Claude:claude-opus-4-8[1m]
Claude-Session: https://claude.ai/code/session_01CYau7MWswJikoctB9MUgcZ
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