Skip to content

obs-scene: swap scene-item parent-group query to safe Rust (Refs #5290) - #5318

Merged
rdoupe merged 2 commits into
masterfrom
port/5290-sceneitem-get-group
Nov 20, 2026
Merged

rdoupe merged 2 commits into
masterfrom
port/5290-sceneitem-get-group

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #5290.

Swap only obs_sceneitem_get_group into obs-scene. Safe Rust rejects a NULL scene or item before any read. It rejects a group item (read through the existing obs_sceneitem_group_scene_flag adapter) before taking any lock. It then takes the C-owned full lock once around the C-owned walk and returns the result as a borrowed pointer with no added reference. The walk is obs_sceneitem_parent_group_lookup, which the reorder callers still share. No new adapter is added. The original C wrapper moves to the libobs.ported-scene-item-get-group group, which builds the C reference only.

Tests:

  • Tier 1 mirrors every assertion of the unchanged test_sceneitem_get_group.c (from libobs: characterize and extract scene-item parent-group query (Refs #5276) #5289) against the safe core.
  • Tier 3 compares the original extracted C wrapper with the shim on one fixture, through the real-named lock, walk and group-flag boundary.
  • Mutation cases cover five broken versions: a missing unlock, an unlocked walk, locking for a group item, a second flag read and a dropped result.
  • The shared real-named full-lock stand-in in scene_atomic_update.c now hands off to the active parent-group probe first.

Evidence

RED (dff036172, core and shim are stubs that return NULL):

soldr cargo test -p obs-data --test obs-tests-core item_get_group
test result: FAILED. 1 passed; 6 failed

GREEN (344794b0c, rebased on 3b8563940):

soldr cargo test -p obs-data --test obs-tests-core item_get_group
test result: ok. 7 passed; 0 failed

OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests sceneitem_get_group
100% tests passed, 0 tests failed out of 1044   (hybrid libobs and C reference, each)
test_sceneitem_get_group ... Passed              (repeat pass, ON and OFF)

uv run --no-project ci/windows_link_check.py      exit 0 (Windows MSVC and Darwin arm64 links)
./lint                                            lane lint: ok

The change has no user-visible effect, so it adds no features-ledger line. Native Windows/macOS execution is not claimed. The push had no signed client evidence, so the ordinary PR CI must pass.

🤖 Generated with Claude Code

rdoupe and others added 2 commits November 19, 2026 19:51
…#5290)

Tier 1 mirrors every assertion of test_sceneitem_get_group.c against the
safe core; Tier 3 compares the original extracted C wrapper with the shim on
one fixture through the real-named lock, walk and group-flag boundary, with
mutants for a missing unlock, an unlocked walk, locking group items, a
second flag read and a dropped result. The shared real-named full-lock
stand-in in scene_atomic_update.c now dispatches to an active parent-group
probe first.

The core and shim are stubs that always return NULL, so:
  soldr cargo test -p obs-data --test obs-tests-core item_get_group
  test result: FAILED. 1 passed; 6 failed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
obs_sceneitem_get_group now comes from obs-scene in the hybrid libobs. Safe
Rust rejects a NULL scene or item before any read and a group item (read
through the existing obs_sceneitem_group_scene_flag adapter) before any
lock, then takes the C-owned full lock once around the C-owned walk
(obs_sceneitem_parent_group_lookup, still shared with the reorder callers)
and returns its result as a borrowed pointer. The original wrapper moves to
the libobs.ported-scene-item-get-group group for the C reference build.

  soldr cargo test -p obs-data --test obs-tests-core item_get_group
  test result: ok. 7 passed; 0 failed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ci-Attestation: {"at":1795137681,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":94,"stamp":"da860ded63ac467c9cf83c567dba639f","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137681,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":94,"stamp":"0c389a57702fbdc62568259a4dae7617","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137681,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":94,"stamp":"7048fd9b7ac42f1352508e2d737820e3","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137681,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":94,"stamp":"1e08863b727f90be5e9a3a924ddb6cb9","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137585,"gate":"general/all/client-lint","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"37cfe49363a1176fbb702c4a707df14a","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137681,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":94,"stamp":"3d9dc77840a45f93b6d67b6baa66bb90","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"bd5348b2573edd5ea87ca662ae133cee","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"9c1a276dda417faf502be2256c407bd1","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"fa5721ed25a260a7bed795e858eeceaf","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"b1e3d097f0677c77ea9b3b490b710517","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137585,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"112a54dd02aba35da15cebdc166b61fe","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137585,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"78c272385f5b9e255edb1420175853a4","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"38857d4734d1b0c4f1238c5a07f4f0ef","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"1172c74a4f56f25860c502e3c5667b17","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"ec2c3daff22940c896cc5a92bc7b5c24","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137586,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"e286b851bf5794cad1b5c19b99d49052","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137585,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"24fb535f2cf2fff3dedf25bdcb81d1a2","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137585,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e4de114e7e55e2cfc5dfec3c6b859e0f8cd5ecd15e5898620e2c7dda37453f6c","lane":"client-lint","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":76,"stamp":"55946666aa60602cf1b87cfdd19eb9c9","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}
Ci-Attestation: {"at":1795137891,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"a4f4bca8fc277273a683223fed952e899635c97ccec4f74cf01f470f22d5d114","lane":"client-test-x86_64-unknown-linux-gnu","parents":["dff036172f3a61e4f0de23e1b3d08f181e1ff4af"],"secs":209,"stamp":"ec7da1f51a98b2b6873903eeb5d965c2","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"3b8563940504be9c25e19d594fa5667996cb13b6","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-scene-item-get-group+.h.c","libobs/build/ported-source-sets/scene-item-get-group.json","libobs/cmake/rust-exports.d/obs-scene-item_get_group.txt","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_scene_item_get_group_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/scene-item-get-group.list","rust/obs-c-oracle/oracle/scene_atomic_update.c","rust/obs-c-oracle/oracle/scene_item_get_group.c","rust/obs-scene/src/ffi/item_get_group.rs","rust/obs-scene/src/ffi/mod.rs","rust/obs-scene/src/item_get_group.rs","rust/obs-scene/src/lib.rs","rust/obs-scene/tests/scene/item_get_group.rs","rust/obs-scene/tests/scene/item_get_group_parity.rs","rust/obs-scene/tests/scene/main.rs"],"head":"96aab97749dd1b990e449adbaf9eafa9c51d81cd","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":"35a0cd9f4ee6d3dac836568a817c111c6f705a5ec7caf2b26e422be4aed86eb3","tree":"d2738fb520af1cfd3acbf2f753e375fca6f213f6"}}
@rdoupe
rdoupe requested a review from zackees as a code owner November 20, 2026 01:25
@rdoupe
rdoupe enabled auto-merge November 20, 2026 02:12
@rdoupe
rdoupe added this pull request to the merge queue Nov 20, 2026
Merged via the queue into master with commit 5d0944d Nov 20, 2026
46 checks passed
@rdoupe
rdoupe deleted the port/5290-sceneitem-get-group branch November 20, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant