Repository navigation
obs-scene: port obs_scene_add_group, obs_scene_add_group2 and obs_scene_insert_group2 to Rust (Fixes #6049) - #6052
Conversation
zackees
left a comment
There was a problem hiding this comment.
Coordinator review: LGTM. It ports the three public group constructors with a rust-exports.d entry, a new Tier 2 test, test_scene_add_group.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.
|
Coordinator rebase onto master after #6048. The conflicts were adjacent list entries in |
2187ab7 to
c45da5d
Compare
c45da5d to
8d3d148
Compare
…scene_insert_group2 (Refs #6049) test_scene_add_group creates groups through the three entries on real scenes of a started libobs: a NULL scene gives NULL from each, with or without items, and creates no group source. With no items (a NULL array or a count of 0) the new group item, named as asked with an empty scene of its own and held only by the scene, is last in the list and no "item_add" fires; obs_scene_add_group() never fires "refresh", the other two fire it once on the scene's source with the scene, after the group is listed, only when signal is true. obs_scene_insert_group2() with items moves them in the array's order into the new group, which takes the place of the array's last item; one "item_add" with the scene and the group after the move, then "refresh" when signal is true. An item of another scene or an item that is a group gives NULL with no group created, nothing moved and no signal. 7/7 on hybrid libobs and the C reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ne_insert_group2 verbatim (Refs #6049) The three wrappers move unchanged into obs-scene-add-group.c.h, in the live group libobs.core-source. It sorts before obs-scene.c.h there, so it declares the static inline signal_refresh() it calls, which obs-scene.c.h defines and obs_sceneitem_group_ungroup2(), obs_sceneitem_group_add_item() and obs_sceneitem_group_remove_item() also call; obs_scene_insert_group() (declared in obs.h) stays in obs-scene.c.h. test_scene_add_group and the 25 other cmocka tests that create groups or items (test_scene_add, test_scene_canvas_characterization, test_group_active_refs, test_group_insert_empty, test_sceneitem_remove, test_scene_dup_group_children, test_shutdown_detach, ...) pass on hybrid libobs and the C reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bs_scene_insert_group2, RED (Refs #6049) The safe core obs_scene::scene_add_group (InsertGroup trait; add_group(), add_group2() and insert_group2()) as todo!() stubs, with 8 Tier 1 tests in the scene test binary over model scenes and items whose obs_scene_insert_group() refuses, creates, places and moves as the real one does and fires "item_add" only when items moved: the cases of test_scene_add_group (NULL scene, plain adds with no signal, "refresh" only with signal, no items as NULL or a count of 0, items moved in the array's order with the group in the last one's place, refused foreign and group items) and the arguments passed through in order. soldr cargo test -p obs-data --test obs-tests-core scene_add_group test result: FAILED. 0 passed; 8 failed (not yet implemented: #6049 GREEN) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ne_insert_group2 to Rust, GREEN (Fixes #6049) The Rust core runs the original's steps: obs_scene_add_group() is obs_scene_insert_group(scene, name, NULL, 0); obs_scene_add_group2() is obs_scene_insert_group2(scene, name, NULL, 0, signal); and obs_scene_insert_group2() calls obs_scene_insert_group(scene, name, items, count), then signal_refresh(scene) only when signal is true and an item came back, and returns the item. No argument is checked, as in C. The three exports (rust-exports.d, all EXPORT in obs.h) are the whole entries. The live adapter obs-scene-add-group-fields.c.h keeps obs_scene_insert_group() and the static signal_refresh() of obs-scene.c.h (the ungroup and group add/remove item paths call it too) in C, so no layout is mirrored; the original moves to the reference-only group libobs.ported-scene-add-group and reaches signal_refresh() through the adapter's obs_scene_add_group_refresh(). Tier 3 (oracle/scene_add_group.c) runs the original and the exports through the same adapter and recording stand-ins for obs_scene_insert_group() and signal_refresh() and compares the call logs field by field (each call's arguments in order, then the result) over every entry with a NULL or either scene and name, a NULL or either array with 0 to 3 items, signal false or true and the insert answering NULL or either item; twelve planted mutants are caught. soldr cargo test -p obs-data --test obs-tests-core scene_add_group test result: ok. 10 passed; 0 failed Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1796117760,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":77,"stamp":"693a4bad6d48dd37527f9d3e6f9ad165","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117760,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":77,"stamp":"afeb0278844283fad131d56b86c6294f","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117760,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":77,"stamp":"288bbc281978b164b545ecde832f1dfc","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117760,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":77,"stamp":"a8e7baaf856261cc08b2c0a5d3078a6e","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"general/all/client-lint","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"d1250e5cf55bdd74bc87839af98fbf50","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117760,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":77,"stamp":"ac8826c67cd2dd180341bf990db52b0c","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"6bb09c696d4f0391058d5a1beea2e496","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"99e235b8f9c9fe3117f1ed819ca8766d","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"90436c878e0e9963a2c63c63a00d106e","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"7134ea1f35511ce5801b6288a5399dac","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"078eb40ad2db9ad9655650243b090853","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"0cb0565748138fe7613fcd7a142852db","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"82326bfd635dfd485dbe77d024fdb7de","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"f60c4bac395b5e0adfcc9abd5004d334","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"cb3faba3ad1f31b58c72d141e34221aa","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"24eef03347056ebeca39a9e4bbb4156f","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"66cabbea9c69b7a1b7bc9fbf96025967","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796117682,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"53924f887a010efc951e093951665ca799f44e30e299d5733ecfa47b863138fb","lane":"client-lint","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":78,"stamp":"907837506285d35c56bd6ea22b40cd97","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Ci-Attestation: {"at":1796118089,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"dafc1315aa0798791a9687c859e92bbe1def44b3729ef4d57c59c641559f94c6","lane":"client-test-x86_64-unknown-linux-gnu","parents":["6ef752a8082242362b70ed18fba43934e3ddbb71"],"secs":328,"stamp":"7a17a4ccff757b8e4df045a2b42d0883","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12","v":1,"via":"run"} Client-Checks: {"checks":{"base":"ccf6978740609b0a581c359c244585eca70843a7","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-scene-add-group+.h.c","libobs/build/ported-source-sets/scene-add-group.json","libobs/cmake/rust-exports.d/obs-scene-scene_add_group.txt","libobs/obs-scene-add-group-fields.c.h","libobs/obs-scene-add-group.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_group_is_registered.rs","rust/obs-c-oracle/oracle/scene_add_group.c","rust/obs-scene/src/ffi/mod.rs","rust/obs-scene/src/ffi/scene_add_group.rs","rust/obs-scene/src/lib.rs","rust/obs-scene/src/scene_add_group.rs","rust/obs-scene/tests/scene/main.rs","rust/obs-scene/tests/scene/scene_add_group.rs","rust/obs-scene/tests/scene/scene_add_group_parity.rs","test/cmocka/build/test-graph.json","test/cmocka/test_scene_add_group.c","test/cmocka/tests.d/test_scene_add_group.cmake"],"head":"5d1c3fafd1bad88d3ab0c424e2e5a725212192b4","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":"5f77fb9c621d905cd76531dec3b9c119a4ac78e2393c7d2538ddc6d7532af0de","tree":"82aacdd4d0664c495872a4fb0ec72cc1ec039d12"}}
|
Coordinator rebase onto master after #6054. One code conflict, in |
8d3d148 to
17d01d5
Compare
Ports
obs_scene_add_group(),obs_scene_add_group2()andobs_scene_insert_group2()fromlibobs/obs-scene.c.htoobs-scene, the same shape as the add (#6042) and save/add (#6048) ports. All three are thin wrappers overobs_scene_insert_group(), which stays C (a larger port of its own), as does the staticsignal_refresh()(the ungroup and group add/remove item paths call it too).Fixes #6049
Commits
test: characterize obs_scene_add_group, obs_scene_add_group2 and obs_scene_insert_group2): newtest_scene_add_group, 7 cases on real scenes. A NULL scene gives NULL from each entry, with or without items, and creates no group source. With no items (a NULL array or a count of 0) the new group item, named as asked, with an empty scene of its own and held only by the scene, is last in the list and no"item_add"fires;obs_scene_add_group()never fires"refresh", the other two fire it once on the scene's source with the scene, after the group is listed, only whensignalis true.obs_scene_insert_group2()with items moves them in the array's order into the new group, which takes the place of the array's last item; one"item_add"with the scene and the group after the move, then"refresh"whensignalis true. An item of another scene, or an item that is a group, gives NULL with no group created, nothing moved and no signal (signaltrue or false). 7/7 on hybrid libobs and the C reference before anything moved.libobs: extract ... verbatim): the three functions move unchanged intolibobs/obs-scene-add-group.c.h, in the live grouplibobs.core-source. It sorts beforeobs-scene.c.h, so it declares the static inlinesignal_refresh();obs_scene_insert_group()is declared inobs.h.test_scene_add_groupand the 25 other cmocka tests that call these entries or build the scenes they touch pass on both libraries (list under Tiers).obs-scene: Tier 1 ..., RED): the safe coreobs_scene::scene_add_group(InsertGrouptrait;add_group(),add_group2(),insert_group2()) astodo!()stubs and 8 Tier 1 tests over model scenes.soldr cargo test -p obs-data --test obs-tests-core scene_add_group→test result: FAILED. 0 passed; 8 failed(eachnot yet implemented: #6049 GREEN).obs-scene: port ... to Rust, GREEN): the core runs the original's steps:obs_scene_add_group()isobs_scene_insert_group(scene, name, NULL, 0);obs_scene_add_group2()isobs_scene_insert_group2(scene, name, NULL, 0, signal);obs_scene_insert_group2()callsobs_scene_insert_group(scene, name, items, count), thensignal_refresh(scene)only whensignalis true and an item came back. No argument is checked, as in C. The exportsobs_scene_add_group,obs_scene_add_group2andobs_scene_insert_group2(rust-exports.d, allEXPORTinobs.h) are the whole entries. The live adapterobs-scene-add-group-fields.c.hkeepsobs_scene_insert_group()and the staticsignal_refresh()in C, so no layout is mirrored. The original moves to the reference-only grouplibobs.ported-scene-add-groupand reachessignal_refresh()through the adapter'sobs_scene_add_group_refresh(). 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_group→test result: ok. 10 passed; 0 failed(8 Tier 1, 2 Tier 3).Tiers
obs_scene_insert_group()refuses, creates, places and moves as the real one does and fires"item_add"only when items moved: the C test's cases, plus the arguments (NULL name included) passed through in order with"refresh"after the insert on the same scene.xvfb-run -afrom the runtime dir, then again withLD_LIBRARY_PATH=/build/tree/libobs-c-reference):test_scene_add_group7/7,test_scene_add7/7,test_scene_create2/2,test_scene_canvas_characterization13/13,test_group_active_refs10/10,test_group_insert_empty4/4,test_group_hide_transition_audio4/4,test_group_empty_bounds18/18,test_group_recursion3/3,test_canvas_move_scene3/3,test_canvas_rules_callers9/9,test_preview_only_hide6/6,test_scene_dup_group_name4/4,test_scene_dup_group_children6/6,test_scene_dup_copy_lifetime1/1,test_scene_item_defer_update8/8,test_scene_item_select4/4,test_scene_item_hotkeys2/2,test_sceneitem_remove5/5,test_scene_enum_items_removal11/11,test_scene_transform_update_walk12/12,test_scene_transform_states4/4,test_shutdown_leaked_scenes5/5,test_shutdown_detach2/2,test_source_duplicate9/9,test_visibility_transition8/8.oracle/scene_add_group.cruns the original and the exports through the production adapter and the same recording stand-ins forobs_scene_insert_group()(answering NULL or one of two items, as the script says) andsignal_refresh(). The test compares the call logs field by field (each call's arguments in order, then the entry's result; nomemcmpover padded entries, see master red: obs-scene item_release_parity fails on Windows (from #6030) #6035) over 729 calls: every entry with a NULL or either scene and name, a NULL or either items array with 0 to 3 items,signalfalse or true, and the insert answering NULL or either item. Twelve planted mutants of the original are caught, and four mutants of the Rust core (refresh ignoringsignal,obs_scene_add_group()refreshing,obs_scene_add_group2()invertingsignal, an extra insert) each fail Tier 1 and parity.No intentional differences. No C test or public header changed.
./lintpasses. The registration tests pass (soldr cargo test -p obs-studio-rust --test obs-tests-app canonical_scene: 26 passed). Like #6042 and #6048, 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.02 s together in debug, with
OBS_PARITY_CASES=reducedor full cases (the grid is exhaustive, with no proptest). Peak RSS is 14.1 MB over 20 runs, and the tests start no threads of their own.🤖 Generated with Claude Code