Skip to content

ci(quality): add report-only Code Quality workflow (mypy + ruff → code scanning) - #190

Merged
rolandpg merged 1 commit into
masterfrom
claude/pr-review-releases-ptrada
Jul 7, 2026
Merged

ci(quality): add report-only Code Quality workflow (mypy + ruff → code scanning)#190
rolandpg merged 1 commit into
masterfrom
claude/pr-review-releases-ptrada

Conversation

@rolandpg

@rolandpg rolandpg commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Adds .github/workflows/code-quality.yml — a non-blocking quality workflow that complements the hard gates already in ci.yml (ruff lint/format, pip-audit, tests, coverage). It runs on push to master, PRs, and weekly.

Jobs

  1. mypy — static type check (report-only). The repo configures mypy ([tool.mypy], disallow_untyped_defs = true) but never ran it in CI. This surfaces type findings without failing the build, because there's a known typing backlog (audit H-3) to ratchet per-module. Flip continue-on-error off to make it a hard gate once clean.
  2. ruff-scan — ruff → SARIF → code scanning. ci.yml already hard-gates the active ruff rule set, so this --extend-select ANN (the deferred type-annotation backlog) and uploads SARIF to the code-scanning dashboard (the settings/code-quality page). Non-blocking; findings appear as code-scanning alerts, not build failures.

Why report-only / safe

  • Both known backlogs (mypy, ruff ANN) would break a hard gate today, so this is deliberately non-gating — it makes them visible for ratcheting rather than blocking work.
  • All actions are SHA-pinned to the exact versions already used in the repo (checkout@9c091bb, setup-python@ece7cb06, upload-sarif@54f647b — the same SARIF pattern as snyk-security.yml, which proves third-party SARIF uploads work under the default CodeQL setup).
  • No GOV-NNN labels, so the governance spec-drift check stays green (no controls.yaml change needed).

Notes / knobs

  • The ANN upload will surface the annotation backlog (~120 findings) as dashboard alerts — that's intentional (a live view of the ratchet). If it's too noisy, drop --extend-select ANN and it'll only report new active-rule findings.
  • Natural follow-ups: promote mypy to a hard gate as modules are annotated (ties into audit H-3), and the earlier-noted Python 3.10 CI leg.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E98zHqp7UdZGbMKS9M7yjo


Generated by Claude Code


Open in Devin Review

Adds .github/workflows/code-quality.yml with two non-blocking jobs that
complement the hard gates in ci.yml:

- mypy static type check (report-only): surfaces the known typing backlog
  (audit H-3) without failing the build; flip continue-on-error off to
  make it a hard gate once clean.
- ruff -> SARIF -> code scanning: emits ruff findings, including the
  deferred ANN (type-annotation) ratchet backlog, to the code-scanning
  dashboard. Non-blocking (ci.yml already hard-gates the active rule set).

All actions are SHA-pinned to the versions already used in the repo, and
no GOV-NNN labels are used so the governance spec-drift check stays green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E98zHqp7UdZGbMKS9M7yjo
@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@rolandpg
rolandpg merged commit 2b335ac into master Jul 7, 2026
17 checks passed
@rolandpg
rolandpg deleted the claude/pr-review-releases-ptrada branch July 7, 2026 03:55

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14c92f0124

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +72 to +73
ruff check --extend-select ANN --output-format sarif \
src/zettelforge/ > ruff.sarif || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Lower Ruff SARIF severity before uploading

On pull_request runs this is not actually report-only unless the repository has manually relaxed code-scanning failure thresholds: Ruff’s SARIF marks ANN findings with level/problem.severity as error (verified by running this command in the repo), and GitHub’s Code scanning results check fails by default for error-severity alerts (docs). A PR that adds or touches a missing-annotation finding can therefore get a failing Code scanning results / ruff check even though the workflow step uses || true.

Useful? React with 👍 / 👎.

Comment on lines +72 to +73
ruff check --extend-select ANN --output-format sarif \
src/zettelforge/ > ruff.sarif || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve Ruff execution failures

When Ruff cannot run for reasons other than findings (for example an invalid pyproject.toml rule selector or a future CLI/config incompatibility), this || true still turns the step green after writing an empty or partial ruff.sarif; because the upload step also continues on error, the workflow can silently stop producing dashboard results. Ruff’s help provides --exit-zero specifically to return success only when diagnostics are found, so use that instead of swallowing all execution failures.

Useful? React with 👍 / 👎.

# findings without failing the build. Drop continue-on-error to make
# mypy a hard gate once it is clean. Config lives in [tool.mypy].
continue-on-error: true
run: mypy src/zettelforge/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Install PyYAML stubs before running mypy

With the current dev install, PyYAML is present but its stub package is not; running this exact mypy invocation reports Library stubs not installed for "yaml" across the YAML-using modules and exits with errors prevented further checking, so the job mostly reports missing third-party stubs instead of the intended typing backlog. Add types-PyYAML to the environment or suppress that import-untyped error before invoking mypy.

Useful? React with 👍 / 👎.

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.

3 participants