Skip to content

rust: Port libobs/obs-hotkey-background-state.c.h to obs-hotkey #5259

Open

Description

@zackees

Phase 6, stateful libobs core / obs-hotkey. Depends on prerequisite #5255 and its C-only extraction branch test/5255-hotkey-background-state at 9028566f07400aa6ce008b993dcfb885f05cc29e. Publication is BRANCH-ONLY because ci/backpressure.py returned 75; the prerequisite PR must be published and merged before this swap starts. Start after that prerequisite lands; this issue is the separate Rust swap.

The extracted unit is libobs/obs-hotkey-background-state.c.h, containing obs_hotkeys_get_background_state. The new test_hotkey_background_state C characterization records locking/unlocking and global-core reads, and covers every declared state, an unknown enum, unknown flag bits, failed locking and NULL output. Preserve this test unchanged; compile its external mode against the Rust entry point with real adapter sources and recording support.

Preserve the exact ordering: clear non-NULL flags before attempting the existing C-owned lock; failed locking returns NATIVE, with no unlock or background-field access; success captures the exact state and optional flags while locked, unlocks exactly once, and returns the captured enum. Keep unknown enum values and all flag bits. No new mutex, eager access to the C-owned global, public-header edits or edits to existing C tests.

Implement safe Rust orchestration in obs-hotkey and thin FFI, retaining narrow real C field/lock adapters. Add Tier 1 cases and original-C Tier 3 differential/oracle coverage in the existing Core state obs-tests-core binary, with RED then GREEN and a mutation check. Preserve dual-library Tier 2 and symbol parity. The C-only characterization currently includes the extracted source; use its external-mode seam for the Rust swap rather than changing assertions. Wire every affected native fixture and expected inventory.

Hazards: rust/obs-hotkey/src/ffi/background_query.rs already imports/calls the C query, and background_query_parity.rs defines an exact-name fake. Isolate that fake deliberately when the real Rust symbol is introduced. Before publication, build EVERY Linux cmocka *_rust target with real adapter support; run Windows MSVC linking and a separate Darwin check if Windows fails. Prove Darwin bindings with the Mach-O symbol/import table where a fake or adapter is involved (#5226); do not let two-level namespace silently select libobs instead of recording support. Preserve C-owned core/mutex behavior and the compatibility APIs. Tier 4 does not apply to this non-network wrapper.

Prerequisite validation: 322 native_build tests; deterministic C-source characterization against the original body; focused Linux Tier 2 with all eleven affected unchanged suites, every one of the 65 *_rust targets and identical 1,769-symbol libraries; Windows/Darwin hybrid and Rust-static links plus explicit new C fixture links. Native Windows/macOS execution and the complete cmocka suite remain hosted validation, not a claim from these Linux-hosted links.

Activity

  1. added
    enhancementNew feature or request
    portPort a C unit to Rust (four-tier policy)
    readyMeets the definition of Ready; claimable
    P2Normal priority
    on Nov 19, 2026
  2. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Claiming: port the extracted hotkey background state query in pool slot obs-studio5. 1. Commit RED safe-core tests, then implement the Rust orchestration and real C lock/field adapters while preserving the existing characterization unchanged. 2. Add original-C differential coverage and verify all Rust-static consumers on Linux/MSVC/Darwin, including binding evidence. 3. Check overlapping PR merge trees, run final lint and publish a READY PR or branch-only according to backpressure. First publication expected this session; prerequisite #5263 is merged.

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

Metadata

Metadata

Assignees

Labels

P2Normal priorityenhancementNew feature or requestportPort 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