Skip to content

ci(tidy): fail when a translation unit is read by no clang-tidy lane or excepted (ADR-1142) - #2196

Merged
lusoris merged 1 commit into
masterfrom
rc3-tidy-coverage-2
Oct 6, 2026
Merged

lusoris merged 1 commit into
masterfrom
rc3-tidy-coverage-2

Conversation

@lusoris

@lusoris lusoris commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Every tracked C, C++, CUDA, HIP, Objective-C++ and Metal translation unit is now read by a clang-tidy lane or listed with a reason and an expiry, and a check fails when one is neither (ADR-1762, popup "Gated debt first", 2026-10-05). This is the second half of #2101, which moved the readable units into lanes.

  • scripts/ci/check-tidy-coverage.py (pre-commit hooks check-tidy-coverage and test-tidy-coverage) compares the tracked units with the measured_sources of every scripts/ci/tidy-baseline-*.json and with the exception list. It reads the list through scripts/ci/lint_exceptions.py (no second format) and the tracked files through the same helper.
  • .config/lint-exceptions.d/clang-tidy-coverage.toml: 56 entries, each with a reason and an expiry (the 17 .metal kernels: upstream clang-tidy has no Metal language mode, checked against LLVM main LangStandard.h, Types.def, FrontendOptions.h on 2026-10-05; 12 MATLAB MEX sources; 11 HISS fixtures; the Pelorus mirror, one entry per file, by reference to scripts/ci/pelorus-mirror-paths.txt; the eBPF program; Windows-only, Rust-only and standalone files; core/test/test_colorspace.c (needs libzimg) and ffmpeg-patches/test/fault_inject_sycl_import.c (no meson target)).
  • cpu lane: 16 units that landed since ci(tidy): read every translation unit with a clang-tidy lane or list it with a reason (ADR-1142) #2101 recorded (0 findings).
  • write-compile-commands.py exports objc_COMPILER / objcpp_COMPILER when the project declares the languages; without them the macOS lane's compile database held no .mm file (the first hosted run measured 5 of 26 units).
  • macOS metal lane: tidy-metal.yml gains a fix dispatch input that applies clang-tidy's own fixes on the runner and uploads them as a patch. First measurement of the Objective-C++ host code: 1640 findings; after 1095 automatic fixes the macOS build compiles and the lane measures 939. tidy-baseline-metal.json records them; the ratchet refuses growth. The remaining findings are tracked as T-TIDY-METAL-HOST-FINDINGS-2026-10-05 (they need an Apple device to compile-test).

Type

  • build / ci — tooling / infra

Checklist

  • Commits follow Conventional Commits.
  • Lint: black and ruff clean on the new Python; lint_exceptions.py check 0 findings; tidy: cpu 16 units 0 findings (scripts/dev/tidy-lane.sh --write --only, clang-tidy 22.1.8).
  • Tests: test_check_tidy_coverage.py (14 cases: the planted .c outside every lane, an expired entry, an entry for a unit a lane reads, a missing file, a bad date, the Pelorus mirror only through its entry, the real tree), test_write_compile_commands.py (fails without the Objective-C rules).
  • No SIMD or GPU code path changed in behaviour; no score moves (the Metal host-code edits are clang-tidy's nullptr, const, std::cmp_* and loop fixes).
  • New files carry SPDX headers.
  • Not breaking.
  • ADR: ADR-1762 (ci(tidy): read every translation unit with a clang-tidy lane or list it with a reason (ADR-1142) #2101) covers the decision.

Bug-status hygiene

  • docs/state.md: T-TIDY-UNREAD-TRANSLATION-UNITS-2026-10-05 closed here; T-TIDY-METAL-HOST-FINDINGS-2026-10-05 opened for the 939 findings left in the Metal host code.

Netflix golden-data gate

  • I did not modify any assertAlmostEqual(...) score in the Netflix golden Python tests.

Deep-dive deliverables

  • Research digest — no digest needed: tooling.
  • Decision matrix — ADR-1762 ## Alternatives considered.
  • AGENTS.md invariant note — no rebase-sensitive invariants beyond the rebase note.
  • Reproducer / smoke-test command — below.
  • CHANGELOG fragment — changelog.d/changed/tidy-coverage-check.md.
  • Rebase note — docs/rebase-notes.md, "The tidy coverage check".

Reproducer

python3 scripts/ci/check-tidy-coverage.py                       # every tracked translation unit is read or excepted
python3 -m unittest scripts/ci/tests/test_check_tidy_coverage.py # includes the planted .c outside every lane
gh workflow run tidy-metal.yml --ref <branch>                   # macOS lane; -f fix=true for the autofix patch

Planted defect, run in this tree: a new tracked core/src/interop/planted_outside_every_lane.c makes the check print "read by no clang-tidy lane and not in the exception list" and exit 1; without it the check exits 0.

Known follow-ups

Breaking changes / migration

None.

@lusoris
lusoris force-pushed the rc3-tidy-coverage-2 branch from b4af483 to 88c5906 Compare October 5, 2026 21:45
@github-actions github-actions Bot added the type:ci CI and infrastructure label Oct 5, 2026
@lusoris
lusoris force-pushed the rc3-tidy-coverage-2 branch 2 times, most recently from 762fbad to 57bbc1d Compare October 6, 2026 00:17
@lusoris
lusoris force-pushed the rc3-tidy-coverage-2 branch 2 times, most recently from a1d9439 to 89c211b Compare October 6, 2026 03:03
…or excepted (ADR-1142) (#2196)

* ci(tidy): read the Objective-C++ units on the macOS lane and record the translation units the cpu and sycl lanes now read (ADR-1142)

* ci(tidy): let the macOS lane produce clang-tidy's own fixes as a patch (ADR-1142)

* refactor(metal): apply clang-tidy's own fixes to the Metal host code (ADR-1142)

* fix(metal): keep the headers the Metal shader compiler reads as they were (ADR-1142)

* fix(metal): declare the pointers clang-tidy marked const as const pointers, not pointers to const (ADR-1142)

* fix(metal): keep the C headers C and include <numbers> where the fixes need it (ADR-1142)

* ci(tidy): fail when a translation unit is read by no clang-tidy lane and record the Metal host code's baseline (ADR-1142)

* ci(tidy): record the translation units that landed since and list the two no lane can build (ADR-1142)

* test(tidy): annotate the coverage check's test helper (ADR-1142)

* ci(tidy): record translation units landed on master and preserve metal contract syntax (ADR-1142)

* ci(tidy): record test translation units landed on master in cpu baseline (ADR-1142)

* ci(tidy): record test and vpl translation units landed on master in cpu baseline (ADR-1142)

* ci(tidy): record sample range and metal plane index units in cpu baseline (ADR-1142)
@lusoris
lusoris force-pushed the rc3-tidy-coverage-2 branch from 89c211b to 0eef141 Compare October 6, 2026 03:24
@lusoris
lusoris merged commit 0eef141 into master Oct 6, 2026
5 of 30 checks passed
@lusoris
lusoris deleted the rc3-tidy-coverage-2 branch October 6, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:ci CI and infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants