Skip to content

ci: enable path filters for lint and pytest workflows#4411

Merged
jonpspri merged 7 commits intomainfrom
jps-pylint-pytest-filter
Apr 23, 2026
Merged

ci: enable path filters for lint and pytest workflows#4411
jonpspri merged 7 commits intomainfrom
jps-pylint-pytest-filter

Conversation

@jonpspri
Copy link
Copy Markdown
Collaborator

Summary

  • Uncomment path filters on the push and pull_request triggers in .github/workflows/lint.yml and .github/workflows/pytest.yml.
  • Workflows now run only when relevant Python source, tests, workflow, or dependency files change, skipping unrelated docs/chart changes.

Test plan

  • Verify workflows still trigger on PRs touching mcpgateway/, plugins/, tests/, pyproject.toml, uv.lock, or the workflow files themselves
  • Verify workflows are skipped on PRs that only touch unrelated paths (e.g. docs/, charts/)

Uncomment path filters on push and pull_request triggers so the Lint
and Tests workflows only run when relevant source, test, or workflow
files change. Avoids spending CI on unrelated doc or chart updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
- sql-sanitizer.yml: add path filters so the E2E only runs when
  gateway, sql-sanitizer crate, or fast-test-server change.
- pytest-rust.yml: drop `make rust-verify-stubs`; rust.yml already
  covers stub verification.
- linting-full.yml: restrict to workflow_dispatch; ruff/pylint/
  vulture/interrogate/radon are already run per-PR by lint.yml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
jonpspri and others added 2 commits April 23, 2026 11:29
linting-full runs actionlint, commitlint, helm lint, gosec, and
govulncheck via LINTING_FULL_TARGETS in the Makefile. None of these
are covered by lint.yml (which is Python-only). Restore the push
trigger.

Note: the existing path filter (mcpgateway/**, plugins/**,
pyproject.toml) is too narrow for what the workflow actually checks
(GitHub Actions, Helm charts, Go sources). Fixing that is a
separate follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
LINTING_FULL_TARGETS checks GitHub Actions workflows, Helm charts,
Go sources in mcp-servers/ and a2a-agents/, and commitlint. The
previous filter (Python source) never matched those scopes.

Commitlint has no natural path filter; it is skipped on pushes that
touch only non-listed paths. Since this workflow is a post-merge
audit on main, that is acceptable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
Comment thread .github/workflows/rust.yml
These workflows validate PR heads and have no main-branch side
effects (no artifacts published, no release tagging). Dropping the
push:[main] trigger avoids re-running the same jobs immediately
after the PR has already gone green pre-merge.

Affected: pytest, pytest-rust, lint, lint-web, vitest,
sql-sanitizer, wrapper, playwright, python-package,
alembic-upgrade-validation, license-check, docker-scan,
dependency-review, rust.

rust.yml keeps push:tags:v* because release-wheel/release-sdist/
release-publish use rust-build/rust-test/security-audit/
supply-chain-vet/license-check as `needs:` dependencies on tag
push. The main/develop branch push trigger is removed.

Also update scripts/pre-commit/check_ci_workflows.py to skip the
push.paths check on rust.yml when push is tag-only; paths do not
meaningfully filter tag pushes.

REQUIRES: branch protection on main must list these workflows as
required status checks so the PR gate is enforced at merge time.
If required checks are not configured, revert this commit.

Workflows still triggered on push:[main] (by design):
  - docker-multiplatform (arm64/s390x/ppc64le + manifest + sign)
  - helm-publish (release-gated publish)
  - linting-full (post-merge audit)
  - rust (tag pushes for release)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
@jonpspri jonpspri force-pushed the jps-pylint-pytest-filter branch from 88b972a to 7b27401 Compare April 23, 2026 11:00
The failing unit tests asserted `on.push.paths` contents, which no
longer exist after dropping push:[main] from docker-scan,
license-check, and wrapper workflows. Port the still-meaningful
path-invariant checks to scripts/pre-commit/check_ci_workflows.py
against pull_request.paths (the actual gating trigger) and drop
the now-stale pytest cases:

- test_docker_scan_tracks_rust_container_inputs
- test_docker_scan_triggers_on_changed_container_files
- test_license_check_runs_for_rust_repositories_and_inputs (file removed)
- test_wrapper_workflow_only_triggers_for_wrapper_changes

Remaining tests in these files (rust-enabled smoke build, matrix
entries, E2E step content, action SHA pinning) stay as pytest
cases since they validate job bodies, not triggers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
The scan-style hooks added in PR #4257 mixed genuine cross-file
integrity checks with stylistic rules and overfit assertions. This
pass reduces them to the invariants a careful reviewer cannot
reliably catch, and moves test-shaped assertions back to pytest.

Trimmed (kept the invariant-style portion, dropped style/overfit):
- check_ci_workflows: now only enforces SHA pinning of third-party
  GitHub Actions across all workflows. Per-workflow path/job-name
  assertions were overfit and are better expressed as reviewer
  norms plus actionlint.
- check_migration_patterns: now only enforces revision-ID/filename
  consistency and cross-file duplicate detection. DateTime
  timezone, SA-vs-raw-SQL, index-count balance, and the
  one-specific-migration token-uniqueness guard were stylistic or
  test-shaped.
- check_rust_workspace: now only verifies deny.toml's RUSTSEC
  advisory ignore list. The workspace-layout/Makefile/Containerfile
  assertions were drift-detection for a one-time migration and are
  no longer load-bearing.

Removed entirely (review or tests handle these):
- check_machine_paths: forbade one literal path; any reviewer would
  catch /home/$dev in a diff, and the hook was trivially overfit.
- check_no_os_system: guarded one specific file. Replaced with an
  inline docstring note in run_mutmut.py.
- check_rbac_decorators: ported to tests/security/
  test_rbac_decorator_coverage.py (parametrized). Runtime auth
  tests in tests/security/ remain the authoritative deny-path
  coverage; this file guards against decorator deletion.
- check_source_patterns: ported to tests/unit/test_source_patterns.py.

Kept unchanged (genuine invariants review cannot catch):
- check_sensitive_logging — AST scan for secret variable names
  interpolated into logger calls.
- check_framework_imports — plugin framework layering boundary.
- check_logo_assets — asset-reference integrity (invisible in
  text diffs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
@jonpspri jonpspri merged commit 39f4e2f into main Apr 23, 2026
56 checks passed
@jonpspri jonpspri deleted the jps-pylint-pytest-filter branch April 23, 2026 12:17
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.

2 participants