Repository navigation
obs-scene: port obs_sceneitem_group_add_item and obs_sceneitem_group_remove_item to Rust (Fixes #6055) - #6056
Conversation
…up_remove_item (Refs #6055) test_sceneitem_group_add_remove moves items into and out of groups of real scenes: a NULL group or item, or a group item that is not a group, does nothing; an item in another scene, already in the group or in another group is not added; an item that contains the group (the group itself, or a scene that holds it) is not added, with one warning naming both; an added item goes first in the group's list keeping its transform values, which now count from the group (drawn where the group's transform puts its old place, kept as in C), while the group's other items stay where they were and the group grows; a removed item goes first in the scene's list, drawn where it was, the rest of the group staying put; the group's last item out leaves an empty group; each move fires "refresh" once on the scene and nothing else, and the item keeps its one reference. 6/6 on hybrid libobs and the C reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…remove_item verbatim (Refs #6055) obs_sceneitem_group_add_item() and obs_sceneitem_group_remove_item() move unchanged into obs-sceneitem-group-add-remove.c.h, in the live group libobs.core-source after obs-scene.c.h, whose static full_lock(), full_unlock(), move_would_recurse(), remove_group_transform(), detach_sceneitem(), attach_sceneitem(), move_active_child(), apply_group_transform(), resize_group() and signal_refresh() they still call. test_sceneitem_group_add_remove 6/6, test_group_active_refs 10/10, test_group_recursion 3/3, test_group_empty_bounds 18/18, test_scene_item_order_steps 16/16 (and _rust 16/16), test_scene_dup_group_children 6/6, test_scene_enum_items_removal 11/11 and test_visibility_transition 8/8 pass on hybrid libobs and the C reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…group_remove_item, RED (Refs #6055) The safe core obs_scene::item_group_add_remove (GroupMove trait; add_item() and remove_item()) as todo!() stubs, with 11 Tier 1 tests in the scene test binary over a model scene, group scene, second group and other scene (their lists, active children and lock depths), items (group flag, parent, transform offset, recursion, activity) and the warning and "refresh": the cases of test_sceneitem_group_add_remove, an item not in the group for remove (the item-order unit's intentional difference), active and inactive items, and the C's call order with the lock depths of both scenes at each call. soldr cargo test -p obs-data --test obs-tests-core item_group_add_remove test result: FAILED. 0 passed; 11 failed (not yet implemented: #6055 GREEN) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…remove_item to Rust, GREEN (Fixes #6055) The Rust core runs the original's steps in order. Add: a NULL group, a group item that is not a group or a NULL item returns; the group's parent and own scene are read, then the item's parent for the item-order add check; move_would_recurse() logs the original's warning and returns; otherwise full_lock() takes the scene and then the group's scene, remove_group_transform(), detach_sceneitem(), attach_sceneitem() first in the group's scene, move_active_child() from the scene to the group's scene, apply_group_transform(), resize_group(group, false), the unlocks in reverse order and signal_refresh() on the scene. Remove: a NULL item, a NULL group or a non-group returns; the item's and the group's parents are read and the item-order remove check runs on whether the item is in the group's scene; otherwise the same locks, remove_group_transform(), the detach, the attach first in the scene, move_active_child() back, resize_group(group, false), the unlocks and signal_refresh() on the scene. The exports obs_sceneitem_group_add_item and obs_sceneitem_group_remove_item (rust-exports.d, both EXPORT in obs.h) keep their names. The live adapter obs-sceneitem-group-add-remove-fields.c.h keeps the items' and scenes' fields, the static helpers of obs-scene.c.h and the warning in C, so no layout is mirrored; the original moves to the reference-only group libobs.ported-sceneitem-group-add-remove and reaches the static helpers through the adapter under their own signatures. Tier 3 (oracle/sceneitem_group_add_remove.c) runs the original and the exports on the same real-layout group, item and scenes through the same adapter and recording stand-ins (blog() and obs_source_get_name() included) and compares the call logs field by field (each call's arguments, flags and the lock depths, in order, then the item's final parent) over 512 calls; seventeen planted mutants are caught. soldr cargo test -p obs-data --test obs-tests-core item_group_add_remove test result: ok. 13 passed; 0 failed Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1796122744,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":77,"stamp":"9c87f0ade49410f99c67d8296055afc4","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122744,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":77,"stamp":"d2bd326deee7026378e1ea865d3b3fa4","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122744,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":77,"stamp":"afe47987b6aeeb45b8b0d73469e24d67","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122744,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":77,"stamp":"acbfc12ba058c3f914f2e61547ceb162","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122665,"gate":"general/all/client-lint","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"152dc45abca22dcc7e197907b551ecd1","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122744,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":77,"stamp":"d150d84a45df1c28d3ea7e08ffcde44f","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122666,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"51dcdcb835bba49022488db50598e59c","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122666,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"0d226ddad7a30741eb2cb9987928494f","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122666,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"b80805ed230c89529244e1ff1cdc0b0a","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122666,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"2122a827967b171dba05968dd9503fdc","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122665,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"ef973a47a3648e2ae075efedef907e80","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122665,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"5b18efc1e72c8cf30d33336df2c5c7f5","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122666,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"fbd9f029d66feb203c5c74423c2be09a","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122666,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"f8b2a7197cc5a461f91f7925b4be70e5","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122665,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"1165aa2c57c5814130954075386a0335","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122665,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"452bae84eb2c117d26cc8e7edb5f7de9","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122665,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"6b1b5c3f640ea6390125af6b1ace4547","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796122665,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"2355a9a9166759e1693b7f8390d31e8049ad6228765fe2b1e8c07171e61bc282","lane":"client-lint","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":81,"stamp":"f3016b6a7017f69547822ece5f5f2c58","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Ci-Attestation: {"at":1796123120,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"08acee9cf83fd6f5ca1fceb8b1ea5637b51c0e34562e5cbe3b0f86ae472b514d","lane":"client-test-x86_64-unknown-linux-gnu","parents":["648e10959d1ac682f40803795e8dc82eb077fadf"],"secs":376,"stamp":"40df1e633155cea4c4b69b0642e22a56","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b","v":1,"via":"run"} Client-Checks: {"checks":{"base":"9ba30444c9ae5ea342ea535d1bb8d0ceb80d5d80","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-sceneitem-group-add-remove+.h.c","libobs/build/ported-source-sets/sceneitem-group-add-remove.json","libobs/cmake/rust-exports.d/obs-scene-item_group_add_remove.txt","libobs/obs-scene.c.h","libobs/obs-sceneitem-group-add-remove-fields.c.h","libobs/obs-sceneitem-group-add-remove.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_sceneitem_group_add_remove_is_registered.rs","rust/obs-c-oracle/oracle/sceneitem_group_add_remove.c","rust/obs-scene/src/ffi/item_group_add_remove.rs","rust/obs-scene/src/ffi/mod.rs","rust/obs-scene/src/item_group_add_remove.rs","rust/obs-scene/src/lib.rs","rust/obs-scene/tests/scene/item_group_add_remove.rs","rust/obs-scene/tests/scene/item_group_add_remove_parity.rs","rust/obs-scene/tests/scene/main.rs","test/cmocka/build/test-graph.json","test/cmocka/test_sceneitem_group_add_remove.c","test/cmocka/tests.d/test_sceneitem_group_add_remove.cmake"],"head":"8c9a989e4e5d752e7933d09f51453d353525c2d3","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":"da61e937f4488729615fcc00409db112afc2e88a70ca853a96b7d91c1695750b","tree":"748d8b15321b4bd570ff305cef17f4a8ff8c752b"}}
1d21ba8 to
c7a8f0d
Compare
|
Coordinator rebase onto master after #6052. One code conflict, in Since every port in |
zackees
left a comment
There was a problem hiding this comment.
Coordinator review: LGTM. It ports the public obs_sceneitem_group_add_item and obs_sceneitem_group_remove_item with a rust-exports.d entry, a new Tier 2 test, test_sceneitem_group_add_remove.c, and Tier 1 and Tier 3 parity. No existing C test or header is edited, and it has a Test cost line. Auto-merge on.
Ports
obs_sceneitem_group_add_item()andobs_sceneitem_group_remove_item()fromlibobs/obs-scene.c.htoobs-scene, the same shape as the ungroup (#6054), remove (#6040) and add (#6042) ports. The static helpers they call (full_lock(),full_unlock(),move_would_recurse(),remove_group_transform(),detach_sceneitem(),attach_sceneitem(),move_active_child(),apply_group_transform(),resize_group(),signal_refresh()) stay C: the reorder paths use them too.Fixes #6055
Consumers checked: the frontend's "remove from group" (
OBSBasic_SceneItems.cpp.hpp), scripting (throughobs.h) and plugins reach the twoEXPORTsymbols, which keep their names. Nothing else in libobs calls them; they call the item checksobs_scene_item_order_add_item_allowed()andobs_scene_item_order_remove_item_allowed()(Rust since the item-order port).Commits
test: characterize ...): newtest_sceneitem_group_add_remove, 6 cases on real scenes: NULL group or item and a plain item do nothing; an item outside the group's scene (another scene, already in this group, another group) is not added; the group itself or a scene holding it is not added, with one warning naming both; an added item goes first in the group and keeps its transform values, which now count from the group (kept as in C, not endorsed); a removed item goes first in the scene, drawn where it was; the last item out; a round trip; one"refresh"per move and no"item_add"/"item_remove".remove_itemwith an item outside the group isn't pinned there: the C moves it anyway and libobs returns (the existing intentional difference of the item-order unit), so Tier 1 and Tier 3 cover it.libobs: extract ... verbatim): both functions move unchanged intolibobs/obs-sceneitem-group-add-remove.c.h, in the live grouplibobs.core-sourceafterobs-scene.c.h.obs-scene: Tier 1 ..., RED): the safe coreobs_scene::item_group_add_remove(GroupMovetrait) astodo!()stubs and 11 Tier 1 tests on a model scene, group and other scenes.OBS_PARITY_CASES=reduced soldr cargo test -p obs-data --test obs-tests-core item_group_add_removeon 648e109 →test result: FAILED. 0 passed; 11 failed(eachnot yet implemented: #6055 GREEN).obs-scene: port ... to Rust, GREEN): the core runs the original's checks and steps in order (see therust/README.mdline). The live adapterobs-sceneitem-group-add-remove-fields.c.hkeeps the item and scene fields, the static helpers and the warning in C, so no layout is mirrored. The original moves to the reference-only grouplibobs.ported-sceneitem-group-add-removeand reaches the static helpers through the adapter under their own signatures. Registration test, ported source set,rust-exports.dentry andrust/README.mdline included.Same command on the GREEN head →
test result: ok. 13 passed; 0 failed(11 Tier 1, 2 Tier 3).Tiers
remove_itemwith an item outside the group, active and inactive items (the active-child link), and the exact call order with both scenes' lock depths at each call.xvfb-run -afrom the runtime dir, then again withLD_LIBRARY_PATH=/build/tree/libobs-c-reference(the unchanged C):test_sceneitem_group_add_remove6/6 on both,test_group_active_refs10/10 on both.oracle/sceneitem_group_add_remove.cruns the original and the exports on the same real-layout group, item and scenes through the production adapter and the same recording stand-ins (the detach and attach set the parent;blog()andobs_source_get_name()recorded too). It compares the call logs field by field (each call's arguments, flags and lock depths in order, then the item's final parent; nomemcmpover padded entries, see master red: obs-scene item_release_parity fails on Windows (from #6030) #6035) over 512 calls: both entries, a NULL group or item, a group item that is a group or not, the group's and item's parents each NULL, the scene, the group's scene or another scene, and the recursion check either way. All 17 planted mutants of the original are caught.No new 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_sceneitem_group: 2 passed). The cmocka half ofci/windows_link_check.pywasn't run here, so CI's Windows link lane covers it.Test cost: the 13 new Rust tests run in about 0.01 s together in debug with
OBS_PARITY_CASES=reduced(the grid is exhaustive, no proptest). Peak RSS is 14.2 MB typical over 20 runs (one outlier at 46.7 MB), and the tests start no threads of their own.🤖 Generated with Claude Code