Repository navigation
obs-source: port obs_source_filter_set_order to Rust (Fixes #5775) - #5776
Merged
Merged
Conversation
Move obs_source_filter_set_order() with move_filter_dir(), find_next_filter() and find_prev_filter() unchanged out of obs-source.c.h into obs-source-filter-set-order.c.h, still compiled in the live core-source group. reorder_filter_targets() stays in obs-source.c.h; it loses its `static` and obs-internal.h declares it, because the new file comes before obs-source.c.h in the unity group. Hidden visibility keeps it out of the exported symbols. No Rust, no behavior change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New cmocka test on test-owned, noise-filled struct obs_source values (no core): a NULL source or filter logs the validity check's line once (source first) and reads, writes and signals nothing; a filter not in the list moves nothing whatever the movement; up and down move to the nearest filter of the same async kind, top and bottom to the ends, checked on every chain of up to 6 filters with every async pattern; after a move every filter is retargeted (the next one, the last the source) and "reorder_filters" is signalled once on the source's own handler, after filter_mutex is released, with the source as calldata. For a movement outside the enum only what the C reference and the port share is pinned (#2981): no filter moves. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New obs-source module filter_set_order with a todo!() core over a
FilterChain trait, and Tier 1 mirrors of test_source_filter_set_order.c on
a model source that records every call: the NULL lines, an unlisted
filter, the walks to the same kind and the ends on every chain of up to 7
filters, an out-of-enum movement doing nothing, and the C's order of reads
and writes (the moved filter's flags read again at each walk step, every
filter retargeted from the first, the signal after the unlock).
soldr cargo test -p obs-data --test obs-tests-core -- source::filter_set_order::
test result: FAILED. 0 passed; 6 failed
panicked at rust/obs-source/src/filter_set_order.rs:66:5: not yet implemented: #5775
Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_source_filter_set_order() moves to obs-source's filter_set_order
module with move_filter_dir(), find_next_filter() and find_prev_filter().
A NULL source or filter logs one LOG_DEBUG line (source first) and touches
nothing. Under filter_mutex the filter is looked up in the list (an
unlisted one moves nothing); up and down move it to the nearest filter of
the same async kind, its own flags read again at each step as the C's
recursion did; top and bottom to the ends, through the source_filter_chain
rules. After a move every filter is retargeted from the first (the next
filter, the last one the source), and reorder_filters is signalled on the
source's own handler after the unlock, only on a move.
The shim rejects NULL before calling the adapters of
obs-source-filter-set-order-fields.c.h (live core-source group, no
EXPORT): lock, count, entry, flags, da_move_item(), target write, unlock
and obs_source_dosignal(). The Rust core does its own retarget;
reorder_filter_targets() stays in obs-source.c.h. The extracted C builds
in the reference group libobs.ported-source-filter-set-order.
Tier 3 (filter_set_order_parity, oracle/source_filter_set_order.c) runs
the original C and the Rust export on noise-filled real-header sources
with a real signal handler over every chain of up to 7 filters with every
async pattern, every listed filter plus an unlisted and a NULL one,
movements -1 to 5 and the ends of int, and a proptest, comparing the list,
every target, the signal (count, calldata, lock state, the list it saw),
every other byte, the lock and the log line; it rejects four mutants (no
retarget, no move, signal under the lock, kind ignored). Mutation check:
swapping top and bottom in the core fails set_order_matches_c (reverted).
soldr cargo test -p obs-data --test obs-tests-core -- source::filter_set_order
test result: ok. 7 passed; 0 failed
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ci-Attestation: {"at":1795692160,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":93,"stamp":"e9004df02097080440aab74f605e0cdc","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692160,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":93,"stamp":"cd13c149f395b7c25430779a0f6a9bb7","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692160,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":93,"stamp":"023606b1654d7b8b60e88a6849a7e77e","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692160,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":93,"stamp":"b509983ade39dd0c84d080bfdc766105","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"general/all/client-lint","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"8173e0e815a61bee8277797d386af425","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692160,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":93,"stamp":"d2057791734c5ff25de704ebe57c081e","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"ac0cc1259cef7ba59e10e8823edcc4f0","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"12dd3b06873c6d92d1115e7722760014","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"6dd754d8326e94a27cbf72603cd0f844","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"b68fd70e3f76b6f8e55a2cf3ddc49f7f","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"78de4a1733d9f75bf43b54903d0119ea","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"a9616b557093181b67df1b92d4ac0946","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"f3a9c125b2abe7c0a63f7c23c3e123f8","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"a2059b688fef4eb4e0186275f8ce7f06","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"a34ae322d4a45c3eecc338d57f72ffb7","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"30d95ec17715c6bb709cb09a69d08d9b","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"6ef4e3b17563c12cf57a92647d7ebbf8","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692066,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"43aaae08e4bad9af790b6f069a3b864cfbe5358b46564f49f7c019130b97ec08","lane":"client-lint","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":66,"stamp":"954424ad58dfde2c15ef5419136dcdc5","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Ci-Attestation: {"at":1795692394,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"8f13a136575ac1fac90bce4348aac9a787d408a01e3a7c5b16a332970c5b737f","lane":"client-test-x86_64-unknown-linux-gnu","parents":["31d947e6334a4732dc6617eed10bc5a6920f8505"],"secs":233,"stamp":"efc008b95951fe96c3567b3c3657bb2b","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d","v":1,"via":"run"}
Client-Checks: {"checks":{"base":"e8cbea4dd0142b45229389ff871e402fda40050a","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-source-async-flag-getters+.h.c","libobs/build/libobs.ported-source-filter-set-order+.h.c","libobs/build/ported-source-sets/source-filter-set-order.json","libobs/cmake/rust-exports.d/obs-source-source_filter_set_order.txt","libobs/cmake/rust-hidden.d/obs-source-source_async_flag_getters.txt","libobs/obs-internal.h","libobs/obs-source-async-flag-fields.c.h","libobs/obs-source-async-last-ts-getter.c.h","libobs/obs-source-filter-set-order-fields.c.h","libobs/obs-source-filter-set-order.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_source_filter_set_order_swap_is_registered.rs","rust/obs-build/tests/native/registration/canonical_source_last_async_ts_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/source-filter-set-order.list","rust/obs-c-oracle/oracle/source_async_flag_getters.c","rust/obs-c-oracle/oracle/source_filter_set_order.c","rust/obs-c-oracle/oracle/source_profiler_host.c","rust/obs-source/src/async_flag_getters.rs","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_async_flag_getters.rs","rust/obs-source/src/ffi/source_filter_set_order.rs","rust/obs-source/src/filter_set_order.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/async_flag_getters.rs","rust/obs-source/tests/source/async_flag_getters_parity.rs","rust/obs-source/tests/source/filter_set_order.rs","rust/obs-source/tests/source/filter_set_order_parity.rs","rust/obs-source/tests/source/main.rs","test/cmocka/build/test-graph.json","test/cmocka/source-async-flag-getter-link-stubs.c","test/cmocka/test_source_filter_set_order.c","test/cmocka/test_source_last_async_ts.c","test/cmocka/tests.d/test_source_filter_set_order.cmake","test/cmocka/tests.d/test_source_last_async_ts.cmake"],"head":"9e2e6a38e91e9e016c20d85701d8ab2c455870db","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":"2cbf07b0eaf85291be938581550537f2e6484bf9830691da0486923b728789b0","tree":"926b9e02e17aca1b4e7c9cb309a4fad7c783e16d"}}
This was referenced 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.
Fixes #5775
What changes
obs_source_filter_set_order(), the filter move behind the filters dialog's up and down buttons and obs-websocket's filter index helper, moves fromlibobs/obs-source.c.htoobs-source::filter_set_order, with its static helpersmove_filter_dir(),find_next_filter()andfind_prev_filter()and the retarget walk after a move. The movement, walk and target rules were already Rust (obs-source::source_filter_chain); this is the C that was left around them.Commits, in order:
libobs: the entry and its three helpers move verbatim into
libobs/obs-source-filter-set-order.c.h, still in the livelibobs.core-sourcegroup.reorder_filter_targets()stays inobs-source.c.h; it loses itsstaticandobs-internal.hdeclares it (hidden), because the new file comes beforeobs-source.c.hin the unity group. No behavior change.test: new cmocka characterization
test/cmocka/test_source_filter_set_order.con test-owned, noise-filledstruct obs_sourcevalues with a real signal handler (no core):obs_source_filter_set_order: Null 'source'|'filter' parameteronce atLOG_DEBUG(source first), and reads (the list is NULL there), writes and signals nothing;filter_mutexis free afterwards;filter_targetis rewritten (the next filter, the last one the source), andreorder_filtersis signalled once on the source's own handler (no global signal:obs_source_dosignal(source, NULL, ...)), afterfilter_mutexis released, with the source as calldatasourceand the list already moved;For a movement outside the enum only what the C reference and the port share is asserted: no filter moves (the reference still retargets and signals there, the existing rust: Port the source filter chain rules to obs-source #2981 fix in the rules).
test: RED. Tier 1 mirrors against a
todo!()core over aFilterChaintrait.obs-source: GREEN.
filter_set_order::set_orderoverFilterChain, using thesource_filter_chainrules, and the exported shimffi::source_filter_set_order(rust-exports.d/obs-source-source_filter_set_order.txt). The shim rejects NULL before calling the adapters of the newobs-source-filter-set-order-fields.c.h(livelibobs.core-sourcegroup, noEXPORT): lock, count, entry, flags,da_move_item(), target write, unlock,obs_source_dosignal(). The Rust core does its own retarget.libobs.ported-source-filter-set-order(ported-source-sets/source-filter-set-order.json).rust/obs-c-oracle/oracle/source_filter_set_order.c(+oracle.dfragment); registration test inobs-build; rust/README row.No public header, existing C test, WebSocket or workflow change. No intentional differences. Tier 4 does not apply. No features ledger line (no user-visible change).
Tests
rust/obs-source/tests/source/filter_set_order.rs): the five cmocka cases on a model source that records every call, on chains of up to 7, plus the C's exact order of reads and writes (lookup, the moved filter's flags read again at each walk step, the move, each filter retargeted from the first, unlock, then the signal).test_source_filter_set_order, the filter chain step tests (C and Rust-static), thetest_filter_*callers,test_source_enum_filters,test_source_filter_index,test_ws_filter_settings_event,test_scroll_filter_wide_sourceand every_steps_rusttest, on hybrid libobs and the C reference.filter_set_order_parity.rs): the original C and the Rust export on noise-filled real-header sources with a real signal handler, over every chain of up to 7 filters with every async pattern, every listed filter plus an unlisted and a NULL one, movements -1 to 5 and the ends ofint, the NULL-source cases and a proptest; it compares the list, every filter's target, the signal (count, calldata, lock free during it, the list it saw), the global signal count, every other byte, the lock after the call and the exact log line. The original calls the filter chain rules by their libobs names, the rules hybrid libobs ships, so out-of-enum movements compare exactly too. It rejects four mutants (no retarget, no move, signal under the lock, kind ignored). Mutation check: swapping top and bottom in the core failsset_order_matches_c(reverted).full, 0.06 s atreduced(debug); peak RSS 14.6 MB over the module's runs; no own threads (the parity test reruns itself in one child process for the log handler).Evidence
RED (
test: RED ...):GREEN:
Tier 2 on the characterization commit (extraction + new test, nothing swapped):
🤖 Generated with Claude Code