Skip to content

libobs: Add the module list seam - #4288

Merged
rdoupe merged 2 commits into
masterfrom
fix/rust-port-add-the-module-list-se-717
Nov 10, 2026
Merged

rdoupe merged 2 commits into
masterfrom
fix/rust-port-add-the-module-list-se-717

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #4219

What and why

The module-list seam that the port of the module list calls (libobs/obs-module-lists.c.h, extracted from obs-module.c.h in #4139) needs, before that port. There is no Rust and no change in behaviour: it is new C in a new file, and nothing calls it yet.

The list calls (obs_log_loaded_modules, obs_module_add_source / _output / _encoder / _service, obs_find_module_file, obs_module_get_config_path, obs_add_module_path, obs_add_safe_module, obs_add_disabled_module) read struct obs_core and struct obs_module directly and push onto their lists with da_push_back(). The port into obs-core, beside the module rules that are already Rust (module_paths, module_names, module_load_rules), reaches the same fields through this seam, without the layouts of obs-internal.h ("Public and internal boundaries", testing-policy.md), as the audio tick's port reaches its fields through obs-audio-seam.h.

libobs/obs-module-lists-seam.h declares the accessors, hidden in libobs (not EXPORT) like the core-audio seam's. Each is a single read or field address, copied from the line of obs-module-lists.c.h it wraps:

  • the core: whether obs is set (the !obs checks of obs_add_module_path, obs_add_safe_module and obs_add_disabled_module); first_module; module_config_path; and the struct darray inside module_paths (of struct obs_module_path), safe_modules and disabled_modules (of char *), the lists those three calls push onto;
  • a module: next and file; data_path; mod_name; and the struct darray inside sources, outputs, encoders and services (of char *), the lists the four obs_module_add_* calls push onto.

A darray address is the one da_push_back() takes, so the port pushes onto it with obs-util's darray port and the typed list's element size. None checks its arguments or takes a lock: the list calls take none today, and the header says a caller keeps it that way. libobs/obs-module-lists-seam.c.h is live C in libobs.core, ahead of obs-module-lists.c.h in the group's sorted order. It stays live C, like the other seams, and never moves into a ported group. libobs.pch.h includes the header with the other obs-module.c headers, and source-sets.d/LIBOBS_SOURCES.json lists it. No C caller changes: obs-module-lists.c.h keeps its direct reads until the port replaces them.

test_module_lists_seam pins the seam. The accessors are hidden, so it builds the seam into itself, as test_audio_seam does, and runs it on a stand-in core (obs, with only the fields the seam reads) and stand-in modules. It has 14 cases: each read against the field it wraps (the field itself, not a copy), each darray address against the typed list behind it (an element pushed through the address with darray_push_back() shows in the typed list, and one pushed with da_push_back() on the typed list shows through the address), the lists distinct from each other, and a module's four lists against libobs's own obs_module_add_*() calls, which take the module they push onto (a NULL id included: it pushes a NULL).

RED → GREEN

  • RED commit: e093438 (libobs: Stub the module list seam): the accessors are declared, and their bodies read nothing (NULL, false). test_module_lists_seam fails 14/14 on the C, hybrid and C reference builds (test_has_core: the core is set and the stub says no; test_first_module, test_module_paths and the others: (nil) != 0x…; the _distinct cases: the stubs' NULLs are equal). Every case fails at an assertion before it touches an address, so none crashes. On the RED commit --lane lint and --test-diff (7547 tests passed, 6 skipped) pass.
  • GREEN: 090fb34 (libobs: Add the module list seam): each body copied from the line it wraps. The first runs were on 707c9ac (on master 643866b); the runs after the rebase onto master f6b01bd are in the last bullet.
    • test_module_lists_seam passes 14/14 on the C, hybrid and C reference builds, under ASan and UBSan, with no leaks (0/14 on the RED commit).
    • The module and seam C tests (ctest -R 'module|seam', under Xvfb, TMPDIR unset) pass on all three builds, none skipped: C 16/16, hybrid 16/16, libobs-c-reference 16/16 (rebuilt after the change, its mtime checked). test_source_monitor_only_load was left out: it hangs without a sound server, on the C build too.
    • The export sets of the C, hybrid and C reference builds are identical and unchanged from master (1767). All 14 accessors are local (t) in each.
    • Local gate lanes: --test-diff against the base (7547 tests passed, 6 skipped, the same on the RED commit), --lane lint, --lane dylint, --lane cross and the Windows --all-targets clippy (x86_64-pc-windows-msvc, -D warnings) pass. This PR touches no Rust.
    • Before posting, on 090fb34 (master 643866b, unchanged since): the ci/ checks (test_build_groups, test_ported_sources, test_oracle_standins, test_oracle_msvc, test_sorted_shared_lists, test_test_graph_sorted, test_cmocka_rust_static_guard, test_cmocka_windows_diagnostics, test_cmocka_includes, test_naming), ./lint, --lane lint, --lane dylint, --lane cross and the Windows --all-targets clippy pass again. ci-lint local-gate run: lint, dylint and Tier 2 on Linux (tier2-linux, 822/822 on hybrid libobs and on libobs-c-reference, 2 skipped on each: the two vivid V4L2 tests that need the vivid driver) pass. Its rust-test lane, and ./unittest's, fail only where master does, building the obs-c-oracle output pause probe for x86_64-pc-windows-gnu ('pthread_mutex_lock' redefined, bug: obs-c-oracle: pthread probe macro redefinition blocks Fast Gate #4069, fixed by the open fix(obs-c-oracle): keep the mingw pthread names around the pause lock probes #4191), after the workspace tests passed (7547 passed, 6 skipped; obs-util 914 passed). So HEAD is not stamped, and PR CI runs the full suite.
    • Full builds (BUILD.md: this changes the precompiled header libobs/build/libobs.pch.h, one #include of the new seam header): gh workflow run ci.yml on 090fb34, which runs the Windows, macOS, Ubuntu and Flatpak app builds that PR CI never runs: https://github.com/obs-rust/obs-studio/actions/runs/42612642782. Every app build passed: Windows x64 and arm64, macOS x86_64 and arm64, Ubuntu, Flatpak and the mac-arm64/win-x64 cross compile. The run shows failure only from its Fast Gate rust-test lane, the same x86_64-pc-windows-gnu output pause probe build master had then (bug: obs-c-oracle: pthread probe macro redefinition blocks Fast Gate #4069, fixed since by fix(obs-c-oracle): keep the mingw pthread names around the pause lock probes #4191).
    • After the rebase onto f6b01bd: the only conflict was the sorted libobs.core+ unity list, where master added obs-module-init.c.h and obs-module-load-locale.c.h beside this PR's line, and all three lines are kept. The diff against master is still 8 files, 517 lines added and none removed. Runs were on 090fb34: test_module_lists_seam 14/14 and ctest -R 'module|seam' 17/17 (none skipped) on the C, hybrid and C reference builds (all three rebuilt); the export sets identical (1767), with the 14 accessors local; the ci/ checks, ./lint and the port_comparison bench test pass. ci-lint local-gate run passes every lane and stamps HEAD: lint, dylint, rust-test (7601 passed, 6 skipped; obs-util 914 passed), cross, and Tier 2 on Linux (829/829 on hybrid libobs and on libobs-c-reference, 2 skipped on each: the two vivid V4L2 tests).
  • Real app (UI, protocol output or logging changes): N/A, no behaviour change.

Checklist

  • Base is master (or the description starts with a Stacked: note)
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (N/A for docs-only; a focused CI fix may push RED and GREEN together). There is no characterization commit, because there is nothing to characterize: the seam is new code with no C original, so before the RED commit its functions don't exist and no test of them could build. New code starts RED against stubs (obs-worker §3), so test_module_lists_seam lands with the stubs in e093438 and passes with the bodies in 090fb34, as the core-audio seam did (libobs: Add the core-audio seam #4048). The list calls it wraps keep their existing coverage: test_module_lists passes unchanged on all three builds.
  • User-visible change: its line in docs/features.md is added or updated (not applicable: no user-visible change)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): built with scripting ON (PR CI builds no OBS app: run gh workflow run ci.yml --ref <branch> for the full builds) and cross-checked with clang and MSVC (not applicable)
  • Intentional differences from C listed in the parity test header and rust/README.md (ports) (not applicable: no port)

@obs-rust-project-manager obs-rust-project-manager Bot moved this to In progress in obs-rust Multiview Nov 9, 2026
@rdoupe
rdoupe marked this pull request as ready for review November 9, 2026 13:57
@rdoupe
rdoupe requested a review from zackees as a code owner November 9, 2026 13:57
@rdoupe
rdoupe added this pull request to the merge queue Nov 9, 2026
@zackees
zackees removed this pull request from the merge queue due to a manual request Nov 9, 2026
The module list calls (obs-module-lists.c) read struct obs_core and
struct obs_module directly and push onto their lists with
da_push_back(). Their port needs a seam that reaches the same fields
without the layouts of obs-internal.h, as the audio tick's port reaches
its fields through obs-audio-seam.h.

obs-module-lists-seam.h declares it, hidden in libobs like the
core-audio seam: the core (whether obs is set, first_module,
module_config_path, and the struct darray inside module_paths,
safe_modules and disabled_modules) and a module (next, file, data_path,
mod_name, and the struct darray inside sources, outputs, encoders and
services). obs-module-lists-seam.c is in libobs.core, ahead of
obs-module-lists.c, with stub bodies that read nothing.

test_module_lists_seam pins the seam. The accessors are hidden, so it
builds the seam into itself and runs it on a stand-in core and stand-in
modules. 14 cases: each read against the field it wraps, each darray
address against the typed list behind it (a push through either shows
in the other), and a module's four lists against libobs's own
obs_module_add_*() calls. All 14 fail on the stubs.

Refs #4219.
The module-list seam's accessors get their bodies, each a single read
or field address copied from the line of obs-module-lists.c it wraps,
and named beside it:
- the core: !obs (obs_add_module_path(), obs_add_safe_module(),
  obs_add_disabled_module()), obs->first_module
  (obs_log_loaded_modules()), obs->module_config_path
  (obs_module_get_config_path()), and the darrays that da_push_back()
  pushes onto in module_paths, safe_modules and disabled_modules;
- a module: next and file (obs_log_loaded_modules()), data_path
  (obs_find_module_file()), mod_name (obs_module_get_config_path()),
  and the darrays of sources, outputs, encoders and services
  (obs_module_add_*()).

No C caller changes: obs-module-lists.c keeps its direct reads until
its port replaces them. test_module_lists_seam passes 14/14 on the C,
hybrid and C reference builds, and their export sets are identical and
unchanged, with the accessors local.

Fixes #4219.

Local-Gate: v1 tree=cc727d26e0b4766521fc31800c23d9848fdec011 secs=2615 lanes=lint:run,dylint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1794253799,"gate":"rust/all/fmt","host":"linux-x86_64","key":"4fbe32c46adc8131bd81a7e65601373c6154c1d1bfa30def12dbd029d90cb9d7","lane":"lint","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":46,"stamp":"ab75929fc5197471c3fa97af6475ac7f","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"4fbe32c46adc8131bd81a7e65601373c6154c1d1bfa30def12dbd029d90cb9d7","lane":"lint","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":46,"stamp":"6a3f350351d58858669a2cfd49c1beba","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"ec5768e784bef6807b3813872e8db2ce353590b2711c959186a37e5c866219c2","lane":"rust-test","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":289,"stamp":"000ac99ae0ed3369a24d707b4771fe62","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"6e0245860747da053d1f96068a8937cc","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"24d01230b6bddf0cc00270135d9eedd5","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
Ci-Attestation: {"at":1794253799,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"bfc3f67f958fc329e5e4a52fa72af9b8","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
Ci-Attestation: {"at":1794253799,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"4b803f149be8b002a0e9098a03888273","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
Ci-Attestation: {"at":1794253799,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"0ed4f7626b725b24dea1fd494be3276a4ae777c571520127239cc4d80c3a9eeb","lane":"tier2-linux","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":2615,"stamp":"5c008a2839cb6c94d43218e311597b7a","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
@rdoupe
rdoupe force-pushed the fix/rust-port-add-the-module-list-se-717 branch from 707c9ac to 090fb34 Compare November 9, 2026 19:50
@rdoupe
rdoupe added this pull request to the merge queue Nov 9, 2026
@rdoupe

rdoupe commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

Handed off to the coordinator

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to In merge queue in obs-rust Multiview Nov 9, 2026
@rdoupe
rdoupe added this pull request to the merge queue Nov 10, 2026
Merged via the queue into master with commit b38fc50 Nov 10, 2026
86 checks passed
@rdoupe
rdoupe deleted the fix/rust-port-add-the-module-list-se-717 branch November 10, 2026 02:01
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In merge queue to Done in obs-rust Multiview Nov 10, 2026
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.

rust: Port the module list seam (obs-module-lists-seam.c)

1 participant