Skip to content

fix(frontend): keep the app target's Apple conversion pin through the interface group (#3096) - #3102

Merged
zackees merged 3 commits into
masterfrom
fix/3096-macos-app-lane-conversion
Oct 30, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/3096-macos-app-lane-conversion

Conversation

@zackees

@zackees zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member

Refs #3096.

Root cause

The macOS app lane still stopped in Qt 6.11's own headers after the app target's
-Wno-sign-conversion pin. The pin was applied, but obs-studio links
OBS::properties-view, whose conversion groups are INTERFACE options. Those
land after the target's own options, so the interface's -Wsign-conversion
re-enabled the group inside qversiontagging.h, qnamespace.h:1926/1930/1935.

Evidence from the dispatched macOS run on the previous head (41119526629, job
124283138874), after the if(OS_MACOS) pin in frontend/CMakeLists.txt:

##[error]implicit conversion changes signedness: 'int' to 'quintptr' ... [-Werror,-Wsign-conversion]
   80 |         : symbol(sym), version(currentVersion)
##[error]implicit conversion changes signedness: 'Int' to 'int' ... [-Werror,-Wsign-conversion]
 1926 |         : combination(modifiers.toInt() | int(key))

What

  1. frontend/CMakeLists.txt — state the app target's Apple pin in an
    if(OS_MACOS) branch. The Xcode generator does not apply the Darwin half of a
    $<NOT:$<PLATFORM_ID:Darwin>> genex in target_compile_options (build(frontend): keep the sign-conversion ratchet off the Darwin TUs (#2950) #2979), so
    the earlier nested genex never reached the TUs.
  2. shared/properties-view/CMakeLists.txt — the target is INTERFACE; state its
    three-group opt-in on the non-Apple branch and keep -Wno-sign-conversion on
    OS_MACOS, so a consumer's own pin cannot be overridden by the linked
    interface. This is the interim shape build(cmake): Drop the conversion pins (-Wno-conversion, -Wno-sign-conversion, -Wno-float-conversion) #2625 already uses for the app target;
    the Darwin hole is tracked by build: restore the frontend -Wsign-conversion ratchet on the Darwin TUs once the Qt 6.11 prefixes leave it (#2950, #2625) #2989.
  3. frontend/components/VolumeMeterSnapshot.hpp:32 — state the
    uint64_t -> double nanosecond delta conversion that AppleClang reports with
    -Wimplicit-int-float-conversion.

RED/GREEN

RED 36293c4f4 — the extended ci/test_frontend_conversion_optins.py fails on
the previous tree (darwin_branch is None, and properties-view has no
OS_MACOS branch). GREEN 494781525 — 5 tests pass; uvx gersemi --check on
the changed CMakeLists is clean; ./lint is ok.

The macOS lane itself is the acceptance: a dispatched scheduled.yaml run on
this head must compile frontend.sparkle+.hpp.cpp and the Qt 6.11 headers
without -Werror,-Wsign-conversion.

No docs/features.md line: no user-visible behaviour changes.

Test cost: no new Rust tests; the added checks are sub-millisecond text assertions.

…ator applies (#3096)

The Darwin half of the app target's conversion genex does not reach macOS app
TUs: master's release-gate macOS jobs stop in Qt 6.11's own headers
(qversiontagging.h:80, qnamespace.h:1926/1930/1935) with
-Werror,-Wsign-conversion even though frontend/CMakeLists.txt asks for the
opposite. Assert the pin as an if(OS_MACOS) branch instead, which no generator
can drop, and fail while the tree states it inside $<NOT:$<PLATFORM_ID:Darwin>>.

Red: uv run python -m unittest ci/test_frontend_conversion_optins.py
FAIL: test_darwin_pins_the_group_in_a_branch_the_xcode_generator_honours
  '$<NOT:$<PLATFORM_ID:Darwin>>' unexpectedly found
#3096)

The macOS app lane builds with the Xcode generator, and a
$<NOT:$<PLATFORM_ID:Darwin>> genex inside target_compile_options does not reach
its TUs: master's release-gate macOS jobs stop in Qt 6.11's own headers
(qversiontagging.h:80 "int to quintptr", qnamespace.h:1926/1930/1935) with
-Werror,-Wsign-conversion although frontend/CMakeLists.txt asks for the
opposite, so #2979's guard never took effect on that generator.

State the two platforms as an if(OS_MACOS)/else branch: Apple gets the
-Wno-sign-conversion pin as a real compile option, the other lanes keep the
ratcheted group. Linux/Windows configure output is unchanged (checked on a
scratch project: the flag is still in the non-Darwin FLAGS).

Same lane, second diagnostic: frontend.widgets+.hpp.cpp stops on
frontend/components/VolumeMeterSnapshot.hpp:32, "implicit conversion from
'uint64_t' to 'double' may lose precision" (-Wimplicit-int-float-conversion),
which AppleClang reports by default. State the conversion at the call site.

Green: uv run python -m unittest ci/test_frontend_conversion_optins.py (3 tests
OK), ./lint ok (gersemi reformat of the new branch).

Refs #3096
The target's conversion flags are INTERFACE, so they reach the app target's
Apple TUs after the target's own -Wno-sign-conversion and re-enable the group
inside Qt 6.11's headers. State the pin on an OS_MACOS branch, the shape the
Xcode generator honours.
@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

macOS lane acceptance passed on head 494781525: dispatched scheduled run 41123124035 — Build 🧱 / macOS 🍏 (x86_64) and Build 🧱 / macOS 🍏 (arm64) both success, and Analyze / macOS (clang-analyze) success. The previous head stopped at qversiontagging.h:80 / qnamespace.h:1926; this head compiles both app targets. Flatpak and the remaining jobs are still running.

@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: looks right. Replacing the $<NOT:$<PLATFORM_ID:Darwin>> genex with an if(OS_MACOS) branch is the plain way to make sure the Xcode generator applies the pin, and pinning properties-view's INTERFACE group the same way closes the leak into Apple consumers. The ratchet tests strip comments before matching, so a comment can't satisfy them, and they cover both targets. The real proof is the macOS app lane, which only runs on schedule or dispatch, so watch the next nightly.

@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

The fix works, but the stated cause is not the mechanism — and that matters for the next ratchet

The macOS acceptance on 494781525 (run 41123124035, both app builds + clang-analyze success) is the outcome that counts, and the shared/properties-view/CMakeLists.txt branch is load-bearing. Two corrections, because the comments and the new test docstring now assert something about CMake that I could not reproduce, and a false origin story is what gets copied into the next ratchet.

1. The nested Darwin genex does expand — in both generators.

A scratch project with the exact shape #2979 used resolves to the flags when the inner condition is true and to nothing when it is false:

target_compile_options(pv INTERFACE "$<$<COMPILE_LANG_AND_ID:CXX,...>:$<$<NOT:$<PLATFORM_ID:Darwin>>:-Wconversion;-Wsign-conversion;-Wfloat-conversion>>")
target_compile_options(probe INTERFACE "$<$<COMPILE_LANG_AND_ID:CXX,...>:$<$<PLATFORM_ID:Darwin>:-Wfalse-branch-leaked>>")

$ cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON …
/run/current-system/sw/bin/c++ -Wno-conversion -Wno-sign-conversion -Wno-float-conversion \
    -Wconversion -Wsign-conversion -Wfloat-conversion -o CMakeFiles/app.dir/main.cpp.o -c …/main.cpp

The flags arrive, and the control probe's false branch leaves no -Wfalse-branch-leaked behind: a nested boolean that evaluates to 0 collapses to empty, which is the documented $<condition:content> special case. So the genex was never the reason the app lane stayed red, and the if(OS_MACOS) rewrite in frontend/CMakeLists.txt is belt-and-braces rather than the fix.

2. The mechanism is INTERFACE ordering, plus -Wconversion re-enabling the sign group.

CMake appends a linked library's INTERFACE options after the consumer's own options and after the directory pins. From the same probe, with the app target also carrying a real -Wno-sign-conversion:

c++ -Wno-conversion -Wno-sign-conversion -Wno-float-conversion   # directory (compilerconfig.cmake)
    -Wconversion -Wsign-conversion -Wfloat-conversion            # OBS::properties-view INTERFACE
    … -c app.cpp

and with clang, a preceding negative does not survive a later positive:

$ clang++ -fsyntax-only -Wno-sign-conversion -Wconversion t.cpp
t.cpp:1:41: warning: implicit conversion changes signedness: 'unsigned int' to 'int' [-Wsign-conversion]
$ clang++ -fsyntax-only -Wconversion -Wno-sign-conversion t.cpp      # silent
$ clang++ -Wno-conversion -Wno-sign-conversion -Wno-float-conversion -Wconversion -Wsign-conversion -Wfloat-conversion -Werror -I mini mini/main.cpp
mini/fauxqt.h:1:49: error: implicit conversion changes signedness: 'unsigned int' to 'int' [-Werror,-Wsign-conversion]
# same line minus the interface block: clean

That is the exact diagnostic text the macOS lane printed inside qversiontagging.h / qnamespace.h. Which means: -Wconversion alone re-enables -Wsign-conversion diagnostics, so on Apple the interface block must contribute none of the three groups (which is what this PR's branch does), and a -Wno-sign-conversion on the consumer side is not a pin either.

3. Suggested edits (not blocking the merge of this PR's fix):

  • frontend/CMakeLists.txt comment and the ci/test_frontend_conversion_optins.py docstring: drop "the Xcode generator does not apply the Darwin half of the genex". If the branch shape is preferred for robustness, say that instead; test_darwin_pins_the_group_in_a_branch_the_xcode_generator_honours currently pins a claim as if it were a CMake fact.
  • The class-level gap stays open: any future INTERFACE conversion ratchet re-breaks this the same way, and it is invisible to PR CI because no PR lane builds the app. I have a tree-wide check (ci/test_conversion_ratchet_interface.py: every target_compile_options(... INTERFACE ...) naming a positive conversion group must exclude Darwin, in either the genex or the branch shape) that fails on the pre-fix(frontend): keep the app target's Apple conversion pin through the interface group (#3096) #3102 tree, naming shared/properties-view/CMakeLists.txt and the three groups. Happy for it to land as a follow-up once this merges — it is additive to the two tests added here, not a replacement.

@zackees
zackees added this pull request to the merge queue Oct 30, 2026
Merged via the queue into master with commit 91a9934 Oct 30, 2026
83 of 84 checks passed
@zackees
zackees deleted the fix/3096-macos-app-lane-conversion branch October 30, 2026 21:44
@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Closing the loop on the three corrections: #3106 has them.

  • The comments/docstrings in frontend/CMakeLists.txt, shared/properties-view/CMakeLists.txt and ci/test_frontend_conversion_optins.py no longer claim the Xcode generator drops the Darwin half of a genex; they state the INTERFACE-ordering mechanism (-Wconversion re-enabling -Wsign-conversion after the consumer's own pin) and describe the if(OS_MACOS) branch as the shape, not the cause. The test is renamed test_darwin_states_the_pin_in_a_branch.
  • The class-wide check landed there as conversion_ratchet.interface_darwin_violations() + ci/test_conversion_ratchet.py: it reports shared/properties-view/CMakeLists.txt: properties-view on the pre-fix(frontend): keep the app target's Apple conversion pin through the interface group (#3096) #3102 tree and nothing on this one.

chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 31, 2026
…t#3096) (obs-rust#3106)

* docs(ci): state the INTERFACE ordering as the cause, not the genex (obs-rust#3096)

The removed comments claimed the Xcode generator does not apply the Darwin
half of a `$<NOT:$<PLATFORM_ID:Darwin>>` genex. A scratch project with the
same shape shows the genex expands in both generators, so that was never the
mechanism: `OBS::properties-view` adds its groups as INTERFACE options, CMake
appends them after the consumer's own, and `-Wconversion` re-enables
`-Wsign-conversion` diagnostics. Only the INTERFACE block can fix it; the
`if(OS_MACOS)` branch stays because it keeps the pin a visible compile option.

No code change: comments, docstrings and one test name.

* test(ci): pin Darwin out of every INTERFACE conversion group (obs-rust#3096)

`target_compile_options(<t> INTERFACE -Wconversion ...)` is appended to every
consumer's compile line after the consumer's own options, and `-Wconversion`
re-enables `-Wsign-conversion` diagnostics, so a consumer-side
`-Wno-sign-conversion` is not a pin. That is how the macOS app lane kept
stopping inside Qt 6.11's headers after obs-rust#2979, and no PR lane builds the app,
so the class has no CI oracle of its own.

`interface_darwin_violations()` reads it from the tree: a positive group in an
INTERFACE call must either exclude Darwin with a `$<NOT:$<PLATFORM_ID:Darwin>>`
genex or sit in the `else()` branch of an `if(OS_MACOS)` block. Comments are
stripped first, so a commented-out guard cannot satisfy the check.

RED: on `91a9934ed^` the tree-level check reports
`shared/properties-view/CMakeLists.txt: properties-view`, the file obs-rust#3102 fixed.
GREEN: it reports nothing on this tree; the five fixture cases cover the bare
group, both exempt shapes, a comment-only guard and a pinned call.
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