Skip to content

obs-util: port cf-parser (#1466) - #1467

Merged
zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:port/cf-parser
Oct 20, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:port/cf-parser

Conversation

@nathan-v

@nathan-v nathan-v commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1466.

Ports cf_pass_pair and cf_adderror from libobs/util/cf-parser.c.h to obs-util. The safe core preserves delimiter traversal and the post-call token position, diagnostic source locations, sequential substitutions, and null-versus-empty diagnostic storage. The C adapter preserves the public layouts, filename pointers and bmalloc-owned error messages. The preprocessor, public headers, and existing C tests stay unchanged. No intentional behavior differences.

Existing characterization is test_cf_lexer; no separate characterization commit was necessary. Added Rust tests mirror its exported-function behavior, compare every field offset of the parser/preprocessor layouts, check allocation balance in an isolated child, and compare randomized calls to a separately named original-C oracle. Temporarily omitting advancement past a closing delimiter makes the differential test fail; the mutation was restored.

RED → GREEN

  • RED dba6269e0: the three new core tests fail at todo!() (0 passed, 3 failed); pushed as an early draft.
  • GREEN d8a2b274c8809269d2b2fa932bc29c944b4bb038: eight focused tests pass; full native workspace has 1,432 passing tests, one pre-existing ignored test, and four passing doctests.

Validation

  • Hosted PR CI 39348452529 passes on GREEN, including CI Gate, Fast Gate, Windows/macOS Rust tests, Windows/macOS C Tier 2, Linux C OFF/ON, formatting, and Windows/macOS cross lint. The full application builds were skipped by PR scope.
  • macOS: both libobs variants build, exports match (1,877 symbols), and each CTest run passes 175 tests with one optional SVT-AV1 skip. Loader output verifies each variant. Generated test executables required local ad-hoc signing without hardened runtime to load Homebrew cmocka; no signing policy/source changes.
  • Native workspace Clippy -D warnings, rustfmt, Dylint, test-binary inventory, platform ratchet and performance guards pass. macOS CI-tooling self-tests have host-dependent failures; all 127 test files pass in Linux across the full run and a writable-temp-copy rerun of two scratch-writing tests.
  • Local Windows SDK setup is now resolved through Docker: repository-pinned soldr 0.9.35, LLVM 21.1.5 and the managed MSVC SDK. cmake/cross/docker.sh win-x64 passes after initializing the pinned libdshowcapture submodule. Workspace Windows MSVC Clippy, Dylint, and compilation/linking of all Windows test binaries also pass. LLVM's llvm-lib entry point was exposed locally via a symlink to llvm-ar; CARGO_TARGET_DIR was placed on the writable build volume. These are cross-build checks; Windows runtime tests passed in hosted CI.
  • Linux Docker: both libraries build and export the same 1,766 symbols; loader checks confirm OFF/ON. All 312 CTest entries were exercised in each mode. Initial OFF: 306 passed, 3 failed, 3 skipped. Initial ON: 307 passed, 2 failed, 3 skipped. test_cf_lexer passes in both. Debug configuration selects the release-profile Rust static library. The required-no-skip policy checks pass.
  • Linux setup used a local frontend include-path option for the existing screenshot test, disabled a failing compiler-cache daemon, and limited compile/link concurrency to one. No C tests or production sources were changed for these workarounds.
  • Installed WirePlumber, pipewire-pulse and pulseaudio-utils in a separate local validation image and reran the three skipped audio tests. All three pass against both C and Rust. Across the full suites and follow-up runs, 310 distinct tests pass in each mode, with the two shared failures below; no Linux test remains unexercised.

Readiness blockers

This PR remains draft. Local Linux test_group_empty_bounds (drag_into_filled_group) and test_scene_dup_group_children (private_copy_keeps_group_state) fail against both original C and Rust-backed libraries, including serial reruns. The initial C-only test_group_hide_transition_audio failure passed on its serial rerun and on both Rust-backed runs.

Full Windows and macOS application builds are also required by BUILD.md for unity-group changes. Upstream workflow dispatch returned HTTP 403, "Must have admin rights to Repository"; a maintainer must arrange that run on this exact head. Skipped full-build jobs are not treated as passes. No local-gate stamp is claimed.

Tier 4 is not applicable to these utility exports; no user-visible behavior change or feature-ledger entry.

AI assistance: Codex implemented and tested this port.

Preserve pair cursor movement and diagnostic source positions, sequential substitutions, null/empty storage, and bmalloc ownership. Keep the preprocessor, C tests and public headers unchanged.

Local: 1432 native Rust tests and 4 doctests pass; 175 C tests pass in each macOS mode, with one optional SVT-AV1 skip per mode. Export sets match (1877 symbols). Workspace Clippy, rustfmt and Dylint pass. Cursor mutation is detected by differential parity. Linux Docker validation is still in progress; no full local-gate attestation.
@nathan-v

Copy link
Copy Markdown
Contributor Author

Full CI remains a readiness prerequisite. This PR changes unity-group membership; BUILD.md requires full Windows and macOS builds for such changes, in addition to scoped PR checks. The user also requested all possible CI, including local Linux Docker, before marking ready.

The GREEN head is d8a2b274c. Normal PR CI is running. I attempted the upstream ci.yml workflow dispatch, but GitHub returned HTTP 403: "Must have admin rights to Repository." A maintainer needs to arrange the full workflow on this exact head (on an upstream branch if needed). I am leaving the PR in draft and am not treating skipped platform jobs as passes.

Local Linux Docker Tier 2 is still running. Native macOS Rust and C OFF/ON results are recorded in the PR description. Local Windows cross-checks are blocked by this host/toolchain's missing SDK support.

@nathan-v

Copy link
Copy Markdown
Contributor Author

Validation update for GREEN d8a2b274c8809269d2b2fa932bc29c944b4bb038:

  • The earlier local Windows SDK blocker is resolved. Installed the pinned toolchain/SDK in Docker; Windows C/C++ cross-build, Rust workspace Clippy, Dylint and compilation/linking of all Windows test binaries pass. Hosted Windows runtime checks also pass.
  • Hosted PR CI is entirely green for scheduled checks: https://github.com/obs-rust/obs-studio/actions/runs/39348452529 . Full application jobs remain skipped.
  • Full local Linux OFF and ON suites ran. Installed missing audio dependencies and ran all three initially skipped tests successfully in both modes. Across full runs and follow-ups, 310 distinct tests pass per mode, while test_group_empty_bounds and test_scene_dup_group_children fail in both C and Rust, including serial reruns. The initial C-only transition-audio failure passed when rerun serially. Parser characterization passes in both modes; exports are identical (1,766 symbols), and the Debug Rust profile check passes.

The PR remains draft per the requested readiness gate. Remaining blockers are the two shared local Linux failures and the full Windows/macOS application workflow, which needs a maintainer dispatch because this account receives HTTP 403. The PR description has the complete validation details.

@nathan-v
nathan-v marked this pull request as ready for review October 20, 2026 01:12
@nathan-v
nathan-v requested a review from zackees as a code owner October 20, 2026 01:12
@zackees
zackees added this pull request to the merge queue Oct 20, 2026
Merged via the queue into obs-rust:master with commit 797f5b1 Oct 20, 2026
25 checks passed
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 20, 2026
)

The release gate's cross lint runs clippy -D warnings on
aarch64-unknown-linux-gnu, where wchar_t is u32 and c_char is u8, so
`as u32` / `as u8` on them are no-ops there and clippy's unnecessary_cast
fails the release. They are needed on x86-64 Linux and macOS (i32 / i8),
which is why the PR gate passes.

Keep the casts and allow the lint with a comment where the type depends on
the target, as ffi/dstr.rs and platform/unix/nix.rs already do:
File::open_wide and mbs_to_utf8 in platform/unix/file.rs, and
ffi/cf_parser.rs (from obs-rust#1467).

Fixes obs-rust#1484
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.

2 participants