Skip to content

obs-core: swap core type-catalog enumeration to safe Rust (Refs #5202) - #5211

Merged
zackees merged 2 commits into
masterfrom
port/5202-type-catalog-enum
Nov 19, 2026
Merged

zackees merged 2 commits into
masterfrom
port/5202-type-catalog-enum

Conversation

@zackees

@zackees zackees commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

This swaps the six legacy type-catalog enumeration functions into safe obs-core logic while preserving the libobs C API and borrowed ID pointers. Each catalog retains its own registration order and count. Out-of-range indices return false without writing the output, including a NULL output on failure.

Refs #5202. The other source enumeration queries, registration paths, public headers, existing C tests and C++ WebSocket plugin are unchanged. The private C field adapters reuse #5190's existing shared demand-linked support archive and canonical wrapper instead of adding per-target consumer lists. The original six C bodies remain in a reference-only unity group. No intentional behavior differences or new Rust test executable.

RED commit a6711a2 mirrors the unchanged characterization against a todo stub; both tests failed at that stub (exit 101). GREEN commit 53a1fa7 delegates bounds and output writes to the existing source_type_enum machinery. Safe mirrors cover empty and independent catalogs, insertion order, first/last entries, num/num+1/SIZE_MAX, distinct no-write sentinels, borrowed pointer origin and NULL output only on failure. The original-C differential compares all six ABI exports with the safe core over bounded edge/random cases and checks core/registry immutability and real-header field addresses.

Rebased after #5210 onto master c037c2b. Resolved the native.rs registration conflict by retaining both update-properties and type-catalog entries in order. Verified both README entries, sorted obs-core module/FFI/test lists and registrations; uv run ci/test_test_graph_sorted.py --fix made no changes. The RED/GREEN patch pair is preserved; range-diff shows only rebase context changes. No swap behavior changed.

Fresh validation after rebase: formatting passed; all 319 native_build tests and 1,329 obs_core tests passed. Focused Linux Tier 2 built all 64 configured *_rust targets. The seven unchanged type_catalog_enum/source_registration/source_type_enum/register_short_info/module_type_rules_steps/encoder_type_info/output_type_info fixtures passed three repeats against both C-reference OFF and hybrid ON, with identical 1,769 exported symbols. ci/windows_link_check.py passed all eight Windows MSVC Rust category links, then hybrid libobs and all 55 configured Rust cmocka fixtures on each of Windows MSVC x64 and Darwin arm64. Full SOLDR_PORCELAIN=0 ./lint passed once (471.8 s). A final merge-tree against newer master d8f5045 is clean.

The original worker's always-false core mutation failed the original-C differential with exit 101, then restoration passed; its primary clud-review was clean. This mechanical rebase leaves the swap implementation unchanged. The focused Linux replay needed the documented cached-wrapper environment repair: expose the managed soldr binary and use the writable /build Cargo target. No tracked environment/tooling files changed.

Test cost: 25 reduced-parity debug module runs, longest 0.071 s, peak RSS 21,844 KiB; no test-owned threads. Tier 4 does not apply to this non-protocol metadata swap. Native macOS/Windows runtime execution and hosted PR/queue checks remain merge-queue acceptance.

Publication: ./push replaced original head 53a1fa7 with exact force-with-lease and published signed head 543b6c9. Complete client attestation passed six-target clippy/Dylint, repository self-checks/validators, 9,162 workspace host tests (6 existing skips), workspace doctests, the 920-test utility feature configuration, and Windows GNU category linking. The final signature verifies.

@zackees
zackees enabled auto-merge November 19, 2026 08:02
@zackees
zackees added this pull request to the merge queue Nov 19, 2026
@zackees
zackees removed this pull request from the merge queue due to a manual request Nov 19, 2026
@zackees zackees added the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
Ci-Attestation: {"at":1795084865,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":156,"stamp":"c7280e301cb64bd778e2ee19a5671b4b","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084865,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":156,"stamp":"ea2307feb6077a9cafdb5f074ff7037f","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084865,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":156,"stamp":"09dd43e85779d9a751ca8bc35f058489","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084865,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":156,"stamp":"0a4293c7d7b92209b1e656b03341afa7","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"general/all/client-lint","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"67a81fdf6aacd1ce97c995291e9a398d","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084865,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":156,"stamp":"18a22b8fc447dd8eaed986a4eb25d469","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"2a3591f6a273f7ebbd322ed232a9097b","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084709,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"311724f7ac117ea67da667245e8d4e9a","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"77ba51b59c38308cd9f1b7c91c639aee","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"2ebfa27a8324e164bf2604d713b39ea7","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"55b1f6fd926bee4df21a892e441c7f62","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"9bcb6fa1528fdd3157e75fda63bf82dc","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"23f4c5df461142d6325bb40fb9cb8e5b","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"f0c85ae578b694968a8b561624929895","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"dec52f7704cefa5da7111702758296cc","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"f7c260f5d55cca038b5f2eb4abc19d47","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"f2fa977c88d826e12b729d48f50bece4","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795084708,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"893e9e1419b08eb95677079072b074710011c49c67d600e7375a71aaee7ba880","lane":"client-lint","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":185,"stamp":"55aaebff2cc936b5f0483610488093c3","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}
Ci-Attestation: {"at":1795085618,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"92275d51d2a2c4976b03ea63f259ce536fbf3568034feeb6e05ab5f736bc46f9","lane":"client-test-x86_64-unknown-linux-gnu","parents":["5ef60c5af703cd31cf7dc146991b93bb8762c2f3"],"secs":751,"stamp":"752e99149229eefe7929d6593cf02e23","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"d8f5045f0882951a2806b9decaf82b97cac656b6","coverage":"all-tracked-applicable-files","diff":[".github/workflows/build-project.yaml","ci/test_ci_job_timeouts.py","ci/test_tier2_apt_cache.py","libobs/build/libobs.core+.h.c","libobs/build/libobs.graphics-image-max-size+.h.c","libobs/build/libobs.media+.h.c","libobs/build/libobs.media-image-orientation-fields+.h.c","libobs/build/libobs.media-texture-file-data-convert+.h.c","libobs/build/libobs.media-texture-file-data-session+.h.c","libobs/build/libobs.ported-hotkey-unregister-entry+.h.c","libobs/build/libobs.ported-type-catalog-enum+.h.c","libobs/build/libobs.ported-video-level-queries+.h.c","libobs/build/modules.d/graphics.json","libobs/build/modules.d/media.json","libobs/build/ported-source-sets/hotkey-unregister-entry.json","libobs/build/ported-source-sets/type-catalog-enum.json","libobs/build/ported-source-sets/video-level-queries.json","libobs/build/source-sets.d/LIBOBS_SOURCES.json","libobs/cmake/rust-exports.d/obs-core-type_catalog_enum.txt","libobs/cmake/rust-exports.d/obs-core-video_level_queries.txt","libobs/cmake/rust-exports.d/obs-hotkey-unregister_entry.txt","libobs/cmake/rust-hidden.d/obs-core-video_level_queries.txt","libobs/cmake/rust-hidden.d/obs-hotkey-unregister_entry.txt","libobs/graphics/graphics-ffmpeg.c.h","libobs/graphics/graphics-image-max-size.c.h","libobs/graphics/graphics-texture-file-data-adapter.c.h","libobs/graphics/graphics-texture-file-data-convert.c.h","libobs/graphics/graphics.c.h","libobs/obs-hotkey-unregister-entry-fields.c.h","libobs/obs-type-catalog-enum-fields.c.h","libobs/obs-video-level-queries-fields.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_type_catalog_enum_swap_is_registered.rs","rust/obs-build/tests/native/registration/headless_characterizations_expected.json","rust/obs-build/tests/native/registration/portal_output_expected.json","rust/obs-build/tests/native/registration/rust-static/cases/core-relinked/test_video_level_queries.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_enum.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_press.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_trigger.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_binding_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_getters_characterization.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_load.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_pair_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_unregister_entry.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_portal_shortcuts.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_wayland_hotkeys.json","rust/obs-build/tests/native/registration/rust_static_entries.rs","rust/obs-c-oracle/oracle.d/hotkey_unregister_entry.list","rust/obs-c-oracle/oracle/hotkey_unregister_entry.c","rust/obs-c-oracle/oracle/hotkey_unregister_entry_links.c","rust/obs-c-oracle/oracle/source_deinterlace_links.c","rust/obs-c-oracle/oracle/type_catalog_enum.c","rust/obs-c-oracle/oracle/video_level_queries.c","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/ffi/type_catalog_enum.rs","rust/obs-core/src/ffi/video_level_queries.rs","rust/obs-core/src/lib.rs","rust/obs-core/src/type_catalog_enum.rs","rust/obs-core/src/video_level_queries.rs","rust/obs-core/tests/obs_core/main.rs","rust/obs-core/tests/obs_core/type_catalog_enum.rs","rust/obs-core/tests/obs_core/type_catalog_enum_parity.rs","rust/obs-core/tests/obs_core/video_level_queries.rs","rust/obs-core/tests/obs_core/video_level_queries_parity.rs","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/ffi/unregister_entry.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/src/unregister_entry.rs","rust/obs-hotkey/tests/hotkey/main.rs","rust/obs-hotkey/tests/hotkey/unregister_entry.rs","rust/obs-hotkey/tests/hotkey/unregister_entry_parity.rs","test/cmocka/build/test-graph.json","test/cmocka/test_image_max_texture_size.c","test/cmocka/tests.d/test_image_max_texture_size.cmake","test/cmocka/tests.d/video_level_queries_link_support.cmake","test/cmocka/video-info-query-link-support.c"],"head":"6fecfcb5ee28b234ad1b9f2b85a3fac1e5e3567d","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.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\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"e7bb6e30cb71e420ac294fdcc74e9f37bd464d161d400636c8c5bf524ef9c18e","tree":"9f2cadadcadfdfb8b938e574df7c5b5b5c61fe7e"}}
@zackees
zackees force-pushed the port/5202-type-catalog-enum branch from 53a1fa7 to 543b6c9 Compare November 19, 2026 10:53
@zackees
zackees enabled auto-merge November 19, 2026 10:54
@zackees zackees removed the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
@zackees
zackees added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 7ff5724 Nov 19, 2026
41 checks passed
@zackees
zackees deleted the port/5202-type-catalog-enum branch November 19, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant