Repository navigation
obs-scene: port obs_sceneitem_set_order to Rust (Fixes #5787) - #5789
Merged
Merged
Conversation
New obs-scene module item_set_order with a todo!() core over a
SetOrderScene trait, and Tier 1 tests on a model scene whose links,
lock, reference and signal behave as the C-owned ones do
(detach_sceneitem() and attach_sceneitem() copied onto indexes): every
movement (the four of enum obs_order_movement and seven outside it) on
every item of lists of 1 to 6 items, the exact calls of each anchor
(prev->prev and the walk to the last item read after the detach), a
single item, NULL, detached and dying-scene items, and the sequence of
test_scene_canvas_characterization's scene_item_set_order with its
reorder counts.
soldr cargo test -p obs-data --test obs-tests-core -- scene::item_set_order
test result: FAILED. 0 passed; 7 failed
panicked at rust/obs-scene/src/item_set_order.rs:53:5: not yet implemented: #5787
Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_sceneitem_set_order() moves to obs-scene's item_set_order module. A NULL item, or one whose obs_scene_get_ref(item->parent) is NULL, returns before any lock. Under the full scene lock (video, then audio) the item's next and prev pick the existing item_order::anchor() (#2895); for every anchor but Stay the item is detached and attached again after prev->prev, next, prev, the last item (walked from next after the detach) or at the bottom; then the lock is released, reorder signalled on the item's parent and the scene reference released. Stay, a movement outside enum obs_order_movement, unlocks and releases without a signal, as the extracted C does on that anchor. The shim reads the parent through obs_sceneitem_parent_fields(), the next links through obs_scene_lookup_next(), takes the reference through obs_scene_get_ref()/obs_scene_release() and the lock through obs_scene_atomic_full_lock()/unlock(), and reaches prev, detach_sceneitem(), attach_sceneitem() and signal_reorder() (static in obs-scene.c.h) through the new adapters of obs-scene-item-set-order-fields.c.h (live core-source group, no EXPORT). The extracted C builds in the reference group libobs.ported-scene-item-set-order, where obs-scene-item-set-order-support.c.h forwards its static helpers to those adapters and to the full-lock wrapper. Tier 3 (item_set_order_parity, oracle/scene_item_set_order.c) runs the original C and the Rust export on noise-filled real-header scenes, over lists of 0 to 6 items in both link orders, every item, NULL, detached and dying-scene items, eleven movements and a proptest over any int, comparing the call trace (references, lock, detach, attach with its anchor, signal with the parent it read, each with the lock depth), every scene, source and item byte, the reference count and the lock depth; it rejects six mutants (signal under the lock, no release, always the bottom, no lock, prev for prev->prev, a signal on Stay). The shared real-named full-lock and source-reference stand-ins in scene_atomic_update.c dispatch to an active set-order probe. Mutation check: making up attach after prev in the core fails every_case_matches_c and four Tier 1 tests (reverted). soldr cargo test -p obs-data --test obs-tests-core -- scene::item_set_order test result: ok. 12 passed; 0 failed soldr cargo test -p obs-data --test obs-tests-core -- scene:: test result: ok. 665 passed; 0 failed Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1795723101,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":94,"stamp":"ed90449a2ef0f0314a930431f987aef2","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723101,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":94,"stamp":"14b74a5baee6ae9be0c4b62fb499799f","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723101,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":94,"stamp":"1d897c9b6a7bc42a68da7e472f67c4ae","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723101,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":94,"stamp":"63bda9743cfe787e2e30b23213a41f18","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"general/all/client-lint","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"c3be1785a3383f5b130d7e5a9a98653d","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723101,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":94,"stamp":"b64e20c5019ebd0e705056c080966654","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"625702e3869dc289f6796f676d409a6e","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"b544b371fdab103dd6cfe4baa97200e5","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"f28e729eaabe09c1d06c598e9aeda708","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"1a2178d7ae97ec6ba213b77326b3bc27","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"02d4b2bc78769ed3b3956d04f0a3260b","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"caa064a97bc8ba7a3af3f8dec5ee334d","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"993ca87e2acbde963dc93fa660ae6d6a","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"9e40d403a2703593ee0c95c0321ae327","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"b3db6bc300a9a3c001ba81aa3e393aa9","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"64ef465d038660bb08c0e7f497f0ee7e","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"8062cba37c9a9ab3ffc86a7fa341cb59","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723006,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"729355801c22161d58367e42557d48110ddf59291343b185cc9e4321f7677766","lane":"client-lint","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":129,"stamp":"b0883f2f71d7b9ac8caca4206256d8c5","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Ci-Attestation: {"at":1795723460,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"df8123bbff7852fc0762d4522471400d88962ff0344669f74afa7d0d7c6557c7","lane":"client-test-x86_64-unknown-linux-gnu","parents":["b7596b47f31dc2664b1359e6f31cd0d014746267"],"secs":359,"stamp":"b56e36be56f621d5d40f4fb37f67052a","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4","v":1,"via":"run"} Client-Checks: {"checks":{"base":"5fd85c15ec022e55b5b0b3b7d7f59461fba59c2c","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-scene-item-set-order+.h.c","libobs/build/ported-source-sets/scene-item-set-order.json","libobs/cmake/rust-exports.d/obs-scene-item_set_order.txt","libobs/obs-scene-item-set-order-fields.c.h","libobs/obs-scene-item-set-order-support.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_scene_item_set_order_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/scene-item-set-order.list","rust/obs-c-oracle/oracle/scene_atomic_update.c","rust/obs-c-oracle/oracle/scene_item_set_order.c","rust/obs-scene/src/ffi/item_set_order.rs","rust/obs-scene/src/ffi/mod.rs","rust/obs-scene/src/item_set_order.rs","rust/obs-scene/src/lib.rs","rust/obs-scene/tests/scene/item_set_order.rs","rust/obs-scene/tests/scene/item_set_order_parity.rs","rust/obs-scene/tests/scene/main.rs"],"head":"5ac7997f9842b33caae1c6173ff839a0ee9a590c","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":"d3fcef35860e109365e386d1e51ad9793a1422d1e162520f0eb921b09f90cdbe","tree":"955fcbc4c01b524eecc51837eaa540f6132f0ad4"}}
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 26, 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_sceneitem_set_order()(extracted intolibobs/obs-scene-item-set-order.c.hby #5650) toobs-scene, following theobs_source_filter_set_order()swap (#5776) and the obs-scene seam style of #5377.What moved
rust/obs-scene/src/item_set_order.rsover aSetOrderScenetrait, in the C's order. A NULL item, or a NULLobs_scene_get_ref(item->parent), returns before any lock. The full lock is taken, thennext/prevpick the existingitem_order::anchor()(rust: Port the scene item order and group membership rules in obs-scene.c to obs-scene #2895). For every anchor exceptStay, the item is detached, then attached afterprev->prev(read after the detach),next,prev, the last item (walked fromnextafter the detach) or at the bottom. Then unlock,reorderon the item's parent, release.Stayunlocks and releases with no signal.rust/obs-scene/src/ffi/item_set_order.rsexportsobs_sceneitem_set_order(libobs/cmake/rust-exports.d/obs-scene-item_set_order.txt). It goes throughobs_sceneitem_parent_fields,obs_scene_get_ref/obs_scene_release,obs_scene_atomic_full_lock/unlock,obs_scene_lookup_next, and the new private adapters inlibobs/obs-scene-item-set-order-fields.c.h(live core-source group, noEXPORT). Those adapters coverprev,detach_sceneitem(),attach_sceneitem()andsignal_reorder(), which stay static inobs-scene.c.h.libobs.ported-scene-item-set-order. There,obs-scene-item-set-order-support.c.hforwards its static helpers to the same adapters and to the full-lock wrapper, because the helpers live in another unity group.rust/obs-scene/tests/scene/item_set_order_parity.rsandrust/obs-c-oracle/oracle/scene_item_set_order.c. The shared real-named full-lock and source-reference stand-ins inoracle/scene_atomic_update.chand off to an active set-order probe.rust/README.mdrow are updated.No public header or C test changes. The intentional difference is the one #2895 already made in the anchor: on the C reference, a movement outside the enum detaches the item and never re-attaches it. The hybrid's
Stayleaves the item where it was.RED
GREEN
To check that the cmocka cases really ran and were not skipped, I ran
test_scene_canvas_characterizationstraight from the kept build volume underxvfb-run. It ran 13 tests and passed 13, includingscene_item_set_order, on both the hybridlibobsand the C reference (libobs-c-reference/libobs.so.30, checked withldd).Tier 3 compares, on noise-filled real-header scenes:
The inputs cover lists of 0 to 6 items in both link orders, every item, NULL, detached and dying-scene items, eleven movements, and a proptest over any
int. It catches six mutants: signal under the lock, no release, always the bottom, no lock, prev for prev->prev, and a signal onStay. Mutation check: making up-moves attach afterprevin the core failsevery_case_matches_cand four Tier 1 tests (reverted).Fixes #5787
🤖 Generated with Claude Code