Skip to content

rust: port effect parser lifecycle to obs-graphics - #1650

Merged
zackees merged 3 commits into
obs-rust:masterfrom
nathan-v:port/effect-parser-lifecycle
Oct 21, 2026
Merged

zackees merged 3 commits into
obs-rust:masterfrom
nathan-v:port/effect-parser-lifecycle

Conversation

@nathan-v

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

Copy link
Copy Markdown
Contributor

Fixes #1644. Characterization prerequisite: #1646 (merged).

What and why

Move ep_free cleanup traversal and destruction order into the safe Rust obs-graphics core, preserving its hidden C ABI. A thin layout adapter delegates the existing header-inline element destructors, parser-state cleanup, and array release to private C helpers. Borrowed pointers and the existing retained files/tokens arrays keep their original behavior.

The unchanged C characterization runs against both the original C source and the production Rust staticlib. Differential tests check randomized owned graphs, repeated cleanup, allocation balance, and every parent layout offset in the existing graphics test binary. The oracle extracts both cleanup bodies verbatim after their native PCH and supplies only the unit headers, avoiding an unrelated zlib requirement on Windows Rust runners. The original C cleanup remains in the C-reference build. No public headers or existing C tests changed; no intentional behavior differences.

RED → GREEN

  • RED: 2658eb3de (unchanged RED patch from 28fef089b after rebase) — all nine lifecycle Rust tests fail at the todo!() stub, locally and in PR CI. Eight mirror the C characterization; one pins destruction order.
  • GREEN: 4c5da5c12, with oracle portability fix 51f9f6e00 — all 11 focused Rust lifecycle/layout/differential tests pass. A mutation that skips parameter destruction fails the differential check at seed 1, confirming it detects leaked ownership.
  • Native macOS: full Rust workspace 1,947 passed / one ignored; workspace Clippy and Dylint passed. Both unchanged C suites pass against hybrid and C-reference dependencies with ASan/UBSan. ARM64 cross lint/link and x64 Clippy/link pass.
  • Linux Docker: both 351-test modes completed again after rebase and before publishing GREEN. Both lifecycle C suites pass in both modes; all 1,766 exported symbols match. OFF and ON each: 346 passed, two failed, three skipped. test_group_empty_bounds (drag_into_filled_group) and test_scene_dup_group_children (private_copy_keeps_group_state) fail with both C-reference and hybrid libraries and reproduce on a serial C-reference retry. An earlier VLC timing failure passed on retry and both final rebased runs. The three skips require PulseAudio fixtures; the mandatory skip-policy check passes for both modes. These broad-suite failures are outside the ported cleanup path; the local gate is not claimed green.
  • Real app / Tier 4: not applicable to this internal cleanup routine; no UI, logging, or protocol behavior changes.

Local validation boundaries: Linux ARM64 GCC blocks full Rust tests/Clippy in unchanged dstr-libc.c.h:120,129 (wchar_t sign conversion); Linux Python self-tests, formatters, inventory, and ratchets pass. After installing LLVM in the task container, the complete Windows MSVC/macOS ARM64 cross lane passes locally (Clippy, Dylint, and linking every test binary for both targets). Managed Windows GNU remains unsupported on ARM64 hosts. x64 macOS Dylint cannot load its nightly std/core even after reinstalling that target. No local-gate attestation is claimed; hosted CI must run the full selected suite.

Checklist

  • Base is master
  • Issue claimed before coding; characterization prerequisite merged
  • Characterization, RED, and GREEN remain separate commits
  • Features ledger: not applicable (no user-visible change)
  • Optional local gate stamp (not claimed; limitations above)
  • No warning/flag changes
  • Intentional differences documented in parity test header and rust/README.md: none

Current-head CI passed on 51f9f6e00b6d65a9a2b3aeee44ba0d1e4e3c87c9: Fast Gate, formatting, cross-lint, Windows/macOS Rust tests, Linux OFF/ON Tier 2 shards, Windows/macOS Tier 2, and CI Gate. Ready for review; not merged.

@nathan-v
nathan-v force-pushed the port/effect-parser-lifecycle branch from fd1b43a to 4c5da5c Compare October 21, 2026 20:29
@nathan-v

Copy link
Copy Markdown
Contributor Author

Rebased onto master 865938d56 because GitHub reported a merge conflict and did not create CI runs for the prior head. Replaced fd1b43ae9e90e7e26f041c4ba74e402950e1a54d with 4c5da5c121b687ae7db9eb3ebe0d317a76fb2b36 using an exact-SHA force-with-lease. The merged characterization commits dropped out; RED is now 2658eb3de, GREEN is 4c5da5c12. Range-diff confirms unchanged port logic (only source-list context moved).

Before this update, reran native workspace tests (1,947 passed / one ignored), workspace Clippy/Dylint, x64 linking, native C lifecycle suites against both libraries, and both complete 351-test Linux Docker modes. Both lifecycle suites pass in both modes; exported symbols match; skip-policy checks pass. Each full Docker mode retains the same two scene/group failures and three PulseAudio skips documented in the description. No local-gate attestation is claimed. Keeping the PR draft until current-head CI passes.

@nathan-v
nathan-v marked this pull request as ready for review October 21, 2026 21:14
@nathan-v
nathan-v requested a review from zackees as a code owner October 21, 2026 21:14
@zackees
zackees added this pull request to the merge queue Oct 21, 2026
Merged via the queue into obs-rust:master with commit 700aaa8 Oct 21, 2026
27 checks passed
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 22, 2026
…bs-rust#1685)

* ci: Check that cmocka tests link libobs_rust-static only behind a guard

test_effect_parser_lifecycle_rust (from obs-rust#1650) links libobs_rust-static
unconditionally. That target exists only with OBS_LIBOBS_BACKEND=HYBRID,
so a C-backend build with unit tests fails to link it ("cannot find
-llibobs_rust-static"). CI builds no C backend with unit tests, so
nothing there notices. This static check does: every tests.d/*.cmake
line that names the Rust static library must be inside an
if(TARGET libobs_rust-static) block, as test_preflight_abi already is.

It fails on master for test_effect_parser_lifecycle.cmake:25.

Refs obs-rust#1683

* test: Build the Rust effect parser test only with the Rust staticlib

obs-rust#1650 added test_effect_parser_lifecycle_rust, which runs the effect
parser lifecycle assertions against the production Rust staticlib and
links libobs_rust-static. With OBS_LIBOBS_BACKEND=C there is no such
target, so the C-lane test build failed to link it. Build and register
that variant only if(TARGET libobs_rust-static), as test_preflight_abi
does. The C variant, test_effect_parser_lifecycle, still builds and runs
in both lanes, and the hybrid lane builds and runs both, as before.

Fixes obs-rust#1683
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 graphics/effect-parser lifecycle to obs-graphics

2 participants