Skip to content

obs-core: port generic weak-object reference helpers to Rust - #4951

Merged
zackees merged 2 commits into
masterfrom
port/4258-weak-object-refs-land
Nov 17, 2026
Merged

zackees merged 2 commits into
masterfrom
port/4258-weak-object-refs-land

Conversation

@zackees

@zackees zackees commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Refs #4258

Replace the four generic weak-object reference helpers in hybrid libobs with a safe Rust core and thin NULL-safe ABI shims. Preserve zero-biased reference counts, live-only strong promotion, pointer identity and final weak-control release through bfree. Private C adapters retain ownership of the real libobs layouts. The extracted C implementation remains the reference/oracle, and existing C characterization tests and public headers stay unchanged.

This swap was verified on 2026-11-09 and re-verified on current master on 2026-11-17 UTC. Prerequisite #4254 merged as #4930 (fe472db). Only the swap's own two commits were cherry-picked onto a new branch; the held port/4258-weak-object-refs branch is preserved. The private-header conflict was resolved by retaining both the current expired-reference accessor and the new reference fields/adapters.

The replayed RED commit 9ab7527 makes all four new safe-core characterization cases fail at todo stubs. GREEN 4aa4b4b passes all seven focused safe-core, real-header layout and differential cases with verdict replay disabled. A fresh mutation changing weak addref from +1 to +2 fails both characterized_edges and operation_sequences_match_c on mismatching counts; the mutation was restored. The unchanged Tier 2 test passes three times against each of reference and hybrid libobs, with the loaded library checked explicitly and identical dynamic symbol lists. Tier 4 does not apply to these local reference helpers. Native Windows/macOS runtime validation was not run locally.

Test cost: all seven focused Rust cases passed over 25 repeated reduced-parity debug runs. Longest complete module run: 0.403 s; peak RSS: 23,532 KiB; no test-owned threads. Focused Tier 2 CTest cases took 0.06–0.18 s per run. A read-only clud-review found no concrete defects.

All 279 native_build fixtures passed (478.87 s execution), including canonical Rust-static consumers; no graph changes were needed. After restoring the mutation, all seven focused Rust tests passed again with verdict replay disabled. The single final ./lint run passed in 826.7 s, including formatters, the Python self-tests, workspace Clippy and every feature-set Clippy run. The final ./push completed all required client gates: six-target Clippy and Dylint passed in the 335.7 s client-lint lane; self-tests and validators passed; the 854.7 s host client-test lane passed 8,713 workspace tests (six skipped, one slow), documentation tests and 918 feature-matrix tests, and linked every test binary for Windows GNU. All 19 required Ci-Attestation records are on the final signed head, with GitHub verifying its signature. Optional Swift proof was unavailable (exit 75, swift-format absent); no Swift files are selected by this change. The queue-pressure check opened this as a draft; marking ready and arming pinned auto-merge follows the maintainer landing assignment.

Ci-Attestation: {"at":1794891366,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":121,"stamp":"6f922be1bcdb2cff709b86202160e873","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891366,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":121,"stamp":"5433862bfcc84236fcbe70f0831017b9","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891366,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":121,"stamp":"7d128e6f7995e477130fe80130a2b455","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891366,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":121,"stamp":"879791e7473e46cc9051419bbfafc076","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891242,"gate":"general/all/client-lint","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"a3a450844fc9216c7e0997d033c8eebd","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891366,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":121,"stamp":"365b10dda97fd9a204febe343efede71","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891243,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"a3da4c69b4954902a794925aa82e8819","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891243,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"0a02196a20ee7e6fb72e6ccb374ea8e0","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891243,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"f1690e610e37fabe9de29b5271e92964","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891243,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"d49198e4f34fc430ef1cf0b48667a0ed","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891242,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"0b4b82a7decca5307ba5503069fa5e8c","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891242,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"277fbb6a20fc65581912a0aa67c1a794","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891243,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"69b2b323e89b63c72881cfa13a286dff","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891243,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"fe30c5697ef5677c5400910d3adf479d","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891242,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"5286261c606fa3353033e355d0ececce","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891242,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"da99479af2f9929103f565a93160e111","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891242,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"65533107a96e71ae111c2062e9aeaced","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794891242,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"723fa72d89002ca4f56793058333b4d9c35eb01e8d87397d878f477f3324bbed","lane":"client-lint","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":336,"stamp":"f84781ad2b55430512dd40ce6f2e3fc9","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}
Ci-Attestation: {"at":1794892222,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"9464a937b25eb5064dd418fb313823d8f687cd537c67d7488b3bd4f3e81f7d29","lane":"client-test-x86_64-unknown-linux-gnu","parents":["9ab7527227c83cc42815485ff3d53bee35fdcab8"],"secs":854,"stamp":"b99ae21e1cf2540ee4158a92f847bf43","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"d209333c71fa2ff77f92f81c753e7c87cd2e8979","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-weak-object-refs+.h.c","libobs/build/ported-source-sets/weak-object-refs.json","libobs/cmake/rust-exports.d/obs-core-weak_object_refs.txt","libobs/obs-internal.h","libobs/obs-weak-object-refs-fields.c.h","rust/README.md","rust/obs-c-oracle/oracle/weak_object_refs.c","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/ffi/weak_object_refs.rs","rust/obs-core/src/lib.rs","rust/obs-core/src/weak_object_refs.rs","rust/obs-core/tests/obs_core/main.rs","rust/obs-core/tests/obs_core/weak_object_refs.rs","rust/obs-core/tests/obs_core/weak_object_refs_parity.rs","test/cmocka/tests.d/weak_object_refs_link_support.cmake","test/cmocka/weak-object-refs-link-support.c"],"head":"7e727feaea7a2a40829081c3c8f43599270edffa","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.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\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"29e2577ebae6bd680336f775b5b0c054080bb15b376e340cc3e1ffaac2d731b9","tree":"addbb2fa9e2aca27110dca2f59deb758c5ea79d3"}}
@zackees zackees changed the title feat(obs-core): Port generic weak-object reference helpers (#4258) obs-core: port generic weak-object reference helpers to Rust Nov 17, 2026
@zackees
zackees marked this pull request as ready for review November 17, 2026 05:11
@zackees
zackees enabled auto-merge November 17, 2026 05:11
@zackees
zackees added this pull request to the merge queue Nov 17, 2026
Merged via the queue into master with commit 3ae0e74 Nov 17, 2026
41 checks passed
@zackees
zackees deleted the port/4258-weak-object-refs-land branch November 17, 2026 06:34
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