Repository navigation
obs-hotkey: port object-bound hotkey-pair registration to Rust (Refs #4797) - #5225
Merged
Merged
Conversation
Mirror every assertion of test_hotkey_pair_register.c in the existing obs-tests-core hotkey module: NULL owners with and without a core, ID consumption, metadata copies, partner IDs, per-half weak acquisition, routed callbacks with distinct functions and data, saved bindings in the right context, unregistration, owner teardown, private-source admission and NULL callbacks/data. All four tests fail at the todo!() stub. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…4797) obs_hotkey_pair_register_{encoder,output,service,source} now come from obs-hotkey::pair_register. A NULL owner returns OBS_INVALID_HOTKEY_PAIR_ID before any owner field is read. Otherwise the real-layout adapter obs-hotkey-pair-register-fields.c.h supplies the kind's original weak-ref helper and the owner's embedded context, and the narrow obs_hotkey_pair_register_call forwards to the unchanged register_hotkey_pair_internal, which keeps locking, per-half weak acquisition, partner IDs, saved bindings and teardown. The extracted C moves to the reference-only group libobs.ported-hotkey-pair-register (ported-source-sets fragment), the four symbols are listed in rust-exports.d, and the original wrappers are the Tier 3 oracle (oracle.d fragment) against the public Rust ABI, with a mutation-killing seed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1795086070,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":93,"stamp":"49643928a25c54d97911882c11a1ea65","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795086070,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":93,"stamp":"0e9b96f360a1dfb89535a5b26fc9c5ff","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795086070,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":93,"stamp":"6d997ee4c37c24644a55bb19e7a69d31","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795086070,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":93,"stamp":"e59c4d6cb09f04a7cd537e4f088f1fff","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"general/all/client-lint","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"9c8417a6f912404b9dc924b9725c5756","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795086070,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":93,"stamp":"4c08671522f206a3e52d2f670ff615c0","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"376c4b4ee48e7c7198283e285bde07ab","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"bccc9762c1d90ba1e76ed5383c85601b","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"a0ce2232cfef9d4354067f6debeb53f9","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"10d55fb6a80449e62f8cc4faa9092ea4","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"a80e8a6c146125d75a67220aa80f0bcb","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"9ce163080fc1482f11ae3297587bc1f6","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"6e2b0c47930ab0865c4df996451774ee","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"0c37f864042632e7036385411a1fc5ae","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"b43cf4d83e667c0f38de8255a814a19d","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"5af5bd7e176fca5344ced443dbe690f6","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"2e03693f46dec93e8b19795e5f5d9b51","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795085976,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ef33fb1f23b70467e1a25447f347bd0950c9f47bfefacd583a81705aaf239646","lane":"client-lint","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":87,"stamp":"fdd507cf7ee8290b35b2926ba8b9c648","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Ci-Attestation: {"at":1795086280,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"fc3fd4cc977e087ded4681cbf1e26d21e7d6035d62d04e8e6790af5173f0c791","lane":"client-test-x86_64-unknown-linux-gnu","parents":["f2b502e9d92a2b87a1aa898ab4c8ab4a07cca5b5"],"secs":209,"stamp":"e772e575d8be3b16ee837dc1d1eec865","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994","v":1,"via":"run"} Client-Checks: {"checks":{"base":"d8f5045f0882951a2806b9decaf82b97cac656b6","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.core-hotkey-pair-register+.h.c","libobs/build/libobs.ported-hotkey-pair-register+.h.c","libobs/build/modules.d/core.json","libobs/build/ported-source-sets/hotkey-pair-register.json","libobs/build/source-sets.d/LIBOBS_SOURCES.json","libobs/cmake/rust-exports.d/obs-hotkey-pair_register.txt","libobs/obs-hotkey-pair-register-fields.c.h","rust/README.md","rust/obs-c-oracle/oracle.d/hotkey_pair_register.list","rust/obs-c-oracle/oracle/hotkey_pair_register.c","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/ffi/pair_register.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/src/pair_register.rs","rust/obs-hotkey/tests/hotkey/main.rs","rust/obs-hotkey/tests/hotkey/pair_register.rs","rust/obs-hotkey/tests/hotkey/pair_register_parity.rs","rust/obs-hotkey/tests/proptest-regressions/pair_register_parity.txt"],"head":"662c460482fe3043ed8d1df6cbefa278d85175b9","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.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-GITv2.15.4\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"10495b8fdcf3f0bf15fc3c668064e3099ab823290e40277b188ffab68dca83f8","tree":"1e3eba54ccebb3c4c2d2dee5605df1ebd34af994"}}
rdoupe
force-pushed
the
port/4797-hotkey-pair-register
branch
from
November 19, 2026 11:05
d8fd8fb to
5a7d63e
Compare
rdoupe
enabled auto-merge
November 19, 2026 11:05
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 19, 2026
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #4797
Ports the four object-bound hotkey-pair registration entry points (
obs_hotkey_pair_register_encoder,_output,_service,_source) fromlibobs/obs-hotkey-pair-register.c.htoobs-hotkey::pair_register.What moved:
rust/obs-hotkey/src/pair_register.rs): a NULL owner returnsOBS_INVALID_HOTKEY_PAIR_IDbefore any owner field is read and without reaching the engine. Otherwise it reads the owner's fields, then makes one engine call with the owner itself as registerer.src/ffi/pair_register.rs): the four exported symbols. No private structs are mirrored.libobs/obs-hotkey-pair-register-fields.c.h, live inlibobs.core+):obs_*_get_weak_*) and&owner->contextfrom the real layouts.obs_hotkey_pair_register_callforwards to the unchangedregister_hotkey_pair_internal. That engine still does locking, calls the weak helper once per half, and handles partner IDs, saved bindings and teardown.libobs.ported-hotkey-pair-register, registered throughported-source-sets/hotkey-pair-register.json. It is removed frommodules.d/core.jsonandLIBOBS_SOURCES.json. The exports are listed inrust-exports.d/obs-hotkey-pair_register.txt.oracle.d/hotkey_pair_register.listplusoracle/hotkey_pair_register.crun the original wrappers and the production adapters over real owner layouts. A recording engine replacesregister_hotkey_pair_internaland calls the weak helper twice, like the real one.rust/README.mdport ledger has a new row.Behavior is unchanged, characterized but not endorsed: private sources are still admitted, and NULL callbacks and data are accepted. There are no intentional differences. Tier 4 does not apply (this is not protocol code). No C test and no public header was changed. No
plugins/obs-websocketpointer change.Evidence
RED (
f2b502e9d, Tier 1 mirror against atodo!()stub):GREEN:
Tier 1 + Tier 3:
soldr cargo test -p obs-data --test obs-tests-core hotkey::pair_registergives7 passed; 0 failed.test_hotkey_pair_register.c.Mutation check: I made two temporary mutations, and each one failed both parity tests (
characterized_admission_and_full_width_results,wrappers_match_original_c):data0/data1The shrunk seed is checked in at
tests/proptest-regressions/pair_register_parity.txt.Native build contracts:
soldr cargo test -p obs-studio-rust --test obs-tests-app native_build::gives 318 passed, 0 failed.Tier 2:
OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests 'hotkey'IDENTICAL (1769 symbols).[OFF]): 1028/1028 passed, and the-R hotkeyrepeat passed 41/41, includingtest_hotkey_pair_register.[ON]): 1028/1028 passed, and the-R hotkeyrepeat passed 41/41, includingtest_hotkey_pair_register.Lint:
./lintgives== lane lint: ok. The local gate lint lane also passes after clang-format of the oracle file.Test cost: new tests take at most 0.01 s per run (debug build,
OBS_PARITY_CASESfull and reduced). Peak RSS is 23 MB over 25 runs. The tests start no threads of their own.🤖 Generated with Claude Code