Skip to content

rust: Port libobs/obs-hotkey-combination-background-id.c.h to obs-hotkey #5288

Closed

Description

@zackees

Phase 6 stateful libobs core / obs-hotkey. Depends on prerequisite #5275, the separate C-only extraction and characterization of obs_hotkey_combination_get_background_id into libobs/obs-hotkey-combination-background-id.c.h. Start only after the prerequisite lands, and respect the maintainer's current hold on adapter-adding Rust swaps; the C-only prerequisite is exempt from that hold. Preserve test_hotkey_combination_background_id.c unchanged; its external-mode seam is reserved for the swap.

Port the orchestration to safe Rust with thin FFI and narrow real C adapters. Keep the callback table and existing mutex C-owned. Failed lock returns NULL without any callback-field read, unlock or callback. Success initializes the dstr, captures the callback while locked, releases the lock before any invocation, and calls the saved callback exactly once with the by-value combination. A missing callback or false result frees the partial dstr and returns NULL. A true callback transfers exactly id.array, including NULL or allocated empty success, to a caller that uses bfree. Preserve reentrancy and the original allocation contract; never return a Rust allocator pointer for C to free.

Port all characterization assertions to Tier 1 in the existing Core state obs-tests-core binary, add original-C Tier 3 differential coverage and a mutation check, and retain unchanged dual-library Tier 2 and symbol parity. Layout-check obs_key_combination_t and the dstr projection against the real public C headers. Tier 4 does not apply to this non-network wrapper.

Hazards: background_query_parity.rs already defines an exact-name fake of this getter that returns its own one-byte allocation. Isolate it deliberately when introducing the real symbol. Coordinate with background-state swap #5259. Link every real Rust-referenced adapter into every standalone Rust-static consumer, with no aborting stubs or placeholder globals. Build EVERY Linux cmocka *_rust target with -k 0, run ci/windows_link_check.py, and run the separate Darwin check if Windows fails. Prove Darwin binding through the Mach-O symbol/import table wherever recording fakes/adapters are involved (#5226). Windows MSVC has no max_align_t. No existing C test, public header, workflow or obs-websocket changes.

The prerequisite is published as READY PR #5287 at 0858b16d135dcb7d14066e5674cc1a18a7fd1379, with auto-merge armed. It passed all 322 native_build tests, dual-library focused Linux Tier 2 including 25 repeats per mode and every 66 *_rust target, and both MSVC/Darwin hybrid/57-fixture link passes. The new C fixture separately cross-linked on both. Native Windows/macOS execution remains the hosted merge gate.

Activity

  1. added
    port
    ready
    P2
    size:S
    on Nov 19, 2026
  2. rdoupe commented on Nov 20, 2026

    @rdoupe
    Collaborator

    Claiming: Rust swap of obs_hotkey_combination_get_background_id into obs-hotkey, branch port/5288-hotkey-combination-background-id.

    1. RED: safe-core tests mirroring every assertion of test_hotkey_combination_background_id.c in the existing core-state binary, plus Tier 3 parity against the extracted original, against stubs.
    2. GREEN: thin ABI shim over safe Rust, with narrow C adapters for the existing hotkey mutex, the callback-field read and dstr_free, following the background app-id swap. The exact-name fake in background_query_parity.rs gets isolated when the real symbol arrives.
    3. Tier 2 dual-library run of the unchanged C test, every Linux *_rust target, and the Windows/Darwin link check.
  3. moved this from Ready to In progress in obs-rust Multiviewon Nov 20, 2026
  4. rdoupe commented on Nov 20, 2026

    @rdoupe
    Collaborator

    Done by #5325 (merged as 5bc3cf4): obs_hotkey_combination_get_background_id is safe Rust in obs-hotkey, with Tier 1, Tier 3 differential and Tier 2 coverage.

  5. moved this from In progress to Done in obs-rust Multiviewon Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2portreadysize:S

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions