Skip to content

ci: One Python call measures a warning class from the Tier 2 compdb (#2689) - #2698

Merged
zackees merged 3 commits into
masterfrom
infra/2689-warning-findings
Oct 27, 2026
Merged

zackees merged 3 commits into
masterfrom
infra/2689-warning-findings

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

Closes #2689 (acceptance items 1 and 2; item 3 is an issue edit, item 5 is a maintainer call).

Problem

The "one PR per directory" convention for warning-ratchet work (#516 and its children) appears nowhere in docs/ or .claude/ — it lives only in issue bodies — it contradicts #2625's own acceptance criteria (the split mechanism is per-directory -Wno-*, which the same issue forbids), and it multiplies an expensive CI run by the number of directories. Measured on #2643: one directory slice cost five Pull runs and 34m48s wall time for the successful one, plus a merge-queue run of the same gate.

The measurement that makes one PR per warning class practical did not exist: every worker who wanted the finding count had to hand-run ninja -t compdb, strip the zccache wrapper and rewrite -c to -fsyntax-only themselves.

RED — c63a13e04

uv run python -m unittest ci/test_warning_findings.py → 8 errors, FileNotFoundError: ci/warning_findings.py. The test drives the helper against a stub compiler over a synthetic compile_commands.json, so it needs no build tree, no CMake and no network.

GREEN — 379524300

ci/warning_findings.py reads the Tier 2 build tree's compile_commands.json:

docker run --rm -v obs-rust-linux-validate-build-<id>:/build <image> \
    sh -c 'cd /build/tree && ninja -t compdb' > /tmp/compdb.json
uv run ci/warning_findings.py --compdb /tmp/compdb.json --drop -Wno-float-conversion

For each selected C translation unit it strips the zccache/ccache wrapper, drops the -Wno-* flags named with --drop, removes the object output (-o, -MF, -MT, -MQ, -MD, -MMD, -Werror, -c), appends -fsyntax-only, runs the TUs in parallel and prints the findings grouped by directory — a table by default, --json/--out for the PR body. Exit 1 on any finding (the RED state), 0 when clean. Nothing is linked and no object is written.

uv run python -m unittest ci/test_warning_findings.py → 8 tests OK (grouping, drop, output removal, wrapper stripping, selection, clean exit, replay_argv purity).

Docs — 629eb95de

docs/rust-port/coordination.md §4 gains the policy (one PR per warning class, any number of directories, flag removed in the same change, findings table grouped by directory in the description, measured with the helper) and keeps every existing limit: explicit casts or widened types only, no behaviour change, no per-file -Wno-*, never an existing C test or public header. §2's claim line now says which case is the exception instead of implying per-file PRs.

Local checks

  • uv run python -m unittest ci/test_warning_findings.py — 8 OK
  • uv run python -m unittest ci/test_uv_run.py ci/test_ci_toml.py — 46 OK
  • uv run --no-project ruff check ci/warning_findings.py ci/test_warning_findings.py — clean
  • ./lint — ok (35.9 s)

Not in this PR

RED: ci/warning_findings.py does not exist, so all 8 cases error with
FileNotFoundError. The test drives the helper against a stub compiler over a
synthetic compile_commands.json, so it needs no build tree, no CMake and no
network.
…2689)

GREEN: ci/warning_findings.py replays only the selected translation units with
the named -Wno-* flags dropped and -c swapped for -fsyntax-only, and prints the
findings grouped by directory (a table, or --json for a PR body). It reads the
Tier 2 tree's `ninja -t compdb` output, so measuring a call-site-wide warning
class costs minutes instead of one 35-minute Pull run per directory.

uv run python -m unittest ci/test_warning_findings.py: 8 tests OK.
The per-directory slicing convention was folklore that contradicted #2625's
own acceptance criteria and turned one call-site-wide class into N Pull runs
(~35 min each) plus N merge-queue runs and N cache invalidations. Section 4
now states the shape (one PR per warning class, the flag removed in the same
change, a findings table grouped by directory in the description, measured
with ci/warning_findings.py) and keeps every limit: explicit casts only, no
behaviour change, no per-file -Wno-*, never an existing C test or public
header. Section 2's claim line says which case is the exception.
@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit d9be044 Oct 27, 2026
32 checks passed
@zackees
zackees deleted the infra/2689-warning-findings branch October 27, 2026 22:11
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.

infra: allow multi-directory edits for warning-ratchet work — per-directory PRs cost ~35 min of CI each

1 participant