Skip to content

libobs: Extract the module list calls - #4139

Merged
rdoupe merged 2 commits into
masterfrom
fix/rust-port-extract-the-module-lis-706
Nov 9, 2026
Merged

rdoupe merged 2 commits into
masterfrom
fix/rust-port-extract-the-module-lis-706

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Refs #4133

What and why

The first step of porting the module list calls to rust/obs-core: the public calls that fill the module lists move out of libobs/obs-module.c.h into their own live file, so a later PR can port that file whole, beside the module path, name and load rules that are already Rust (module_paths, module_names, module_load_rules). This is the extraction step of testing-policy.md ("Extracting a function before porting it"), behaviour-neutral, with no Rust.

  • Characterization: test/cmocka/test_module_lists.c (in the test graph, all hosts) pins what nothing pinned yet: the lines obs_log_loaded_modules() logs (only its heading at LOG_INFO with no module loaded; a disabled module adds no line), the list calls with no core and with NULL arguments (nothing allocated), and obs_module_add_*(), obs_find_module_file() and obs_module_get_config_path() on a module made with obs_create_disabled_module(): each id copied into its own kind's list only, the data-path and config-path answers, and the allocations each call makes. The Linux-only test_core_module_load already pins the search paths and how the safe and disabled lists match names during a load. Characterized, not endorsed: a NULL id is pushed as a NULL entry, and obs_module_get_config_path(mod, NULL) gives the config directory with a trailing /. obs_log_loaded_modules() is not called with no core: it reads the core without checking it. The port fixes that as an intentional difference.
  • Move: obs_log_loaded_modules, obs_module_add_source, _add_output, _add_encoder, _add_service, obs_find_module_file, obs_module_get_config_path, obs_add_module_path, obs_add_safe_module and obs_add_disabled_module (master's obs-module.c.h 224-310) move byte for byte into libobs/obs-module-lists.c.h, included in the core+ unity group ahead of obs-module.c.h (whose locale loader calls obs_find_module_file; the obs.h declarations make either order safe). All ten are EXPORT and declared in obs.h, so nothing is renamed and no header is added. struct fail_info and get_plugin_info stay with the load loop. naming.md's obs-core row names the new file.

No change in behaviour, so no features-ledger line. No upstream issue.

RED → GREEN

  • RED commit: N/A. Behaviour-neutral extraction: the characterization test passes on master's C before the move and on the moved file after it.
  • GREEN (runs were on 4c7637c):
    • test_module_lists: 8/8 on the C build, hybrid libobs and libobs-c-reference, before and after the move. A planted mutant in the real file (obs_add_module_path without its !data check) fails it at add_list_entries.
    • Tier 2, the module area (test_module_lists, test_core_module_load, test_obs_core_info_characterization, test_module_failure_info, test_module_load_rules_skip_steps, test_module_load_steps, test_module_locale_getters, test_module_metadata, test_module_name_lookups, test_module_register_copy_steps, test_module_type_rules_steps, test_text_aa_file): 12/12 on each of the three builds, 0 skipped.
    • Move check: master's lines 224-310 and the new file, each compiled over a logging stand-in (core, modules, darray push, bstrdup, blog, the two path rules), with gcc and clang at -O0, -O2 and -O1 under ASan/UBSan, over 20,000 random call sequences (502,081 logged events): identical logs on all six builds. Eight planted mutants (log format, wrong list, wrong path argument, dropped NULL check, path type, disabled-to-safe list, swapped config arguments, a NULL id skipped) are each caught on every build.
    • Exported symbols: 1767 on the C, hybrid and C-reference builds, identical to master's and to each other; the ten calls stay T.
    • Local gate: --lane lint ok, --test-diff ok (7490 passed, 6 skipped), --lane dylint ok, --lane cross ok; Windows MSVC clippy --all-targets clean.
    • ./lint ok. ./unittest: the workspace tests pass (7490 passed, 6 skipped; obs-util 914 passed), then its x86_64-pc-windows-gnu build of obs-c-oracle stops on master's own output_pause_queries.c macro clash (bug: obs-c-oracle: pthread probe macro redefinition blocks Fast Gate #4069), so its Tier 2 lane did not run here and the head is pushed unstamped; PR CI runs the full suite. This PR changes no Rust or oracle file.
  • 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)
  • 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: no warning or flag change)
  • Intentional differences from C listed in the parity test header and rust/README.md (ports) (not applicable: no port yet)

Pin what obs_log_loaded_modules() logs, the list calls with no core
and with NULL arguments, and obs_module_add_*(),
obs_find_module_file() and obs_module_get_config_path() on a module
made with obs_create_disabled_module(), on every host. The Linux-only
test_core_module_load already pins the search paths and how the safe
and disabled lists match names during a load.

It runs through the public API only, so the same test covers the
hybrid libobs and libobs-c-reference once these calls are ported.

Refs #4133.
Move obs_log_loaded_modules(), obs_module_add_source(), _add_output(),
_add_encoder(), _add_service(), obs_find_module_file(),
obs_module_get_config_path(), obs_add_module_path(),
obs_add_safe_module() and obs_add_disabled_module() verbatim from
obs-module.c.h into obs-module-lists.c.h, in the same core unity
group ahead of obs-module.c.h, so they can be ported on their own.

No change in behaviour: all ten are EXPORT and declared in obs.h, the
text is byte for byte master's, and the exported symbol sets are the
same on the C, hybrid and C reference builds.

Refs #4133.
@rdoupe
rdoupe requested a review from zackees as a code owner November 9, 2026 06:06
@rdoupe
rdoupe added this pull request to the merge queue Nov 9, 2026
Merged via the queue into master with commit 643866b Nov 9, 2026
116 of 121 checks passed
@rdoupe
rdoupe deleted the fix/rust-port-extract-the-module-lis-706 branch November 9, 2026 07:33
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