Skip to content

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

Open

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priorityportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimablesize:SHours

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions