Skip to content

obs-hotkey: swap background press setter to safe Rust (Refs #5137) - #5152

Merged
zackees merged 2 commits into
masterfrom
port/5137-hotkey-background-press
Nov 18, 2026
Merged

zackees merged 2 commits into
masterfrom
port/5137-hotkey-background-press

Conversation

@zackees

@zackees zackees commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Moves obs_hotkey_enable_background_press into a safe obs-hotkey core with a thin FFI shim, following the merged background-trigger swap #5113. The existing seam lock protects the inverted disable bit; repeated values stay silent, and transitions emit the exact synchronous hotkey_background_press_changed(bool enabled) signal after unlocking. The private adapter retains fixed 128-byte calldata and listener re-entry. Rust checks for NULL before C field access. All ten standalone hotkey fixtures select the hidden Rust alias and link the real adapter. The original C body remains in the reference-only group and oracle.

Refs #5137. The prerequisite extraction #5136 is merged. Existing C tests, public headers, WebSocket code and CI files are unchanged. The per-port native registration and sorted rust/README.md row are included. This port preserves behavior, so it needs no features-ledger entry. Tier 4 is inapplicable to this local setter.

RED commit 8065c80ed fails both safe characterization tests at the intended todo!() stub. GREEN signed head 67342e38ccf4 passes all 608 hotkey tests and all 305 native_build:: tests. The unchanged press characterization and portal shortcut tests pass with both hybrid and C-reference libobs, with identical dynamic export sets. The process-isolated Tier 3 test compares the original C and real Rust adapter across fixed edge sequences and bounded randomized presence, initial-state, listener and request sequences, including synchronous payload observations, lock counts and allocation cleanup. Inverting the transition decision made the differential fail with exit 101; the safe core was restored byte-for-byte (SHA256 c7a0e7e6e0c36b3f55676c6339e4310955efe34c087fd7669adefce6017e2d22). All eight Windows MSVC category binaries link. Full ./lint ran once with SOLDR_PORCELAIN=0 and an 1,800-second deadline: exit 0 in 417.5 seconds, including repository self-tests, formatting, feature-combination Clippy and Dylint.

The publication client gates also passed Clippy and Dylint on all six supported targets, repository checks and data validators, all 9,085 workspace tests (six configured skips), workspace doctests, all 920 Utilities feature tests and Windows GNU linking of all category test binaries. The final signed head has 19 attestation records and the same source tree as the locally verified GREEN commit.

Test cost: over 25 reduced-parity debug runs, the new hotkey module's longest run was 0.0962 s with peak RSS 20,900 KiB; the native registration's longest run was 0.0928 s with peak RSS 15,092 KiB. No test-owned threads; generated request sequences are bounded below 64 elements. Read-only clud-review found no actionable issues. Native macOS/Windows runtime and the full cmocka suite were not run locally; Windows MSVC linking is checked separately. Hosted CI and queue completion are left to the pool coordinator.

Ci-Attestation: {"at":1795039537,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":171,"stamp":"31e36f3c62ea615c47ff361343e09c37","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039537,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":171,"stamp":"28bb78efc374cc2e972f8d2e610a2c8b","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039537,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":171,"stamp":"3d3c35114e69d380a87b0b55f704c13d","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039537,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":171,"stamp":"55600f6464b3c28a25f8938633fe07b3","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039361,"gate":"general/all/client-lint","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"09c72e98def5619d7f103ed29d4ce025","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039537,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":171,"stamp":"b60fa109129f2b876493a637ce48b15b","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039364,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"74f1a5370d18b0ba7ea785384a84a8a7","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039364,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"b0f6127c9bdd1834e292256510e05c77","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039363,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"e8ede05bfbf74b4c56704571b5dd776d","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039363,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"5c2fba5519e9881da6e8784690cef5d4","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039362,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"c5e83f0ab45dff8402835d9d55652e91","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039362,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"b818df08c377a8c3a9e445f6c92f32e6","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039363,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"3ba7594716ad478ef6ceee3d34174665","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039363,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"f1cd0c86acbfee9b9fc03802525a309a","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039362,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"02dffc634bc11a6d9c8d4b7a5259e9e6","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039363,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"83ec9783f5f52a7b9220443152024783","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039362,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"7b84037d6124d3dc7738f520549053de","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795039362,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"743c00082087bff0195fcd6eb3ea4d3bcfdb80d4a08a821ce64548babf0dc632","lane":"client-lint","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":226,"stamp":"4a4e0a838065e0c937e6b8de2f45a75e","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}
Ci-Attestation: {"at":1795040161,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"85dcd31aaf787874397b0a4f4e2f057de2fdc0fac462082ce9cdfbe9afe9afc9","lane":"client-test-x86_64-unknown-linux-gnu","parents":["8065c80edb42054d2da68a21516f51242e468b10"],"secs":623,"stamp":"98284d83d6e219df553d488001f3f163","tree":"61f369c52044be48a618c75687ed1cd5315e7676","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"9e207c5e1e44624fd3739cd099454f8ef7d6fe50","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-hotkey-background-press+.h.c","libobs/build/ported-source-sets/hotkey-background-press.json","libobs/cmake/rust-exports.d/obs-hotkey-background_press.txt","libobs/cmake/rust-hidden.d/obs-hotkey-background_press.txt","libobs/obs-hotkey-background-press-fields.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_hotkey_background_press_swap_is_registered.rs","rust/obs-build/tests/native/registration/headless_characterizations_expected.json","rust/obs-build/tests/native/registration/portal_output_expected.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_enum.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_press.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_trigger.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_binding_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_getters_characterization.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_load.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_pair_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_portal_shortcuts.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_wayland_hotkeys.json","rust/obs-c-oracle/oracle/hotkey_background_press.c","rust/obs-hotkey/src/background_press.rs","rust/obs-hotkey/src/ffi/background_press.rs","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/tests/hotkey/background_press.rs","rust/obs-hotkey/tests/hotkey/background_press_parity.rs","rust/obs-hotkey/tests/hotkey/main.rs","test/cmocka/build/test-graph.json","test/cmocka/hotkey-background-press-link-support.c","test/cmocka/tests.d/hotkey_background_press_link_support.cmake"],"head":"63dd270528f2c68033c4b31c82bf54c30c51c607","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"b6f6b3dd1c5f658c98122140fd0d62392dc4376a186b1a5bfe6983bd9a631462","tree":"61f369c52044be48a618c75687ed1cd5315e7676"}}
@zackees zackees added pool-active Pool worker owns this PR; automated rebases must skip it and removed pool-active Pool worker owns this PR; automated rebases must skip it labels Nov 18, 2026
@zackees
zackees enabled auto-merge November 18, 2026 22:17
@zackees
zackees added this pull request to the merge queue Nov 18, 2026
Merged via the queue into master with commit e01990a Nov 18, 2026
42 checks passed
@zackees
zackees deleted the port/5137-hotkey-background-press branch November 18, 2026 22:46
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