Skip to content

test: Wait for visibility transition sources - #2489

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/visibility-transition-flake
Oct 26, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/visibility-transition-flake

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2479

What and why

test_visibility_transition fails now and then: show_transition_three_items gets "c 2 Show Transition" != "c Show Transition", after libobs renamed the case's boxes a to e and its group ("Attempted to insert context with duplicate name"). It was seen in the PR CI of #2475 (Rust Tier 2 Linux, tests ON) and passed on rerun.

Every case creates its boxes with the same names, a to e. The teardown releases the scene and the boxes and then flushes libobs's destruction queue, but the release is not always the scene's last reference: the video thread takes a reference on every source while it ticks them (tick_sources()). When it holds the scene at that moment, it destroys the scene itself a little later, after the flush. The boxes stay alive in the scene until then, their names are still taken when the next case creates its own, and libobs renames them ("c 2"). In the CI log the scene's own name was free in the next case but a to e and the group were not, which fits this order.

The teardown now connects to the destroy signal of the scene, the group and the five boxes before it releases them, and waits (up to 10 s) until all seven have fired. destroy is signalled after a source's name is freed, so the next case can no longer meet the old names. If they are not all destroyed in time, the teardown says so and fails, instead of the next case failing on a name. The flush that was already there stays. The eight cases and their assertions are unchanged.

RED → GREEN

A flake has no deterministic RED, so here is how it was reproduced instead:

  • Unforced, the failure did not show locally: master passed 500/500 runs on the hybrid lane and 200/200 on each of C and hybrid with the test pinned to a loaded CPU.
  • Forced: a scratch change, not committed, made tick_sources() sleep 50 ms between taking its references and releasing them (OBS_SCRATCH_TICK_HOLD_MS=50). With that libobs, the same test binary run 200 times on each lane:
Lane master this PR
C libobs 9/200 failed 0/200
hybrid libobs 4/200 failed 0/200
libobs-c-reference 12/200 failed 0/200

Every master failure was the CI one: "c 2 Show Transition" != "c Show Transition" in show_transition_three_items.

  • Without the scratch change, at this PR's commit: 100/100 passes on each of the three lanes.
  • Local gate: --lane lint ok, --test-diff origin/master passed, --lane cross ok.
  • Real app: no app change (test only).

Checklist

  • Base is master
  • 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 (not applicable: a fix to a flaky test, one commit; see above for how it was reproduced)
  • 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 (gate passed locally, head not stamped)
  • Warning or flag changes (-W..., ratchets): not applicable
  • Intentional differences from C listed in the parity test header and rust/README.md (ports): not applicable

test_visibility_transition reuses the names a to e in every case. The
video thread holds a reference on each source while it ticks, so the
teardown's release is not always the scene's last one: the video
thread then destroys the scene after the destruction queue was
flushed, the previous case's boxes are still alive, and libobs renames
the new ones ("c 2 Show Transition", seen in the PR CI of obs-rust#2475).

The teardown now waits for the "destroy" signal of the scene, the
group and every box before the next case runs. The cases and their
assertions are unchanged.

Fixes obs-rust#2479
@rdoupe
rdoupe requested a review from zackees as a code owner October 26, 2026 15:17
@zackees

zackees commented Oct 26, 2026

Copy link
Copy Markdown
Member

Coordinator review: a flake fix (#2479). It adds a teardown wait until the scene, the group and every box have signalled destroy, capped at 10 s, so the next case's identically named sources aren't renamed. It doesn't change an assertion or what the test checks, so it fits the no-C-test-edit rule, which is about making a port pass. Queuing.

@zackees
zackees enabled auto-merge October 26, 2026 15:22
@zackees
zackees added this pull request to the merge queue Oct 26, 2026
Merged via the queue into obs-rust:master with commit 98e14ce Oct 26, 2026
36 checks passed
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.

test: test_visibility_transition is flaky (names from the previous case)

2 participants