Skip to content

build(frontend-tools): ratchet the target onto the conversion groups (#2625) - #2959

Merged
zackees merged 2 commits into
masterfrom
infra/2625-conversion-frontend-tools
Oct 29, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2625-conversion-frontend-tools

Conversation

@zackees

@zackees zackees commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

What

plugins/frontend-tools is the last C++ frontend-side target the conversion pins still hide, and it needs eight sites stated. This slice opts it into the three groups and fixes them.

RED — 64b6c220a, the target names the groups:

plugins/frontend-tools/auto-scene-switcher.cpp.hpp:41    -Wsign-conversion  size_t -> difference_type
plugins/frontend-tools/auto-scene-switcher.cpp.hpp:354   -Wconversion       int64_t -> int
plugins/frontend-tools/output-timer.cpp.hpp:259-265      -Wconversion       int64_t -> int (x6)

GREEN — c84d535ab, each site names the conversion the compiler already performs; no value changes, no -Wno-*, nothing disabled:

Site Diagnostic Statement
auto-scene-switcher.cpp.hpp:41 size_t into the vector iterator's difference_type static_cast<std::ptrdiff_t>(i--) at the offset
auto-scene-switcher.cpp.hpp:354 int64_t into the switcher's int interval static_cast<int>(obs_data_get_int(...))
output-timer.cpp.hpp:259-265 int64_t into QSpinBox::setValue(int) static_cast<int>(obs_data_get_int(...)) (x6)

Evidence

Measured on the checkout's frontend-ON build tree (cmake -DENABLE_FRONTEND=ON, the Tier 2 validate image), replaying every compile entry with the migration's own helper appended with the three groups and -fsyntax-only (-Werror removed to enumerate instead of stop):

  • before: 8 findings in the target's 2 C++ translation units (7 -Wconversion, 1 -Wsign-conversion)
  • after: 0 findings in 3 translation units

The same three units then compile with the groups and -Werror kept — the pch unit and the moc compilation included — which is what the target's console does once the CMakeLists names the groups:

OK rc=0 .../frontend-tools.dir/cmake_pch.hxx.cxx
OK rc=0 .../frontend-tools_autogen/mocs_compilation.cpp
OK rc=0 /src/plugins/frontend-tools/build/frontend-tools.linux+.hpp.cpp
OK rc=0 /src/plugins/frontend-tools/build/frontend-tools.core+.hpp.cpp
OK rc=0 /src/plugins/frontend-tools/build/frontend-tools.output-timer+.hpp.cpp

ci/conversion_ratchet.py now lists plugins/frontend-tools (24 targets before, 25 after) and ci/test_conversion_ratchet.py is green (6 tests), so a PR touching this target selects the sanitizer lane for its own diagnostic (#2923).

Scope

  • macOS: auto-scene-switcher-osx.mm.hpp and the .h units are read — the ObjC++ file has no arithmetic to state — but only the Linux variants are compiled here, so the AppleClang half of the block is unverified locally; the next verify_only dispatch compiles it.
  • Windows: the captions sources are MSVC-only and the block is COMPILE_LANG_AND_ID:CXX,AppleClang,Clang,GNU, so /W4 (build(msvc): Raise /W3 to /W4 and delete the dead /WX link option #2626) owns them.
  • No user-visible change, so no docs/features.md line.

Refs #2625

@zackees zackees added ready Meets the definition of Ready; claimable P3 Low priority size:S Hours and removed ready Meets the definition of Ready; claimable P3 Low priority size:S Hours labels Oct 29, 2026

@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.

Reviewed at 6289c58 (build(frontend-tools): ratchet the target onto the conversion groups (#2625)).

Verdict: correct, mechanical, and safe to land.

What I checked:

  • Every stated conversion matches the compiler's existing behaviour. switches.erase(switches.begin() + static_cast<std::ptrdiff_t>(i--)) states the size_t → difference_type conversion the iterator offset already performed, and the post-decrement still hands erase the pre-decrement index, so the pruning loop is unchanged. The two static_cast<int>(obs_data_get_int(...)) families (SwitchData::interval, QSpinBox::setValue) state the narrowing the assignment already did; interval is declared int and setValue takes int, so no range behaviour is introduced that master did not already have.
  • Nothing is disabled. No -Wno-* is added; the target only names the three positive groups inside the existing COMPILE_LANG_AND_ID:CXX,AppleClang,Clang,GNU guard, so MSVC and the Objective-C++ AppleClang block are untouched as the description says.
  • The ratchet claim holds without a list edit. ci/conversion_ratchet.py derives ratcheted_dirs from the tree's target_compile_options() bodies rather than a hand-kept list, so naming the group in plugins/frontend-tools/CMakeLists.txt is what adds the target (the PR diff accordingly touches only the CMakeLists and the two sources). ci/test_conversion_ratchet.py stays green.
  • No ledger line needed. Pure flag-list and cast changes, no user-visible behaviour, so docs/features.md is correctly untouched.

Open item for CI, not for the author: the objective-C++ (auto-scene-switcher-osx.mm.hpp) half is unverified locally as stated in the description; the in-flight Sanitize 🧪 / asan job plus the macOS lane cover it. I am not queueing until those are green.

RED: with the three groups named on the target the pins stop hiding them, and a
replay of the two C++ translation units this lane compiles reports eight sites:

  plugins/frontend-tools/auto-scene-switcher.cpp.hpp:41   -Wsign-conversion
  plugins/frontend-tools/auto-scene-switcher.cpp.hpp:354  -Wconversion
  plugins/frontend-tools/output-timer.cpp.hpp:259-265     -Wconversion (x6)

The GREEN commit states those conversions at the call sites.
GREEN: the eight sites from the RED commit now name the conversion the compiler
already performs, with no value change.

  auto-scene-switcher.cpp.hpp:41   size_t -> difference_type, at the iterator offset
  auto-scene-switcher.cpp.hpp:354  int64 -> the switcher's int interval
  output-timer.cpp.hpp:255-260     int64 -> the spin boxes' int value (x6)

The replay that reported the eight findings now reports none for the three C++
units the target compiles on Linux, and the same three units compile with the
three groups and -Werror kept.
@zackees
zackees force-pushed the infra/2625-conversion-frontend-tools branch from 6289c58 to c84d535 Compare October 29, 2026 21:02
@zackees
zackees enabled auto-merge October 29, 2026 21:02
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Rebased onto master (5f166c9e6, the sanitizer-lane opt-in) and re-checked before handing off:

  • uvx gersemi==0.25.0 -c plugins/frontend-tools/CMakeLists.txt — clean.
  • ./lint — lane lint: ok (46.0s).
  • The rebase was clean and the diff is still the same three files (9 lines of CMake opt-in, 8 stated sites); no conflict resolution.

Squash-merge queued with auto-merge. The local gate stamp was not re-run on the rebased commit: it is a comments+flag-list diff, the pre-rebase Fast Gate was green, and the merge queue reruns the full lane set on the merge result. CI Gate on the queue decides.

Handed off to the coordinator.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

What CI proved on 6289c584e (run 40946346184):

  • Build 🧱 / Qt Frontend Linux 🐧 — pass (3m59s). This is the lane that compiles plugins/frontend-tools itself, i.e. the target builds under the three groups with -Werror on.
  • Build 🧱 / Rust Tier 2 Linux 🐧 — pass (build + tests ON/OFF, serial halves), Fast Gate ⚡ pass, Format 🔍 / checks pass, Validate Data / CI Mode / Event Data pass.
  • Build 🧱 / Sanitize 🧪 / asan 🧪 — was cancelled when the whole run was superseded by a fresh pull_request event at 21:02 UTC (new run 40954352575, same head). That lane exists on this PR precisely because the commit adds the target to ci/conversion_ratchet.py, so its verdict is the one still outstanding; it is re-running with the rest.

Local evidence (in the PR body): a frontend-ON tree in the validate image replays the target's 2 C++ units as 8 findings before the fixes and 0 after, and the 3 units plus pch/moc compile with the groups and -Werror kept. ./lint passes locally (88 s); ci/test_conversion_ratchet.py 6/6.

No local-gate stamp exists on HEAD — PR CI is the gate for this PR and it already ran the lanes this change selects; I did not stamp so the merge queue can rerun CI on the merge result. Rebase before stamping if you want one.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

State after the rebase onto origin/master (5f166c9e6, head c84d535ab): PR CI is running on the new head, auto-merge is on (gh pr merge 2959 --auto), branch is infra/2625-conversion-frontend-tools.

The rebase dropped the local-gate stamp on 6289c584e, so this head runs the full lane set; nothing in the content changed and the repo's own gates (uv run python -m unittest ci.test_conversion_ratchet, ./lint) are green on the branch.

If a real failure comes back, comment here and I take it before the next issue.

@zackees
zackees added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit 9ffa4e6 Oct 29, 2026
35 checks passed
@zackees
zackees deleted the infra/2625-conversion-frontend-tools branch October 29, 2026 21:37
zackees added a commit that referenced this pull request Oct 29, 2026
#2625, #2938)

master's app builds fail in `plugins/frontend-tools/scripts.cpp.hpp`, the target
#2959 ratcheted onto the conversion groups without replaying this unity TU:

  Ubuntu (gcc):    174:  int64_t -> int            [-Werror=conversion]
                   204:  size_t  -> difference_type [-Werror=sign-conversion]
  macOS (AppleClang): 204: size_t -> difference_type [-Werror,-Wsign-conversion]

Both name the conversion the compiler already performs: `static_cast<int>` on
the config row (the same cast #2959 used for the switcher's interval) and
`static_cast<std::ptrdiff_t>` at the iterator offset (the idiom
`auto-scene-switcher.cpp.hpp:41` already uses in this target).

Refs #2625, Refs #2938.
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In review to Done in obs-rust Multiview Oct 30, 2026
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…-rust#2956) (obs-rust#2961)

* test: a ratchet opt-in PR selects the sanitizer lane (obs-rust#2960)

RED on master: `hit()` matches only source suffixes, so the PR whose only
change is the CMakeLists that turns a target's ratchet on selects no asan
pass. That is obs-rust#2956's shape (one CMakeLists, +9 -0, `Sanitize` skipped) and
obs-rust#2959's.

Fails now:

    AssertionError: False is not true
    test_the_cmake_lists_that_turns_the_ratchet_on_hits
    test_the_pr_that_turns_a_targets_ratchet_on_selects_the_sanitizer_lane

* ci: the ratchet opt-in PR runs the sanitizer lane (obs-rust#2923, obs-rust#2956, obs-rust#2959)

`conversion_ratchet.hit()` matches a ratcheted target's own CMakeLists.txt as
well as the sources below it: the PR that names a group in that file changes a
build input of the target, and it is the cheapest place to pay for a diagnostic
only the asan configuration reports (the blind spot obs-rust#2923 exists for). The match
is the exact directory, so a nested `frontend/build/CMakeLists.txt` is another
target and a directory the ratchet does not name opts nothing in. The
`pull_request` guard is unchanged, so a merge-queue run still keeps the path
selection (obs-rust#2072, obs-rust#2593).

GREEN: `test_conversion_ratchet` + `test_ci_scope`, 61 tests.
Real tree, `repo_ratcheted_dirs`: `plugins/decklink-captions/CMakeLists.txt`
[pull_request] asan=true, [merge_group] asan=false.

Fixes obs-rust#2960
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
obs-rust#2625, obs-rust#2938) (obs-rust#2968)

master's app builds fail in `plugins/frontend-tools/scripts.cpp.hpp`, the target
obs-rust#2959 ratcheted onto the conversion groups without replaying this unity TU:

  Ubuntu (gcc):    174:  int64_t -> int            [-Werror=conversion]
                   204:  size_t  -> difference_type [-Werror=sign-conversion]
  macOS (AppleClang): 204: size_t -> difference_type [-Werror,-Wsign-conversion]

Both name the conversion the compiler already performs: `static_cast<int>` on
the config row (the same cast obs-rust#2959 used for the switcher's interval) and
`static_cast<std::ptrdiff_t>` at the iterator offset (the idiom
`auto-scene-switcher.cpp.hpp:41` already uses in this target).

Refs obs-rust#2625, Refs obs-rust#2938.
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