Skip to content

obs-hotkey: swap background trigger retrieval to safe Rust (Refs #5104) - #5113

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

zackees merged 2 commits into
masterfrom
port/5104-hotkey-background-trigger

Conversation

@zackees

@zackees zackees commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

The background-trigger getter now runs its lock, dispatch and ownership decisions in safe obs-hotkey Rust. Thin ABI shims use the real private C core, callback and dstr_free adapters. Dispatch stays under the existing hotkey mutex with the exact combination and wake_data; rejected output is freed after unlocking, and successful output transfers the exact allocation, including allocated empty strings and NULL. The original C body remains in a reference-only unity group and the differential oracle. There are no intended behavior changes.

Refs #5104. Extraction and unchanged characterization #5103 are merged. RED 283932872 fails the safe characterization mirror at the intended todo!() stub; GREEN implements the swap separately. All nine standalone hotkey fixtures link the real adapter and select a hidden Rust request entry, following background-control's archive-selection pattern, so the unchanged C test exercises its fixture's core. Eleven independent inventory snapshots and the sorted per-port registration and Rust ledger row are synchronized. Existing C tests, public headers and the WebSocket plugin are unchanged; no new workflow or Rust executable was added.

The differential covers missing core/failed locking, missing callbacks, false callbacks with and without storage, nonempty and allocated-empty output, successful NULL output, arbitrary bytes, exact pointer transfer and real-header layouts. Inverting the success decision makes the differential fail (exit 101); the core was restored byte-for-byte. The read-only review found no issues.

Validation: the full hotkey module passes 605 tests; the entire native_build:: module passes 298 tests. The unchanged C characterization passes against hybrid and C-reference libobs with identical dynamic symbol sets. All eight category executables link for Windows MSVC. Build-group, port-unit metadata and test-binary budget validators pass.

Test cost over 25 reduced-parity runs: three focused tests, longest combined run 0.08292 s, peak RSS 20,932 KiB; the native registration case takes at most 0.07900 s and 11,668 KiB RSS. No test-owned threads; generated output storage is capped at 128 bytes. Tier 4 does not apply to this local getter. Native Windows/macOS runtime and the entire cmocka suite were not run locally; hosted admission and merge-queue completion remain pending.

Full ./lint ran once on the final source tree with SOLDR_PORCELAIN=0 and passed in 404.2 seconds, including workspace/feature Clippy and Dylint. The final cleanup adapter was checked again by the full hotkey module and all-eight-binary Windows MSVC link validation.

./push completed fresh client proofs on the unchanged source tree: Clippy and Dylint for all six supported targets, self-tests/data validators, 9,036 passing workspace tests (six skips), 920 feature-combination tests, doctests and Windows GNU test-binary linking. The final head is signed and pushed unchanged. Swift evidence is inapplicable because this port changes no Swift source. Merge-queue validation remains required.

Ci-Attestation: {"at":1795019707,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":142,"stamp":"6a8c6ea68473d7dc726399475ddaa82f","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019707,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":142,"stamp":"c459005575bebb6d4b03aa608094d754","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019707,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":142,"stamp":"f826a21ad828567dace7c6ed702785df","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019707,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":142,"stamp":"916ad5c913da83de1eb9c55228363b13","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"general/all/client-lint","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"aa13fa210706c41b4928c46bc1ec4a19","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019707,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":142,"stamp":"ac27474a07623c8940c9b216dc3350c2","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019564,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"f6bed1ef7be52341cc17197e21fe78c7","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019564,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"ba9fbc9cd73b86d756d3da8eb680deef","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"1f9ee6f0840e6e49037e060594018e77","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"f9a28cfca1cd0998f6603010eab34e9c","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"30c1016e33504f00147d6c46b5efdd4b","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"d28922bea11b58ee02841c0781c3dd48","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"74bd3111f10ce66ef644a78a5c8ca4bc","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"3c6f4e1adeda643ebdf1f76eda1b525e","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"7557cd797efe94419b52b0b76561cb68","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"4da91783b5cefcd6895a7e763e57f1f0","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"25619a2a15b5290706dbeb1e90b07756","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795019563,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ae0bbd3661391eb2a13df98d3945f6bca124454d1d656e4781431e3536a1ed64","lane":"client-lint","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":224,"stamp":"3f6ce602d5c299652dd111cf5ba80856","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}
Ci-Attestation: {"at":1795020381,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"52974c94f20132715694808cef3820091af8cad5ac7474c68b44c9b7e330d329","lane":"client-test-x86_64-unknown-linux-gnu","parents":["2839328727660e40f10446da9c1787dd274a3997"],"secs":673,"stamp":"ed7928c15eef51d9bd63d0fbbfa9b8b1","tree":"a6bc466170a1384db0763f2c56d8b8898f488923","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"dd582b52458a6cae8dbfefc37382ecf81c76ae1f","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-hotkey-background-trigger+.h.c","libobs/build/ported-source-sets/hotkey-background-trigger.json","libobs/cmake/rust-exports.d/obs-hotkey-background_trigger.txt","libobs/cmake/rust-hidden.d/obs-hotkey-background_trigger.txt","libobs/obs-hotkey-background-trigger-fields.c.h","libobs/obs-source-missing-files-getter.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_hotkey_background_trigger_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_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_trigger.c","rust/obs-hotkey/src/background_trigger.rs","rust/obs-hotkey/src/ffi/background_trigger.rs","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/tests/hotkey/background_trigger.rs","rust/obs-hotkey/tests/hotkey/background_trigger_parity.rs","rust/obs-hotkey/tests/hotkey/main.rs","test/cmocka/build/test-graph.json","test/cmocka/hotkey-background-trigger-link-support.c","test/cmocka/test_source_missing_files_getter.c","test/cmocka/tests.d/hotkey_background_trigger_link_support.cmake","test/cmocka/tests.d/test_source_missing_files_getter.cmake"],"head":"2f9262a257f044fd287987a9dd7631aba4744282","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":"eb8ffd757c0531dbcf9350a42a22cfb727eef1e9c66270f62d47981656e6e5e1","tree":"a6bc466170a1384db0763f2c56d8b8898f488923"}}
@zackees zackees added the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 18, 2026
@zackees
zackees enabled auto-merge November 18, 2026 16:48
@zackees zackees removed the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 18, 2026
@zackees
zackees added this pull request to the merge queue Nov 18, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In merge queue in obs-rust Multiview Nov 18, 2026
Merged via the queue into master with commit e19e695 Nov 18, 2026
42 checks passed
@zackees
zackees deleted the port/5104-hotkey-background-trigger branch November 18, 2026 18:57
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In merge queue to Done in obs-rust Multiview Nov 19, 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