Skip to content

obs-output: Port service weak acquisition accessors (#3837) - #3842

Merged
zackees merged 3 commits into
masterfrom
port/service-context-accessors
Nov 7, 2026
Merged

zackees merged 3 commits into
masterfrom
port/service-context-accessors

Conversation

@zackees

@zackees zackees commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #3837

Ports obs_weak_service_weak_get_ref and obs_weak_service_target from libobs/obs-service.c.h to obs-output. The lifecycle now acquires weak controls through Rust, preserving biased reference counts, platform C-long width, SeqCst ordering, and the unchanged private C layout. Release/free, module lookup, and context/state/handlers remain follow-ups #3838, #3839, and #3840.

The C functions were extracted verbatim in feeea0b (body/signature byte comparison against master passed), then switched into their own ported unity group. The C reference and Tier 3 oracle keep compiling those original bodies; no duplicate C copy or legacy relocation is needed. The old lifecycle-oracle acquisition doubles are removed, while its traced release/free operations remain intact. The two Rust shims are hidden in their own manifest; rust-exports.d, public headers, existing C tests, private struct layouts, and plugins/obs-websocket are unchanged.

RED → GREEN

  • RED d668ec4: soldr cargo test -p obs-data --test obs-tests-core output::service_weak_acquire exited 101, 0 passed / 3 failed, each not yet implemented: #3837. Log: /home/niteris/.clud/tmp/tool-output/local-test-private/local-test-CNkqJx.log. The hosted Windows RED run also failed exactly those three stubs (4256 passed, 3 failed, 5 ignored): https://github.com/obs-rust/obs-studio/actions/runs/42351798652/job/128341628888 . The RED format run caught the extraction include order; the GREEN swap removes that include, and the build-group check passes.
  • GREEN b9dbe55: SOLDR_PORCELAIN=0 SOLDR_RUSTC_WRAPPER=none OBS_PARITY_CASES=reduced soldr cargo test -p obs-data --test obs-tests-core output::service exited 0, 40 passed. Log: /home/niteris/.clud/tmp/tool-output/local-test-private/local-test-UTD9K0.log.
  • Tier 1: three safe-core cases cover repeated acquisition, unchanged target, expired negative counts, and the largest defined increment.
  • Tier 3: three cases check size, alignment, and every field offset of both structs against the real obs-internal.h; fixed boundaries and proptest compare returns, target pointers, and both counters. No intended differences on defined C inputs. NULL controls are invalid in C; acquisition at LONG_MAX is excluded because C signed addition overflows. These exclusions are recorded in the parity header and rust/README.md.
  • Mutation: temporarily changing owners >= 0 to owners > 0 exited 101, failing both the Tier 1 acquisition assertion and the Tier 3 boundary comparison (4 passed, 2 failed). Log: /home/niteris/.clud/tmp/tool-output/local-test-private/local-test-rnmi7a.log. Restored the exact GREEN source and reran the six new tests: exit 0, 6 passed. Log: /home/niteris/.clud/tmp/tool-output/local-test-private/local-test-ZbtuWJ.log.

Tier 2 and exports

Exit 0, unchanged test_service_lifecycle: 8/8 against C reference and 8/8 against hybrid, no skips; loader paths verified with ldd. 1,767 dynamic exports, identical.

The standard uv run rust/tools/linux-validate/run.py --repeat 1 --tests test_service_lifecycle first encountered a zccache daemon failure, retried through the harness recovery, and reached its 1200-second command deadline (report exit 124). Full-suite completion is not claimed. Log: /home/niteris/.clud/tmp/tool-output/local-test-private/local-test-YlGeYt.log.

The focused retry used the same repository docker_task_command, image, checkout-scoped warm build volume, and source mount, with ZCCACHE_DISABLE=1. It ran cmake --build /build/tree --target libobs libobs-c-reference test_service_lifecycle -- -k 0, compared nm -D --defined-only symbols, verified each loaded library, and ran xvfb-run -a ctest --test-dir /build/tree -R '^test_service_lifecycle$' --output-on-failure -V for both OFF and ON. Reproducer: uv run --no-project /tmp/run-service-tier2.py. Complete focused log: /home/niteris/.clud/tmp/tool-output/local-test-private/local-test-5eO0en.log.

Gates and test cost

  • uv run ci/test_build_groups.py: 10 passed. Full ./lint: exit 1 only at the documented soldr refusal to build the Dylint driver under clud (v6.2.0 lacks the pinned nightly driver). All earlier formatter, Python, and Clippy lanes passed. No toolchain workaround; hosted Fast Gate must run Dylint. Log: /home/niteris/.clud/tmp/tool-output/local-test-private/local-test-z27GC4.log. The first lint run started before the new group was staged and failed its source inventory; the staged rerun fixes that inventory failure.
  • Pre-push clud-review: one reviewer, clean; no actionable findings.
  • Test cost: existing obs-tests-core binary only. Each new module passed 25 debug runs at reduced parity: Tier 1 longest 0.02 s, peak 11,136 KiB RSS; Tier 3 longest 0.02 s, peak 15,428 KiB RSS. No threads of their own. Reproducer: uv run --no-project /tmp/measure-service-weak.py.
  • Tier 4 / real app / feature ledger: inapplicable, no protocol or user-visible behavior change. Hosted required checks remain the merge gate; no local-gate attestation is claimed.

@zackees
zackees marked this pull request as ready for review November 7, 2026 07:50
@zackees
zackees enabled auto-merge November 7, 2026 07:50
@zackees

zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator / pool chaperone. GREEN head b9dbe55 is pushed and verified; auto-merge is enabled with that head pinned. Local service tests 40/40, new tests 6/6 after mutation restoration, unchanged Tier 2 lifecycle 8/8 in each mode and 1767 identical exports. Full lint passed earlier lanes but hit the documented soldr Dylint-driver refusal under clud; hosted Fast Gate remains required. The broad local Tier 2 timed out after a cache-daemon failure; focused retry passed through the same warm Docker harness. Commands, exit codes and retained logs are in the final PR body. Follow-ups #3838–#3840. Retiring the worker per pool instructions without waiting on hosted CI.

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 obs-service weak acquisition accessors to obs-output

1 participant