Skip to content

ci: ./lint formats only the files changed since origin/master (#1050) - #1052

Merged
zackees merged 3 commits into
masterfrom
perf/1050-lint-changed-files
Oct 16, 2026
Merged

zackees merged 3 commits into
masterfrom
perf/1050-lint-changed-files

Conversation

@zackees

@zackees zackees commented Oct 16, 2026

Copy link
Copy Markdown
Member

Fixes #1050 (part of #939).

Change

Locally, ./lint runs clang-format and gersemi only on files changed since the merge-base with origin/master: committed, staged, unstaged and untracked. Before, it checked all 6,593 tracked files, about 48 s of ./lint.

Every file is still checked when:

  • running in CI (GITHUB_ACTIONS). On a PR this lane is the only format check, because check-format.yaml runs those only on pushes;
  • there's no merge-base (shallow clone, no origin/master);
  • the change touches .clang-format or .gersemirc in any directory, or ci/local_gate.py (the tool pins and file lists);
  • master changed that configuration after the branch point, so an unrebased branch can't pass against old rules. This came from review.

Unchanged files are already formatted on master, where every push checks every file. So a local stamp covers the same ground as before.

The other half of #1050 is already done by #427. The ci/ self-tests run in the Checks job, and OBS_GATE_SKIP_SELF_TEST=1 skips them in the lane, so no change is needed here.

Evidence

  • RED → GREEN: FormatScopeTest (CI, local, unknown base, config change) and FormatScopeUpstreamConfigTest fail first and pass now. All of ci/test_local_gate.py passes.
  • On this branch: the scope is all 6,593 files, correctly, because it edits ci/local_gate.py.
  • Review: a Sonnet reviewer checked for ways a misformatted file could reach master: stamps, stale refs, renames, deletions, untracked files, submodules and config files. It confirmed none. Its one actionable gap, an upstream config change, is fixed in the second commit.
    • Noted, not changed: --fix now also narrows, so it no longer reformats drift in files you didn't touch.
    • Noted, not changed: the gate caches lanes on their inputs. Narrowing doesn't change the result for an unchanged tree.

On a PR the lint lane is the only clang-format/gersemi check, so CI
(GITHUB_ACTIONS) still checks every file. Locally the lane checks only
committed, staged, unstaged and untracked changes since the merge-base
with origin/master; every file again when there is no merge-base or the
change touches .clang-format, .gersemirc or the pins in ci/local_gate.py.

Refs #1050
…nfig

Review finding: an unrebased branch whose base predates a clang-format
or gersemi pin bump (or a .clang-format change) would pass the narrowed
local check against the old rules. Configuration that changed between
the merge-base and origin/master now counts as changed, so every file
is checked.
@zackees
zackees enabled auto-merge October 16, 2026 09:22
@zackees
zackees added this pull request to the merge queue Oct 16, 2026
Merged via the queue into master with commit 520b5f9 Oct 16, 2026
20 checks passed
@zackees
zackees deleted the perf/1050-lint-changed-files branch October 26, 2026 15:45
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.

perf: ./lint: own lane for build-and-run self-tests; clang-format only changed files locally

1 participant