Skip to content

build(idian): ratchet the target onto the conversion groups (#2625) - #2966

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

zackees merged 2 commits into
masterfrom
infra/2625-conversion-idian

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Slice of the conversion ratchet (#2625): shared/qt/idian opts into
-Wconversion, -Wsign-conversion and -Wfloat-conversion, and the nine
diagnostics that surfaces are stated at the call site.

RED — 47c86a1b6

shared/qt/idian/CMakeLists.txt names the three groups for C++. Replaying the
target's shared/qt/idian/build/idian.core+.hpp.cpp unity TU with the global
-Wno-* pins removed reports 9 implicit conversions, all in
components/ToggleSwitch.cpp.hpp:

Site Diagnostic Count
ToggleSwitch.cpp.hpp:25-27 int channel -> float in the 1 - ratio blend 6
ToggleSwitch.cpp.hpp:25-27 blended float -> the int channel 3

What changed — af0fb5bf6

blendChannel(int from, int to, float ratio) states the widening once and
blendColors() casts the one narrowing back to int. The arithmetic is the
same float expression and the narrowing is the same truncation, so the colour
returned is bit-identical to before; no flag, pin or target behaviour changes.

GREEN evidence

Replay of the same compdb entries against this branch:

23 TUs for shared/qt/
TOTAL 0 diagnostics in 23 TUs

(the whole shared/qt/ tree, not just idian, is clean with the groups on).

Local: gersemi 0.25.0 -c on the edited CMakeLists.txt ok,
clang-format --dry-run --Werror on the edited source ok,
uv run python -m unittest test_conversion_ratchet test_frontend_conversion_optins test_ci_scope
(63 tests) ok from ci/, ./lint -> == lane lint: ok.

Tiers that do not apply: no Rust unit, no C test, no protocol or runtime
behaviour change (a pure UI colour helper).

Refs #2625

shared/qt/idian joins the ratchet: naming the three groups in its own
target_compile_options() surfaces nine implicit conversions in
components/ToggleSwitch.cpp.hpp's blendColors(), which the next commit
states at the call sites.
With the three groups on, the idian unity TU reports nine implicit
conversions, all in ToggleSwitch.cpp.hpp's blendColors(): the int
channels widened into the float blend and the result narrowed back to
int per channel. blendChannel() states both conversions once; the
arithmetic and the final truncation are unchanged.
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

CI is green apart from the sanitizer lane, which is queued behind master's in-progress Sanitizers dispatch; auto-merge is on. The slice's local evidence and the RED/GREEN SHAs are in the description. Rebase/lint fixups and re-queueing after an ejection are the coordinator's.

@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 — the ratchet slice is correct, one verification note.

Correctness. I re-derived the equivalence rather than taking the body's word for it: the old expression was int * (1 - ratio) + int * ratio, where 1 - ratio promotes to float, so every term was already computed in float and only the assignment narrowed. blendChannel() states the same widening (static_cast<float>(from) * (1.0f - ratio)) and blendColors() states the same truncating narrowing (static_cast<int>), so the returned QColor is unchanged for every input, including ratio outside [0,1] and the clamp-free case.

Flag scope. shared/qt/idian tracks only .cpp/.hpp (30 .hpp, 1 .cpp, plus CMakeLists.txt), so naming the three groups for COMPILE_LANG_AND_ID:CXX alone is the right scope; there are no C or Objective-C inputs to cover.

Mechanical state. ci/conversion_ratchet.py reads the entry from this CMakeLists.txt itself, so this PR also selects its own asan lane (#2923) — the Sanitize 🧪 / asan job is the only check still running, and I will queue the PR when it passes.

Tiers that do not apply are correctly stated: value-preserving casts on a UI colour helper, no Rust unit, no C test, no protocol or runtime behaviour change. docs/features.md is not the ledger for build tooling.

No change requested.

@zackees
zackees added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit ccf7fdf Oct 29, 2026
41 checks passed
@zackees
zackees deleted the infra/2625-conversion-idian branch October 29, 2026 23:27
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