Skip to content

rust: Port obs-source-type-enum.c.h to obs-core #4781

Closed

Description

@zackees

Port the source-type registry enumeration unit from libobs/obs-source-type-enum.c.h to obs-core, after the C characterization/extraction prerequisite #4772 lands. Phase 6 core-state work; this is exactly obs_enum_source_types and obs_enum_input_types2. Leave obs_enum_input_types, metadata queries from #4733, and other registry APIs outside the unit.

Prerequisite branch: test/4772-source-type-enum-extract, commits 81870c80fb5fff955e3cd98fd4b85f714188ddad (characterization) and 8689dd93d2c0bc6eb9b939e7a58e8be6c9e824f7 (verbatim extraction). It is branch-only pending serialized publication of test-graph changes; no prerequisite PR exists yet. Treat #4772 as a blocking dependency and wait for its merge before starting the swap.

Preserve current behavior: source_types versus input_types selection and insertion order, size_t bounds including SIZE_MAX, borrowed ID pointer identity, no output writes on failure, input outputs independently optional (including both NULL), and unversioned output written last when the two output addresses alias. A successful source-type enumeration requires a writable non-NULL output pointer. The core/registries must be live and synchronized; no-core calls are outside the characterized domain. Do not add wrapper validation that changes this domain. Registration owns the versioned ID copy even for version zero; the unversioned ID remains the original caller pointer.

Acceptance and four-tier plan:

  • RED: mirror every assertion from the unchanged test/cmocka/test_source_type_enum.c in safe Tier 1 tests within obs-core's existing obs-tests-core category module, against a stub. Add no Rust test executable. GREEN then implements the safe core and thin C ABI shims.
  • Tier 2: keep the new characterization and existing test_source_registration.c unchanged, run them against hybrid libobs and libobs-c-reference, and retain exact dynamic symbol parity and unchanged public headers.
  • Tier 3: compile the original extracted C as an oracle; add bounded differential cases for both registries, empty/populated states, valid/invalid indices, optional/aliased outputs, borrowed identities and unchanged failure sentinels. Measure any new C-layout boundary against real headers and show a mutation failure. Private C adapters must be real implementations with link support for standalone Rust-static consumers, never placeholders.
  • Tier 4 does not apply: these functions expose no network protocol surface. The existing C++ obs-websocket plugin remains untouched.

Move only this unity group's include into its own ported group and per-unit source-set fragment when swapping. Register exports per FFI module, update the sorted Rust port ledger, run the required category/native-build gates and focused compatibility tests, and follow the standard claim/RED/GREEN/PR workflow after the prerequisite lands. No design decision is open.

Activity

  1. added
    enhancement
    port
    P2
    size:S
    ready
    on Nov 12, 2026
  2. zackees commented on Nov 12, 2026

    @zackees
    MemberAuthor

    Claiming: obs_enum_source_types and obs_enum_input_types2 Rust swap on branch port/4781-source-type-enum-rust, stacked on test/4772-source-type-enum-extract at 8689dd9 under the branch-only pool brief. 1. Mirror the unchanged characterization in safe Rust and commit failing stubs. 2. Implement the two-symbol swap with original-C differential coverage and real adapter link support, disjoint from #4733. 3. Run focused compatibility/category checks, fmt and one full lint, then push the branch for the landing worker. First branch handoff expected this session; no PR will be opened.

  3. moved this from In progress to Ready in obs-rust Multiviewon Nov 14, 2026
  4. rdoupe commented on Nov 16, 2026

    @rdoupe
    Collaborator

    @zackees are you still on this one? The extraction it was stacked on landed today as #4884 (your test/4772-source-type-enum-extract branch, rebased). port/4781-source-type-enum-rust has three finished-looking commits on top of it from 2026-11-12 but no PR. If you've moved on, I can rebase those three onto master, check them, and open the PR with your authorship kept; otherwise I'll leave it with you.

  5. zackees commented on Nov 16, 2026

    @zackees
    MemberAuthor

    Claiming: continuing the source-type enumeration swap in pool slot obs-studio4 on branch port/4781-source-type-enum-land. 1. Replay the existing RED then GREEN commits from port/4781-source-type-enum-rust onto current master with authorship preserved. 2. Verify the unchanged characterization, bounded C-oracle parity, native link support and final lint. 3. Open a PR with Refs #4781 and arm auto-merge pinned to its head this session. Scope remains obs_enum_source_types and obs_enum_input_types2 only.

  6. moved this from Ready to In progress in obs-rust Multiviewon Nov 17, 2026
  7. rdoupe commented on Nov 17, 2026

    @rdoupe
    Collaborator

    Done in #4897: obs_enum_source_types and obs_enum_input_types2 now come from rust/obs-core/src/ffi/source_type_enum.rs, with the C kept as the ported group's fallback and oracle.

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

Metadata

Metadata

Assignees

Labels

P2enhancementportreadysize:S

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions