Repository navigation
obs-scene: port obs_scene_add to Rust (Fixes #6041) - #6042
Merged
Merged
Conversation
test_scene_add calls obs_scene_add() on real scenes of a started libobs: a NULL scene or a NULL source gives NULL and no "item_add"; otherwise the new item holds the source, has the scene as its parent and its one reference, and is last in the scene's list; "item_add" fires once on the scene's own source with the scene and the item, after the item is listed, with the scene's video and audio mutexes free, from a fixed 128-byte calldata stack. A scene added into itself or into a scene it holds and a removed source give NULL and no signal; an item added to a group's scene signals on the group's source only. 7/7 on hybrid libobs and the C reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_scene_add() moves unchanged into obs-scene-add.c.h, in the live group libobs.core-source. It sorts before obs-scene.c.h there, so it declares the static obs_scene_add_internal() it calls, which obs-scene.c.h defines and obs_scene_add_group2(), obs_scene_insert_group2() and scene_load_item() also call. test_scene_add, test_scene_create, test_scene_canvas_characterization, test_scene_dup_copy_lifetime, test_scene_item_hotkeys, test_group_active_refs, test_scene_enum_items_removal and test_sceneitem_release pass on hybrid libobs and the C reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The safe core obs_scene::scene_add (Add trait, add()) as a todo!() stub, with 8 Tier 1 tests in the scene test binary over model scenes and sources whose obs_scene_add_internal() refuses as the real one does: the cases of test_scene_add (NULL scene, NULL source, the returned item and its one "item_add" after it is listed, adds appending in order, recursion, a removed source, a group's scene) and the call order. soldr cargo test -p obs-data --test obs-tests-core scene_add test result: FAILED. 0 passed; 8 failed (not yet implemented: #6041 GREEN) Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Rust core runs the original's two steps in order: obs_scene_add_internal(scene, source, NULL, 0) with the arguments as passed (it checks both for NULL), and, only when it returned an item, "item_add" on the scene's source with "scene" and "item" in a fixed 128-byte calldata stack; then the item, or NULL with no signal. The export obs_scene_add (rust-exports.d) is the whole entry. The live adapter obs-scene-add-fields.c.h keeps the static obs_scene_add_internal() of obs-scene.c.h (the group calls and scene_load_item() use it too) and the signal's calldata and routing in C; the original moves to the reference-only group libobs.ported-scene-add and reaches obs_scene_add_internal() through the adapter's obs_scene_add_attach(). Tier 3 (oracle/scene_add.c) runs the original and the export on the same real-layout scenes through the same recording stand-ins for the add and the signal and compares the call logs field by field (arguments; the signal's handler, name, calldata pointers, fixed flag, capacity and size) and the results over every call; ten planted mutants are caught. soldr cargo test -p obs-data --test obs-tests-core scene_add test result: ok. 10 passed; 0 failed Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1796105457,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":76,"stamp":"aa700fa0e467f600629df196fa7a532e","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105457,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":76,"stamp":"9f8c4428440bb4f3ffffc9285c802e4a","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105457,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":76,"stamp":"0776c8ae816548b6a5cf48a125b88954","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105457,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":76,"stamp":"b1b68d66046fc91d36c43e57ec56cc63","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"general/all/client-lint","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"0357bcc49839e4afda6c7321bb168749","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105457,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":76,"stamp":"c0ed325389bf05b31a3b64967f8f8142","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"e0eb26f0709de0f0932578a1c894a3f1","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"187245967d697c145179ef0ad18812e3","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"593b10ab020ff7719c47167aea0cbb78","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"b40d78c75cbaa0059393b987785df412","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"7899ced7b04234facfa389b67dd7a110","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"b72e136a85f0f9d4174bb102865da236","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"a909c33849458269286016010705f26c","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"8712185025180c854cec4c6bfab25505","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"fe32b93d7d55b9b8a8f915898fa22e89","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"4208e4f56fc895bcbbddb012666fdbe8","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"49a5e87daa8e13f8ad52c5a0f354e61c","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105380,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"faf2f4e58cd308b544cfe271f19b7d103ca1aeb8933f95d8234a9e30047ccc35","lane":"client-lint","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":95,"stamp":"380a71f7426aeb155533b3f716d6d28c","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Ci-Attestation: {"at":1796105848,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"d982093ba0b332d3ac31c6d99fbbe3d59c28bcde24c443eec4e5a224062edfb9","lane":"client-test-x86_64-unknown-linux-gnu","parents":["06f25c526800336cf9ea1cd0dfd0353e4002f93f"],"secs":391,"stamp":"aa9dbf0eb8993534c6c8373d3b21fdf4","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85","v":1,"via":"run"} Client-Checks: {"checks":{"base":"9f3d2f01e4afc007cd869e02dbd1224933f14eef","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-scene-add+.h.c","libobs/build/ported-source-sets/scene-add.json","libobs/cmake/rust-exports.d/obs-scene-scene_add.txt","libobs/obs-scene-add-fields.c.h","libobs/obs-scene-add.c.h","libobs/obs-scene.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_scene_add_is_registered.rs","rust/obs-c-oracle/oracle/scene_add.c","rust/obs-scene/src/ffi/mod.rs","rust/obs-scene/src/ffi/scene_add.rs","rust/obs-scene/src/lib.rs","rust/obs-scene/src/scene_add.rs","rust/obs-scene/tests/scene/main.rs","rust/obs-scene/tests/scene/scene_add.rs","rust/obs-scene/tests/scene/scene_add_parity.rs","test/cmocka/build/test-graph.json","test/cmocka/test_scene_add.c","test/cmocka/tests.d/test_scene_add.cmake"],"head":"fa8388a65a4065a5470a408c554596d5d9bf2cba","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.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-GITv2.15.4\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"cf64c890b35bdedd0905512ad12f1f0b40bc812f3c3bb151987852e18f564cb9","tree":"e0d2623774da98e0326b9ef851b176377f3b9f85"}}
rdoupe
enabled auto-merge
December 1, 2026 06:17
zackees
reviewed
Dec 1, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: LGTM. It ports the public obs_scene_add, and the rust-exports.d entry keeps the ABI. It adds a new Tier 2 test, test_scene_add.c, and Tier 1 and Tier 3 parity, with no memcmp over padded entries. No existing C test or header is edited, and it has a Test cost line. Auto-merge on.
This was referenced Dec 1, 2026
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports
obs_scene_add()fromlibobs/obs-scene.c.htoobs-scene, the same shape as the do_transition (#6038) and remove (#6040) ports.obs_scene_add_internal()stays C:obs_scene_add_group2(),obs_scene_insert_group2()andscene_load_item()also call it.Fixes #6041
Commits
test: characterize obs_scene_add): newtest_scene_add, 7 cases on real scenes: NULL scene; NULL source (no item, no"item_add"); the returned item (its source, the scene as parent, one reference, last in the list) and one"item_add"on the scene's source with the scene and the item, fired after the item is listed, with both scene mutexes free (probed from another thread), from a fixed 128-byte calldata; adds appending in order, the same source twice included; a scene added into itself and into a scene it holds; a removed source; an item added to a group's scene signalling on the group's source only. 7/7 on hybrid libobs and the C reference before anything moved.libobs: extract obs_scene_add verbatim): the function moves unchanged intolibobs/obs-scene-add.c.h, in the live grouplibobs.core-source. The group is alphabetical and the file sorts beforeobs-scene.c.h, so it declares the staticobs_scene_add_internal()that file defines.test_scene_add,test_scene_create,test_scene_canvas_characterization,test_scene_dup_copy_lifetime,test_scene_item_hotkeys,test_group_active_refs,test_scene_enum_items_removalandtest_sceneitem_releasepass on both libraries.obs-scene: Tier 1 for obs_scene_add, RED): the safe coreobs_scene::scene_addas atodo!()stub and 8 Tier 1 tests over model scenes.soldr cargo test -p obs-data --test obs-tests-core scene_add→test result: FAILED. 0 passed; 8 failed(eachnot yet implemented: #6041 GREEN).obs-scene: port obs_scene_add to Rust, GREEN): the core runs the original's two steps in order. Firstobs_scene_add_internal(scene, source, NULL, 0), with NULL arguments passed on as the C does. Then, only when that returned an item,"item_add"; the item (or NULL) is returned. The exportobs_scene_add(rust-exports.d, it isEXPORTinobs.h) is the whole entry. The live adapterobs-scene-add-fields.c.hkeepsobs_scene_add_internal()and the signal's calldata and routing in C, so no layout is mirrored. The original moves to the reference-only grouplibobs.ported-scene-addand reachesobs_scene_add_internal()through the adapter'sobs_scene_add_attach(). The registration test, the ported source set and therust/README.mdline are included.soldr cargo test -p obs-data --test obs-tests-core scene_add→test result: ok. 10 passed; 0 failed(8 Tier 1, 2 Tier 3).Tiers
obs_scene_add_internal()refuses as the real one does: the C test's cases, plus the exact call order (the add, then the signal with the item it returned, and nothing after a failed add).test_scene_add7/7,test_scene_create2/2,test_scene_canvas_characterization13/13,test_scene_dup_copy_lifetime1/1,test_scene_item_hotkeys2/2,test_group_active_refs10/10,test_scene_enum_items_removal11/11,test_sceneitem_release4/4,test_sceneitem_do_transition10/10,test_scene_item_select4/4.oracle/scene_add.cruns the original and the export on the same real-layout scenes, through the production adapter and the same recording stand-ins forobs_scene_add_internal()(NULL for a NULL scene or source, as the real one gives) andsignal_handler_signal(). It compares the call logs field by field, with nomemcmpover padded entries (see master red: obs-scene item_release_parity fails on Windows (from #6030) #6035): each add's arguments, and each signal's handler, name, calldata"scene"and"item", fixed flag, capacity and size. It also compares the returned items. It covers every call: NULL scene or source, the add answering NULL or one of two items, and either scene. Ten planted mutants are caught. Dropping the signal from the Rust core also fails parity.No intentional differences. No C test or public header changed.
./lintpasses. Like #6038 and #6040, the cmocka half ofci/windows_link_check.pywasn't run here, so CI's Windows link lane covers that.Test cost: the 10 new Rust tests run in about 0.01 s together in debug, with
OBS_PARITY_CASES=reducedor full cases (the grid is exhaustive, with no proptest). Peak RSS is 15 MB over 20 runs, and the tests start no threads of their own.🤖 Generated with Claude Code