Repository navigation
obs-scene: swap scene-item order position to safe Rust (Refs #5285) - #5377
Merged
Merged
Conversation
) Tier 1 mirrors every assertion of test_sceneitem_order_position.c against the safe core; Tier 3 compares the original extracted C wrapper with the shim on one fixture through the real-named full lock and the real parent, head and link adapters, with mutants for a missing unlock, a walk after the unlock, a walk before the lock, a head read under the lock and off-by-one counts. The lock stand-in clears the head or the first link until the unlock, so moved reads change the result. NULL and detached items are undefined on the C reference (legacy predicate, #2899), so they are left out of differential execution and checked against the shim alone. The shared real-named full-lock stand-in in scene_atomic_update.c now also dispatches to an active order-position probe. The new private head adapter (obs-scene-item-order-position-fields.c.h) reads scene->first_item. The core and shim are stubs that always return 0, so: soldr cargo test -p obs-data --test obs-tests-core item_order_position test result: FAILED. 3 passed; 6 failed Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_sceneitem_get_order_position now comes from obs-scene in the hybrid libobs. Safe Rust reads the item's parent through the existing obs_sceneitem_parent_fields adapter and applies the #2899 attached-item predicate, so a NULL or detached item is 0 before any other read or lock. It then reads the parent's head through the new private obs_scene_item_order_position_first adapter before the C-owned full lock, as the C did, and walks the links (obs_scene_lookup_next) and counts under exactly one full lock. The original wrapper moves to the libobs.ported-scene-item-order-position group for the C reference build. soldr cargo test -p obs-data --test obs-tests-core item_order_position test result: ok. 9 passed; 0 failed Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1795229913,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":95,"stamp":"d7dbd3fbf1ffd6e1093197af14ca8f97","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229913,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":95,"stamp":"346d77bb825006571b033895ab6ba1f8","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229913,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":95,"stamp":"0a43babaef33e2d26c3338b169490482","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229913,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":95,"stamp":"6fc65567b36c75e9abb6140b03a74209","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"general/all/client-lint","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"5be43ac65a0aec330c80bd313c3a71e3","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229913,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":95,"stamp":"ace7cdd534f37533635066af4c9ef543","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"d5cf8807723bf9949309c1a862271321","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"7e4c330e1f362c0779514082055fad33","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"ba2ccf6b19d35c98fabade681410bca0","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"d8638d645cdb3531ea167ba0fcb341d5","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"0677bea1c2d000c9b7f764bd55f9f11c","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"5ce100ec980da8d95d82179611e7773b","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"91d090c2afbd179c43bd1fe7e7730513","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"5a77aeda0066ea1783ad4f88f933bb7c","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"3d445360e9c249f02ca4172a2bae90c2","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"6cdd2cc02146673296514c27d93bba33","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"9243dd113a13f400aafcc54549ee9d5a","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795229817,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f64b7a53d72554316961568bc00cd39e350f3b63c84cdd2bd2604f40138e1ef2","lane":"client-lint","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":58,"stamp":"b1f09cfca26259daf689349b48a5a07c","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Ci-Attestation: {"at":1795230130,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"8ed1cfaa8d34bbc0f2be7c23aabb417d1ca95e6677eed7509db2cb20c9ebf331","lane":"client-test-x86_64-unknown-linux-gnu","parents":["b4b7bc9aa9a5ade60ab64ae1f1ba5398c435056f"],"secs":216,"stamp":"0d83e9050c3b88482682a956c509628b","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc","v":1,"via":"run"} Client-Checks: {"checks":{"base":"937eecf4675ee49570d7f20d514a8bc9e0a78b56","coverage":"all-tracked-applicable-files","diff":["ci/test_bench_libobs_stand_ins.py","libobs/build/libobs.core-output+.h.c","libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-encoder-group-num-started+.h.c","libobs/build/libobs.ported-scene-item-order-position+.h.c","libobs/build/ported-source-sets/encoder-group-num-started.json","libobs/build/ported-source-sets/scene-item-order-position.json","libobs/cmake/rust-exports.d/obs-scene-item_order_position.txt","libobs/cmake/rust-hidden.d/obs-output-encoder_group_num_started.txt","libobs/obs-encoder-group-num-started-fields.c.h","libobs/obs-scene-item-order-position-fields.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_encoder_group_num_started_swap_is_registered.rs","rust/obs-build/tests/native/registration/canonical_scene_item_order_position_swap_is_registered.rs","rust/obs-build/tests/native/registration/rust-static/cases/core-relinked/test_encoder_group_num_started_rust.json","rust/obs-c-oracle/benches/port_comparison.rs","rust/obs-c-oracle/oracle.d/scene-item-order-position.list","rust/obs-c-oracle/oracle/encoder_group_num_started.c","rust/obs-c-oracle/oracle/scene_atomic_update.c","rust/obs-c-oracle/oracle/scene_item_order_position.c","rust/obs-output/src/encoder_group_num_started.rs","rust/obs-output/src/ffi/encoder_group_num_started.rs","rust/obs-output/src/ffi/mod.rs","rust/obs-output/src/lib.rs","rust/obs-output/tests/output/encoder_group_num_started.rs","rust/obs-output/tests/output/encoder_group_num_started_parity.rs","rust/obs-output/tests/output/interleave_parity.rs","rust/obs-output/tests/output/main.rs","rust/obs-scene/src/ffi/item_order_position.rs","rust/obs-scene/src/ffi/mod.rs","rust/obs-scene/src/item_order_position.rs","rust/obs-scene/src/lib.rs","rust/obs-scene/tests/scene/item_order_position.rs","rust/obs-scene/tests/scene/item_order_position_parity.rs","rust/obs-scene/tests/scene/main.rs","test/cmocka/build/test-graph.json","test/cmocka/encoder-group-num-started-record-support.c"],"head":"9de95d55e3b8f58ffd45fa842187f5ae3fc8374d","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":"0259bed89774122a46cadeb0e49f537ad1f7698bc5ab0db3962327fef6c1f384","tree":"27651c64b06819be679edee2b7f19b4223a8a5dc"}}
This was referenced Nov 21, 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.
Refs #5285
Swaps the public
obs_sceneitem_get_order_position(obs.h,EXPORT) into obs-scene, now that the wrapper sits in its own file (#5284, done by #5296). Safe Rust owns the decision: a NULL or detached item is 0 before any other read or lock (the attached-item predicate of #2899,item_order::item_attached). Otherwise Rust reads the parent's head before the full lock, as the C did, then walks the links and counts under exactly one full lock. The parent field, the links and the lock stay in C behind the existing adapters (obs_sceneitem_parent_fields,obs_scene_lookup_next,obs_scene_atomic_full_lock/unlock), plus one new private head adapter (libobs/obs-scene-item-order-position-fields.c.h), so Rust never sees the scene layout. The original moves tolibobs.ported-scene-item-order-positionfor the C reference. The name goes inrust-exports.d, so plugins that bind it throughlibobs.sokeep working. Not user-visible, so no features-ledger line.Kept, characterized, not endorsed: an item that its parent's list does not hold returns the list's length.
Intentional difference, kept from #2899: the C reference's legacy predicate always accepts, so NULL and detached items are undefined there. Tier 3 leaves them out of differential execution and checks them against the shim alone.
Callers
obs-scene-item-order.c.his C and now resolves to the Rust export.test_sceneitem_order_position,test_scene_item_order_steps,test_group_insert_emptyandtest_scene_canvas_characterizationare unchanged and pass on both builds (Tier 2 below).scene_atomic_update.c) now also hands the call to an active order-position probe, in the same way it already does for the parent-group probe (scene_item_get_group.c). The atomic-update and get-group parity tests still pass.RED (b4b7bc9)
Tier 1 mirrors every assertion of
test_sceneitem_order_position.cagainst the safe core. Tier 3 compares the original extracted C wrapper with the shim on one fixture through the real-named full lock and the real parent, head and link adapters, comparing the position, the lock trace and every scene and item byte. The lock stand-in clears the head or the first link until the unlock, so a read moved across the lock changes the result. The mutants are: missing unlock, walk after the unlock, walk before the lock, head read under the lock, and counts off by one either way. The core and shim are stubs that return 0:(The 3 tests that pass on the stub are the NULL/detached case, the
c_intlayout check and the hybrid's no-lock check for NULL or detached items. All three expect 0, which the stub already returns.)GREEN (6be8598)
OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests 'order_position'): exported symbols C vs Rust IDENTICAL (1769). OFF/C reference: 1064/1064 passed, repeat 1/1. ON/hybrid: 1064/1064 passed, repeat 1/1.test_sceneitem_order_positionhas noskip()and noobs_startup(), so its 4 cases ran on both builds.uv run --no-project ci/windows_link_check.py: the Windows MSVC (win-x64) and Darwin (mac-arm64) Tier 2 builds link (link only, nothing executed)../lint: ok../push: client-lint (clippy and Dylint on every client target) passed; the head is unsigned, so the regular PR checks run.Not verified locally: running natively on macOS or Windows (CI runs those).
🤖 Generated with Claude Code