Skip to content

ci: One Python call resolves the changed-file gate (GEN-005, refs #2683) - #2684

Merged
zackees merged 2 commits into
masterfrom
infra/check-changes-python
Oct 27, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/check-changes-python

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

Refs #2683. Refs #962.

.github/actions/check-changes/action.yaml's step was 50 lines of bash that resolved a base reference from the event and diffed it — a GEN-005 finding with no test of its own, on the path of every PR and push (and the decision point for the two data validators, the docs job and the Qt XML check).

What changed

  • ci/check_changes.py (new, uv run --no-project --script, standard library only) keeps the shell's rules exactly: an explicit baseRef as given (with the ::warning:: + useFallback → HEAD~1 path), a push's github.event.before unless forced, pull_request's origin/<base>, the merge base with the default branch for workflow_dispatch/schedule/merge queue (chore: fix small issues found during the grind run and CI speed-up #13), the empty-tree fallback, --diff-filter, and the same hasChangedFiles / compact-JSON changedFiles outputs.
  • The action's step is one line — uv run --no-project --script ci/check_changes.py --check-glob "${{ inputs.checkGlob }}" — and the action gains a pinned astral-sh/setup-uv step, because its callers do not install Python first (ci.yml's validate-data is a bare ubuntu-latest with only actions/checkout; push.yaml and scheduled.yaml likewise). The step carries the save-cache expression and the CACHE-013 pr-<N> cache-suffix.
  • ci.toml: the GEN-005 [[exceptions]] block for the action is deleted.
  • ci/test_check_changes.py (new) pins the module against a real git fixture.

Two deliberate differences, both in the callers' favour: the glob reaches git diff as one argument, so a path with a space stays one entry (the shell word-split it), and the one extglob call site !(cmake*) in push.yaml becomes git's :(exclude,top)cmake* — the same "everything except the top-level cmake* entries" bash expanded to, without needing a shell.

RED

306b97572 — ci/test_check_changes.py only: 17 tests, 3 failures + 14 errors on master (no ci/check_changes.py to import, the step is still a run: | block, the ci.toml exception is still present).

GREEN

12b07d4c5 — uv run python -m unittest ci/test_check_changes.py → 17 tests OK.

  • Differential check before committing: the old bash step (bash -e -o pipefail, same env contract) and the module were run over 12 base-reference/glob cases — valid and invalid baseRef (with and without useFallback), push before, forced push, dispatch merge base, empty glob, diffFilter, plugins/rtmp-services/data/*.json, frontend/forms/**/*.ui, !(cmake*). Outputs agree on all 12, including the fatal: bad revision exit when useFallback: false.
  • ci-lint precheck: 11 violation(s), 490 → 489 approved exception(s), 10 needs_review, and no check-changes finding remains.
  • ci/test_ci_toml.py 41 tests OK, ci/test_uv_run.py 5 tests OK, uv run --no-project ruff check clean.

No docs/features.md line: build tooling only.

RED: ci/test_check_changes.py pins the base-reference rules of
.github/actions/check-changes/action.yaml against a git fixture, and fails on
master: the module ci/check_changes.py does not exist yet, the action's step is
still a 50-line 'run: |' shell block, and ci.toml still carries its GEN-005
exception.
.github/actions/check-changes/action.yaml ran a 50-line shell block that
resolved a base reference from the event and diffed it. The step is now
'uv run --no-project --script ci/check_changes.py --check-glob <input>', the
module keeps the same base-reference rules (explicit baseRef with the
useFallback warning, a push's before commit, pull_request's origin/<base>, and
the dispatch/schedule merge base), the action installs uv itself because
ci.yml's validate-data and push.yaml install nothing before it, and the
GEN-005 exception for the action is deleted.

ci-lint precheck: 11 violation(s), 490 -> 489 approved exception(s).
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator. PR CI is green on 12b07d4c5 — CI Gate ✅ passed, and the two jobs that exercise the ported step passed with the new single-line call: Validate Data 🕵️ (19 s, both check-changes calls) and Format 🔍 / checks (1m30s, qt-xml-validator → check-changes). Auto-merge is enabled and the PR is queued.

Not stamped with the local gate: PR CI already ran the full Linux lanes on this head, and any rebase would drop a stamp anyway. Local evidence in the body (12-case differential against the old bash step, 17 fixture tests, ci-lint precheck 490 → 489 with no new finding).

Merged via the queue into master with commit 190d309 Oct 27, 2026
32 checks passed
@zackees
zackees deleted the infra/check-changes-python branch October 27, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant