Skip to content

ci: Run the NixOS AppImage lane from Python (#962) - #2580

Merged
zackees merged 3 commits into
masterfrom
fix/962-gen-005-appimage-nixos
Oct 27, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/962-gen-005-appimage-nixos

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

Refs #962 (GEN-005 burn-down).

build-aux/appimage/test-appimage-nixos.sh is a tracked shell script, which GEN-005 flags. It becomes build-aux/appimage/test_appimage_nixos.py.

  • The docker step brings uv and python3 from the same pinned nixpkgs revision and runs the script with uv run --no-project. The AppImage glob is expanded by the script, so the command no longer needs a shell.
  • The start phase re-executes the script inside one nix shell that carries Xvfb, dbus and the process tools, and drives them from Python (Popen, the same 3 s and 45 s waits) instead of an inline bash script.
  • Every check is unchanged: the wrapper builds, the driver closure lands in /run/opengl-driver with the NVML stand-in, OBS keeps running for 45 s, reaches its main window, initializes OpenGL, reports VA-API unavailable without refusing to start, and the NVML marker names /run/opengl-driver/lib.

RED

b53a8f927 — ci/test_appimage_nixos_checks.py holds six sample logs and compares the port's errors() with the shell's own grep calls (run for real) for each: a good start, a refused preflight, no scene, no OpenGL, no NVML marker, a crash and an exited process. Fails with the module missing and the workflow still naming the shell script.

GREEN

092da247a — the port and the workflow step.
uv run python -m unittest ci.test_appimage_nixos_checks → 4 tests, OK; 0 mismatches against the shell's decisions over the sample logs.

This lane only runs at release time inside a privileged nixos/nix container, so the port cannot be exercised end to end here; the decision layer is what the test pins. ./lint passes apart from the pre-existing test_macos_browser_helpers failure in this checkout (modified submodule pointers, not in this diff).

test-appimage-nixos.sh only runs at release time, inside a privileged nixos
container, so its decisions had no test. Load the port and compare its
errors() with the shell's own grep calls on sample logs, including a good
start, a refused preflight, no scene, no OpenGL, no NVML marker, a crash
and an exited process.

RED: build-aux/appimage/test_appimage_nixos.py does not exist, and the
workflow still names the shell script (4 errors/1 failure).

Refs #962
test-appimage-nixos.sh is a tracked shell script, a GEN-005 violation. It
becomes build-aux/appimage/test_appimage_nixos.py. The step's docker command
now brings uv and python3 from the same nixpkgs revision and runs the script
through uv; the AppImage glob is expanded by the script, so the command no
longer needs a shell.

The start phase re-executes the script inside one nix shell that carries
Xvfb, dbus and the process tools, and drives them from Python instead of an
inline bash script. Every check is unchanged: the wrapper builds, the driver
closure lands in /run/opengl-driver with the NVML stand-in, OBS keeps
running for 45 s, reaches its main window, initializes OpenGL, reports
VA-API unavailable without refusing to start, and the NVML marker names
/run/opengl-driver/lib.

GREEN: uv run python -m unittest ci.test_appimage_nixos_checks (4 tests OK,
0 mismatches against the shell's grep decisions over six sample logs);
./lint clean apart from the checkout's pre-existing submodule-pointer case.

Refs #962
The port re-executed itself inside `nix shell` with nixpkgs `python3`, which
ci/test_uv_run.py flags (#637): three bare interpreter invocations, one in the
docstring and two in the re-exec argv. The lane needs nix only for the X tools
(Xvfb, dbus, procps, coreutils), so the start phase now runs the same
`uv run` interpreter the outer phase already uses (sys.executable) and the
inner closure drops `python3`.
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Format 🔍 / checks fix — ci/test_uv_run.py::test_no_bare_python_invocations flagged three bare python3 invocations in build-aux/appimage/test_appimage_nixos.py (#637): the docstring usage line, f"{NIXPKGS}#python3" in the inner closure, and the "python3" re-exec argv.

Fixed in ab3b3f876: the lane needs nix only for the X tools (Xvfb, dbus, procps, coreutils), so the start phase now re-executes under the same uv run interpreter the outer phase already uses (sys.executable) and the inner closure drops python3. The docstring usage line now names the real uv run build-aux/appimage/test_appimage_nixos.py invocation.

Evidence (local):

  • uv run python -m unittest ci/test_uv_run.py → Ran 5 tests, OK
  • uv run python -m unittest ci/test_appimage_nixos_checks.py → Ran 4 tests, OK
  • ./lint → test_uv_run.py ok; only the pre-existing test_macos_browser_helpers failure remains (local plugins/obs-browser pointer, not in this diff)

This PR touches .github/workflows/appimage.yaml, so it needs watching through merge, not a coordinator handoff.

@zackees
zackees added this pull request to the merge queue Oct 27, 2026

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed #2580 (obs-studio 2580) — verdict: looks good to land.

Checked:

  • Decision parity. The port's errors() keeps all six verdicts the shell made (state, preflight, scene, opengl, nvml, crash) with the same log patterns, and ci/test_appimage_nixos_checks.py::test_the_port_decides_as_the_shell_did pins them against a real grep oracle over six sample logs. I ran it on this head: uv run --no-project python -m unittest ci/test_appimage_nixos_checks.py → 4 tests, OK. ci/local_gate.py picks up every ci/test_*.py, so the check runs in the gate rather than living as dead weight.
  • The workflow step. docker run uses the exec form, so nothing expands OBS-Studio-*-linux-x86_64.AppImage any more; locate() does the glob, which is what the step now relies on. The nix shell interpreter (sys.executable) is a store path and stays resolvable in the inner nix shell of xorg/dbus/procps/coreutils, so the re-exec of the start phase is sound and no bare python3 remains (ci/test_uv_run.py clean, as the last commit says).
  • Nothing left pointing at the removed script. git grep test-appimage-nixos.sh on this head only finds the test's own docstring and its negative assertion.
  • Ledger. CI-only change, no docs/features.md line needed (coordination.md §4).

Two non-blocking notes:

  1. The description's RED/GREEN SHAs (b53a8f927, 092da247a) no longer exist after the rebase — the branch head is ab3b3f87 over 73a1dbb2, 2d6999d7. Not worth a rewrite for a squash merge, but the next reader will chase a dangling SHA.
  2. locate() takes sorted(matches)[0] and only fails when the glob matches nothing. If the release ever produces two AppImages in that directory, the lane would silently test the alphabetically first one; a len(matches) != 1 error would say so instead.

Queuing it for the merge queue now.

Merged via the queue into master with commit 38b6679 Oct 27, 2026
31 checks passed
@zackees
zackees deleted the fix/962-gen-005-appimage-nixos branch October 27, 2026 08:56
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Oct 27, 2026
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