Repository navigation
obs-output: swap output last-error query to safe Rust (Refs #5308) - #5339
Merged
Merged
Conversation
rdoupe
force-pushed
the
port/5308-output-get-last-error
branch
from
November 20, 2026 04:12
789c039 to
c51128b
Compare
Collaborator
Author
|
Rebased onto
|
Tier 1 mirrors every assertion of the unchanged
test_output_get_last_error.c against the safe query on a recording model
of the output's fields: result identity, the NULL diagnostic, and every
field read once in priority order with nothing read after a hit. Tier 3
runs the extracted original and the shim on one real-layout output and
encoder fixture through the production field adapters, checks those
adapters address the original's fields, and shows five mutants caught.
The safe query is a stub that returns None:
soldr cargo test -p obs-data --test obs-tests-core -- output::output_get_last_error
test result: FAILED. 2 passed; 6 failed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After obs_output_valid()'s exact NULL diagnostic, the safe query returns the output's own last_error_message, else the first error of the video encoder slots in ascending order, else of the audio slots, else NULL. Each field is read lazily, so nothing below a hit is read. The pointer is borrowed unchanged, empty and non-UTF-8 strings included: no copy, cache, reference or lock. The shim reads through the existing production adapters of the output error slot, the video and audio slots and the encoder error field, so no new layout crosses the ABI. The output-encoder-getters and encoder-last-error adapters join the shared Rust-static support manifest (#5246) as lazy members, so a standalone Rust-static fixture that pulls this query links their real C. The original moves whole into libobs.ported-output-get-last-error, which only the C reference builds; the hybrid core-output group drops it and the Rust symbol is exported in its place. soldr cargo test -p obs-data --test obs-tests-core -- output::output_get_last_error test result: ok. 8 passed; 0 failed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795149547,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":93,"stamp":"cc0cd657d7bd1a832cfc96f2dc28d417","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149547,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":93,"stamp":"f6ef1480ab57055cf2eb5938dc182649","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149547,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":93,"stamp":"40b0d2ef6e67b6332883a22ad8c155ae","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149547,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":93,"stamp":"383b71a2930be42bfa75281b5a6156d1","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"general/all/client-lint","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"1e4ae35a2c5d8884e2ba11338b059ebe","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149547,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":93,"stamp":"2c756a19935b9720f35cc6a389059f03","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"638955ddd09abed3ebe2ffeb6494fe23","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"8db470d3a2ee442b21a5b018b1e39d11","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"dd2cc8b0c804e63b750e59a79b4f291d","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"2f33d6b2c2d916f6820bee9e6e31e187","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"3482edd14b020d82ce754814f83d174b","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"eda5d3a091a9bbe839be2b3f40bb1bc0","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"1252c0da17a78d0e1cfc2c1505d7d6c1","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"9dd71355a58432db86bef1f67493b585","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"fc366cfada738139ce20209a99ba0f4d","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"4d0bf2cbe88e7d37683d2c17ac0c3e5a","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"f6d107f0810c75e6470168f50046593c","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149454,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"22f3ed3edbceb7d08607215a5ec8c77f09ba0aaeab3ffa0b387d1c022d6fe2ff","lane":"client-lint","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":55,"stamp":"b9b38f958b396e356a67b9934d5c7736","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Ci-Attestation: {"at":1795149699,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"4439d6bfffcb54359f4819d9b4b3f50919a8bfaf34620c5dc8ae6ae704514203","lane":"client-test-x86_64-unknown-linux-gnu","parents":["0b1d7bc235da7d53ac0e185f89fe2dd0de41e3cd"],"secs":150,"stamp":"7f77e2922b55ebb951c101d3af11ff10","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d","v":1,"via":"run"} Client-Checks: {"checks":{"base":"5bc3cf493a27ddbc58ca0609a1e3eba587201586","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.core-output+.h.c","libobs/build/libobs.ported-hotkey-combination-background-id+.h.c","libobs/build/libobs.ported-output-get-last-error+.h.c","libobs/build/ported-source-sets/hotkey-combination-background-id.json","libobs/build/ported-source-sets/output-get-last-error.json","libobs/cmake/rust-exports.d/obs-hotkey-combination_background_id.txt","libobs/cmake/rust-exports.d/obs-output-output_get_last_error.txt","libobs/obs-hotkey-combination-background-id-fields.c.h","libobs/obs-hotkey-combination-background-id-lock.c.h","libobs/obs-hotkey-combination-background-id.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_hotkey_combination_background_id_swap_is_registered.rs","rust/obs-build/tests/native/registration/canonical_output_get_last_error_swap_is_registered.rs","rust/obs-c-oracle/oracle/hotkey_combination_background_id.c","rust/obs-c-oracle/oracle/output_get_last_error.c","rust/obs-hotkey/src/combination_background_id.rs","rust/obs-hotkey/src/ffi/combination_background_id.rs","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/tests/hotkey/background_query_parity.rs","rust/obs-hotkey/tests/hotkey/combination_background_id.rs","rust/obs-hotkey/tests/hotkey/combination_background_id_parity.rs","rust/obs-hotkey/tests/hotkey/main.rs","rust/obs-output/src/ffi/mod.rs","rust/obs-output/src/ffi/output_get_last_error.rs","rust/obs-output/src/lib.rs","rust/obs-output/src/output_get_last_error.rs","rust/obs-output/tests/output/main.rs","rust/obs-output/tests/output/output_get_last_error.rs","rust/obs-output/tests/output/output_get_last_error_parity.rs","test/cmocka/build/rust-static-support.json","test/cmocka/encoder-last-error-link-support.c","test/cmocka/output-encoder-getters-link-support.c"],"head":"7b338f3317cc2ef668b938b8306cd42595f75000","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":"e2c4b173bfe783cdb6381a80c8edc19b42f2bb916108a6c8f6744a1e42df042e","tree":"08e72356b48064abd5621b74739e9cf9dc45ec8d"}}
rdoupe
force-pushed
the
port/5308-output-get-last-error
branch
from
November 20, 2026 04:41
c51128b to
624e649
Compare
Collaborator
Author
|
Windows Rust Tests failed building the oracle: MSVC C4310 ("cast truncates constant value", warnings as errors) on |
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 #5308.
Swap only
obs_output_get_last_errorintoobs-output. Afterobs_output_valid()'s exact NULL diagnostic (LOG_DEBUG,obs_output_get_last_error: Null 'output' parameter), the safe query returns the output's ownlast_error_message, else the first non-NULL error of the video encoder slots in ascending order, else of the audio slots, else NULL. Each field is read lazily, so nothing below a hit is read. The pointer is borrowed unchanged; empty and non-UTF-8 strings are errors like any other. No copy, cache, reference change or lock (the encoder error mutex is never taken).The shim reads through production adapters that already exist:
obs_output_last_error_fields,obs_output_video_encoder_getter_at,obs_output_encoder_getters_audio_atandobs_encoder_last_error_fields. No new private layout crosses the ABI. The originallibobs/obs-output-get-last-error.c.hmoves whole intolibobs.ported-output-get-last-error, which only the C reference builds. The hybridcore-outputgroup drops it andrust-exports.dexports the Rust symbol, so the export set stays identical (1769 symbols).Shared Rust-static link support (#5246): two of those adapters had no support member, so
output-encoder-getters-link-support.candencoder-last-error-link-support.cjointest/cmocka/build/rust-static-support.jsonas lazy members. No per-consumer fragment, stub or fake global was added.Tests:
test_output_get_last_error.con a recording model: result identity across independent equal-byte allocations, empty and non-UTF-8 errors, every hole and fallback step, the NULL diagnostic, and a read trace checked for priority order with nothing read after a hit.obs_output/obs_encoderfixtures. It checks the returned pointer identity (never a copy), untouched output, encoder and message bytes, the exact NULL diagnostic on both sides, no allocation, slot counts against the C build, and that each adapter addresses exactly the field the original reads. Coverage includes characterized shapes and a proptest. Five query mutants are caught: skipped own error, audio before video, descending slots, empty treated as missing, and a copy. A core mutant (descending video slots) failed Tier 1 and Tier 3 locally.Test cost: new tests run in 0.02 s at most (
OBS_PARITY_CASES=reduced), peak RSS 11.7 MB over 25 runs, and they start no threads of their own. The isolated child test spawns one process.Evidence
RED (
dad8841c2, the safe query is a stub that returns None):GREEN (
789c03913, on5d0944dfd):./pushpassed the client lint and test lanes (9283 workspace tests). Its optional Swift lane exited 75 on this host, so nothing was attested and ordinary PR CI runs. This change has no user-visible effect, so it adds no line to the features ledger. Native Windows and macOS execution is not claimed.🤖 Generated with Claude Code