Skip to content

infra(ci): replay the conversion ratchet with clang in the sanitizer lane (#3118) - #3120

Merged
zackees merged 4 commits into
masterfrom
fix/3118-clang-replay-lane
Oct 31, 2026
Merged

zackees merged 4 commits into
masterfrom
fix/3118-clang-replay-lane

Conversation

@zackees

@zackees zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member

The clang replay landed in #3119 with no caller. This wires it into the lane that
already builds the app for a ratchet change, and fixes the eight sites it reports
on today's tree.

Refs #3118. Closes it once the lane runs green on a dispatched pass.

RED

ci/test_conversion_clang_replay.py on master cannot import exit_status, and
ci/test_sanitize_harness.py reports
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON' not found in [...]
(commit 5cd232a40).

The replay over this checkout's configured tree (build/compile_commands.json,
73 unity groups) on master:

$ uv run --no-project ci/conversion_clang_replay.py --compdb build/compile_commands.json
libobs/obs-source-transition.c.h:836:38: implicit conversion loses integer precision: 'size_t' to 'enum obs_transition_target'  [libobs]
plugins/linux-pipewire/camera-portal.c.h:1062:20: implicit conversion loses integer precision: 'long long' to 'enum spa_media_subtype'  [plugins/linux-pipewire]
plugins/linux-v4l2/v4l2-busy.c.h:168:34: implicit conversion changes signedness: 'int' to 'uint32_t'  [plugins/linux-v4l2]
plugins/linux-v4l2/v4l2-input.c.h:150:65: implicit conversion changes signedness: 'int' to 'enum video_range_type'  [plugins/linux-v4l2]
plugins/obs-filters/hdr-tonemap-filter.c.h:72:22 / :82:41  'long long' to 'enum hdr_tonemap_transform'  [plugins/obs-filters]
plugins/obs-filters/sdr-on-hdr-filter.c.h:67:18 / :74:32  'long long' to 'enum sdr_on_hdr_gamma'  [plugins/obs-filters]
replayed 73 group(s) with clang in 6.7s: 4 group(s) with conversion findings, 10 uncovered, 4 failed to parse

Two of the four directories (libobs, obs-filters) are compiled by the macOS
app lane, so those were escapes waiting for the next nightly — the class that
cost the daily run 41083530569 (#3084, #3090, #2921).

GREEN

  • The eight sites state the conversion the compiler already performed. No
    value changes, no -Wno-*, no per-file exemption; all six files are product
    sources (no existing C test edited). Same command after:
    replayed 73 group(s) ... 0 group(s) with conversion findings.
  • The asan pass replays the tree with clang. sanitize.py's configure line
    exports compile_commands.json, and one step in sanitizers.yaml runs
    uv run --no-project ci/conversion_clang_replay.py --compdb "$SAN_OUT/build-asan/compile_commands.json" --allow-uncovered — ~7 s, nothing
    built or linked. The asan pass is the lane ci_scope.py already selects for a
    PR that changes a ratcheted target (bug: master's Sanitizers lane is red — asan finds 8 conversion sites the Tier 2 build never compiles, valgrind finds a v4l2 format mismatch #2923), so the PR that opts a target in
    pays for its own clang check.
  • --allow-uncovered is the lane's tolerance. The sanitizer configuration
    deliberately turns vlc, vst, webrtc and the decklink plugins off, so those
    ratcheted directories have no group in that tree: they are reported, not
    failed. A finding or a group that did not parse is still red; the strict
    default (every ratcheted directory covered) stays for a full app tree.

Evidence

Check Result
uv run python -m unittest ci.test_conversion_clang_replay ci.test_sanitize_harness from ci/ 35 tests, OK
uv run ci/local_gate.py --only self-test == self-test: ok
uv run ruff check on the four touched Python files clean
clang-format --dry-run --Werror on the six C sources clean
ci-lint precheck 4 violation(s), 364 approved exception(s), 2 needs_review, identical to origin/master (diffed, no delta)
replay before / after 8 findings in 4 groups / 0 findings

Not verified locally, stated plainly: the replay inside the sanitizer image. This
checkout's compdb cannot parse four groups (X11/X.h, va/va.h are not on its
include path — the same Nix deps gap #3119 recorded), so the local run reports 4
failed-to-parse; the sanitizer build configures those targets from the apt deps,
and the dispatched pass below is the acceptance evidence.

Acceptance

gh workflow run sanitizers.yaml --ref fix/3118-clang-replay-lane -f tools=asan
— the new step must print 0 group(s) with conversion findings and the job must
stay green.

Not handed off: a workflow-graph change is watched through merge.

…3118)

The replay tool landed in #3119 with no caller. This adds the two pins the
caller needs before it can be wired in: the verdict function behind the exit
status (a finding and a group that did not parse are red, a ratcheted
directory a lane tree does not build is not), and the compile database on the
sanitizer configure line the replay reads.

Red on master: ci/test_conversion_clang_replay.py cannot import exit_status and
test_sanitize_harness' configure case reports
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON' not found.
…3118)

Replaying this tree's unity groups with clang (#3119) reports eight sites the
gcc configuration does not, all in directories the ratchet already covers:

  libobs/obs-source-transition.c.h:836   size_t -> enum obs_transition_target
  plugins/obs-filters/hdr-tonemap-filter.c.h:72,82
  plugins/obs-filters/sdr-on-hdr-filter.c.h:67,74
  plugins/linux-v4l2/v4l2-busy.c.h:168   int -> uint32_t
  plugins/linux-v4l2/v4l2-input.c.h:150  int -> enum video_range_type
  plugins/linux-pipewire/camera-portal.c.h:1062

Each is the explicit conversion the compiler already performed implicitly, so
no value changes and no warning is disabled. Two of the four directories
(libobs, obs-filters) are compiled by the macOS app lane, so these were escapes
waiting for the next nightly rather than Linux-only curiosities.

Verify: uv run --no-project ci/conversion_clang_replay.py --compdb
build/compile_commands.json before (8 findings, 4 groups) and after (0).
…lane (#3118)

The ratchet is checked by whichever configuration compiles the target, and
every Linux one of those is gcc; gcc has no -Wimplicit-int-conversion and a
narrower -Wsign-conversion set, so a target can pass its own gcc replay and
still fail the nightly's AppleClang app build (#3084, #3090, #2921 in one
week).

The sanitizer asan job already builds the whole app on the PR that changes a
ratcheted target (#2923, ci/conversion_ratchet.py), so it is the lane that can
afford a second compiler. Its configure line now exports
compile_commands.json, and one step replays every unity group with
clang -fsyntax-only plus the three conversion groups: 73 groups in ~7 s, no
build and no link.

--allow-uncovered exists because the sanitizer configuration deliberately
turns vlc, vst, webrtc and the decklink plugins off: those ratcheted
directories have no group in the tree and are reported, not failed. A real
finding or a group that did not parse is still red. The strict default stays
for a full app tree.
The sanitizer tree configures zccache as CMAKE_C_COMPILER_LAUNCHER, so its
compile database entries read "zccache <compiler> <flags> …". Replacing only
the first token handed clang the real compiler path as an input file, so the
lane would have failed on every group. Drop the leading non-flag tokens and
pin it with a case over a launched entry.
@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Prediction from an independent tree, worth checking before the asan pass finishes: this lane will report 16 more sites than the eight this PR fixes, all in one file set.

I had started the same wiring as a Tier 2 step and measured the replay on a full app tree (257 unity groups, ENABLE_FRONTEND=OFF, zccache not in the compdb — which is why I did not hit the launcher problem you fixed). Removing the pins, clang reports these in libobs, a ratcheted directory, in addition to the eight:

File Sites Diagnostic
libobs/graphics/libnsgif/lzw.c.h 7 int/uint32/uint16 -> uint8 truncations, int -> uint32_t
libobs/graphics/libnsgif/gif.c.h 5 int/long -> size_t, uint32_t -> int, long -> uint32_t
libobs/graphics/libnsgif/gif-blocks.c.h 2 int -> size_t, int -> uint32_t
libobs/graphics/libnsgif/gif-frame.c.h 2 long -> size_t

23 distinct sites in total, by directory: libobs 17 (one obs-source-transition.c.h — fixed here — and the 16 above), plugins/linux-v4l2 2, plugins/obs-filters 2, plugins/linux-pipewire 1, plugins/obs-nvenc 1 (cuda-load.c.h: ptrdiff_t -> uintptr_t).

The obs-nvenc one may not appear in the sanitizer tree if ENABLE_NVENC=OFF there; libnsgif will, because it is compiled into the libobs target and the ratchet is per directory, so the whole target counts. exit_status returning 1 on any finding means the asan job fails on them unless this PR fixes or baselines them. If the intent is "the lane must be clean", the libnsgif block is 16 sites of vendored decoder arithmetic and probably wants its own issue; a --baseline-style exception list or a scoped allowlist would get the lane green without it.

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review: correct. This edits the existing sanitizers.yaml rather than adding a workflow file. Running the replay only on the asan pass pays for it once. --allow-uncovered is opt-in, so the unit test keeps the strict default. The launcher skip drops every non-flag token before the first flag, which handles zccache /usr/bin/cc, and the new test pins it. RED is recorded. The eight C fixes are the sites the replay reports. Watch the dispatched pass that the body says closes #3118.

@zackees
zackees enabled auto-merge October 31, 2026 02:20
@zackees
zackees added this pull request to the merge queue Oct 31, 2026
@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Checked against the real lane before queueing — the prediction did not hold on this tree. The asan pass on 521c92f replayed its own compile database and reported zero findings:

##[group]Run uv run --no-project ci/conversion_clang_replay.py --compdb "$SAN_OUT/build-asan/compile_commands.json" --allow-uncovered
replayed 140 group(s) with clang in 14.8s: 0 group(s) with conversion findings, 10 uncovered, 0 failed to parse

So libobs/graphics/libnsgif/* produced no -Wconversion diagnostics in the sanitizer configuration, and the job went green without a baseline or an allowlist. Two likely reasons the full app tree measurement differs: the replay parses the entry's unity group (*+.h.c), not the individual .c.h translated unit, and each of those libnsgif files pulls a generated build/libobs-ported-nsgif-<name>.pch.h that only exists in a configured tree — a hand-run clang -fsyntax-only on the .c.h directly fails on that include, so a site list gathered that way is not comparable to what the lane sees.

That makes the ratchet's own verdict the evidence here: 140 groups, 0 findings, 0 parse failures. I am not adding a baseline for a set the lane does not report.

@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator

Queue position 1 (AWAITING_CHECKS) after a fully green PR run, including the new lane: Build 🧱 / Sanitize 🧪 / asan 🧪 succeeded (build 02:03–02:49 UTC) and its replay step reported replayed 140 group(s) with clang in 14.8s: 0 group(s) with conversion findings, 10 uncovered, 0 failed to parse. Every other job was SUCCESS or correctly SKIPPED.

Refs #3118 — the lane is wired, runs, and passes on its own tree; #3118 closes when this lands.

Merged via the queue into master with commit 52642bd Oct 31, 2026
43 checks passed
@zackees
zackees deleted the fix/3118-clang-replay-lane branch October 31, 2026 02:57
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In review to Done in obs-rust Multiview Oct 31, 2026
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