Skip to content

run_guest_scene: take the Wine from $WINE when --wine is not given (OLD-10047) - #1239

Merged
MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
IlyassRS3:carry/old-10047-run-guest-scene-wine
Nov 29, 2026
Merged

MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
IlyassRS3:carry/old-10047-run-guest-scene-wine

Conversation

@IlyassRS3

@IlyassRS3 IlyassRS3 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Carries forward old-pr/10047 (draft #313, original commit by @SkippySteve) rebased cleanly onto main (2e026b03e), preserving the original author commit and adding a follow-up fix for native Windows:

  1. Original commit (@SkippySteve):
    • scripts/run_guest_scene.py: default --wine to $WINE when --wine is omitted (blank counts as unset; --wine still overrides), include the missing binary path in --wine: not found: ..., and update CLI/docstring messages.
    • tests/test_run_guest_scene_wine.py: 5 unit tests covering $WINE pickup, --wine-arg with $WINE, --wine overriding $WINE, missing/empty $WINE refusal outside Windows, and nonexistent $WINE reporting.
  2. Follow-up commit (df763ce9f, addressing @xel1uz's review):
    • scripts/run_guest_scene.py: only read $WINE as the default outside Windows (os.name != "nt"), qualify the docstring / --wine help text (default: $WINE outside Windows), and keep --wine-arg requires --wine on Windows.
    • tests/test_run_guest_scene_wine.py: add RunGuestSceneWindowsEnvTest (3 tests, runs on every platform via a SimpleNamespace stub on runner.os) confirming ambient WINE (existing or missing) is ignored on Windows, explicit --wine still works, and --wine-arg requires explicit --wine.

Item ID

Verification

Tested on macOS 27.2.1 (Apple M5 arm64), Python 3.14 (no game files, no GPU, standard library only):

  • TMPDIR=/var/tmp python3 -I tests/test_run_guest_scene_wine.py -v -> 8/8 OK (5 POSIX + 3 Windows-mode tests)
  • python3 -I tests/test_guest_scene_reference.py -v -> 6/6 OK
  • Mutation check vs HEAD~1 (without the Windows guard) -> FAILED (3 failures) across all 3 Windows ambient-WINE checks; mutation check vs main -> FAILED (3 failures, 2 errors); restoring HEAD returns to 8/8 OK.
  • python3 -m compileall -q scripts/run_guest_scene.py tests/test_run_guest_scene_wine.py -> OK
  • python3 -I scripts/check_no_game_data.py scripts/run_guest_scene.py tests/test_run_guest_scene_wine.py -> OK
  • python3 -I tests/test_ci_registration.py -> 15/15 OK
  • python3 -I tests/test_text_write_line_endings.py -> 3/3 OK

Checklist

  • No game files, binaries, shaders, textures, audio, or logs quoting them
  • No keys, decryption, or online services
  • Claimed in the coordination issue (Coordinating who works on what #14) before opening this PR
  • AI-assisted: yes (carried forward, audited, rebased, updated per review, and regression-verified with AI assistance; original commit by @SkippySteve preserved)

On Linux the script stopped at '--wine is required outside Windows' even
with WINE naming the Wine to use (e.g. UMU-Proton's files/bin/wine), while
run_wine_tests.py already defaults --wine to $WINE. --wine now defaults to
$WINE (blank counts as unset); --wine still wins when both are given.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 20:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@xel1uz xel1uz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Linux precedence cases pass, but on native Windows an ambient WINE now changes a launch even when the caller omits --wine. With a missing binary the parser exits 2; with an existing one, the guest path builder prefixes an already native drive path with Z:. All five new Wine tests skip on Windows.

The inline change restored native paths in the Windows check while preserving the five Wine tests and six reference tests on Ubuntu. Please add a native-Windows regression case and qualify the CLI help accordingly. The original Wine change is draft #313; the description currently points to #312. AI-assisted review, CPU only.

Comment thread scripts/run_guest_scene.py Outdated
ap.add_argument("--shaders", type=Path, required=True, help="shader root containing spirv/")
ap.add_argument("--out", type=Path, help="new or empty folder (default: a temporary folder, removed afterwards)")
ap.add_argument("--wine", help="run the loader through this Wine binary")
ap.add_argument("--wine", default=os.environ.get("WINE") or None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read the environment default on hosts that use Wine for the guest. An explicit --wine still takes precedence.

Suggested change
ap.add_argument("--wine", default=os.environ.get("WINE") or None,
ap.add_argument("--wine", default=(os.environ.get("WINE") or None) if os.name != "nt" else None,

@IlyassRS3

Copy link
Copy Markdown
Contributor Author

Thank you for catching that, @xel1uz! Pushed follow-up commit df763ce9f (preserving @SkippySteve's original commit):

  • Restricted the $WINE default to os.name != "nt", updated the docstring and --wine help text (default: $WINE outside Windows), and kept --wine-arg requires --wine on Windows.
  • Added RunGuestSceneWindowsEnvTest (3 tests, runs on both POSIX and Windows via a SimpleNamespace stub for runner.os) verifying that ambient WINE (existing or missing) is ignored on Windows, explicit --wine still takes precedence, and --wine-arg requires explicit --wine (verified 3 failures against HEAD~1, 8/8 OK on HEAD).
  • Fixed the draft PR reference in the description (#313).

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rechecked the follow-up at df763ce9 on native Windows and Ubuntu under WSL. With the same inherited WINE pointing to a missing path and no explicit flag, the first PR head exited 2 on native Windows and the follow-up left the native launch selected. The three Windows cases passed, and all eight tests passed under Ubuntu. A separate CLI run on Ubuntu launched a synthetic wrapper from a relative WINE path containing spaces, forwarded --wine-arg, and preserved an explicit --wine override. The wrapper was launched after the runner switched into its output overlay.

AI-assisted review. CPU-only checks with synthetic inputs and launchers.

@xel1uz xel1uz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving df763ce9: the follow-up resolves what I requested.

  • Native Windows (Python 3.12, WINE set to a missing path, no --wine): tests/test_run_guest_scene_wine.py 8 tests OK (the 3 Windows-mode cases pass, the 5 POSIX cases skip), tests/test_guest_scene_reference.py 6/6 OK.
    • Bite check: with scripts/run_guest_scene.py from the first head (f3cd82af), the 3 Windows-mode cases fail.
      • Linux (Ubuntu 26.04, Python 3.14): both files OK on the PR head and on the PR merged with current main (merges without conflicts).
        AI-assisted review, CPU only.

@OreoFR

OreoFR commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Verified by OreoFR

  • Base: main 5cb45921e + PR head df763ce9f
  • Test: python -I tests/test_run_guest_scene_wine.py
  • Red on main: 8 OK (5 skipped)
  • Green with the PR: 8 OK (5 skipped)
  • Verdict: NO RED (the 5 Wine tests are skipped on Windows ("only apply outside Windows"): the PR's case is not exercised here)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

@zmasi

zmasi commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

#1239 | head df763ce (merged cleanly onto origin/main 818d881) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff across scripts/run_guest_scene.py and tests/test_run_guest_scene_wine.py. python -I scripts/check_no_game_data.py scripts/run_guest_scene.py tests/test_run_guest_scene_wine.py passed (rc=0).
  • Native Windows 11 (os.name == "nt") verification:
    • python -I tests/test_run_guest_scene_wine.py -> 8 ran, OK (skipped=5) (RunGuestSceneWindowsEnvTest 3/3 passed; POSIX-only RunGuestSceneWineTest 5/5 skipped cleanly on nt).
    • Unmocked native Windows 11 parse_args() check: Executed scripts/run_guest_scene.py's parse_args() directly on Windows 11 (os.name == "nt", without mocking os) with WINE set in os.environ to a nonexistent .exe -> args.wine is None, confirming an ambient WINE environment variable cannot hijack or break native Windows launches while explicit --wine <path> still resolves as expected.

@OreoFR

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df : red 3 failures + 2 errors (test_wine_from_environment, test_wine_args_with_wine_from_environment, test_wine_from_environment_that_does_not_exist, test_missing_wine_still_refused_outside_windows x2 subtests) / green 8 OK.

  • PR head df763ce, python -I tests/test_run_guest_scene_wine.py.
  • The Wine tests run here (they are skipped on Windows, "only apply outside Windows"): this is the PR's case exercised for the first time.
  • Red: 8 run, 3 failures, 2 errors. On main, $WINE is not read (AttributeError: 'int' object has no attribute 'wine') and the error says --wine is required outside Windows where the tests expect --wine (or WINE) is required outside Windows / --wine: not found. MEASURED, 3 runs, 3/3 fail.
  • Green: 8 run, OK, 0 skipped. MEASURED, 3/3 pass.
  • Verdict: READY.

Red = main + only the test file from this PR (git checkout pr-N -- <test>); green = main + git merge --no-ff of this PR, no conflict. Green runs more tests than red because the merge keeps the tests main added to this file since the PR branched; that is the method, not a finding.

AI-assisted: Claude Code (Claude Opus 5.5).

@MoonEyes
MoonEyes merged commit d8c10dd into ProjectLeonida:main Nov 29, 2026
@MoonEyes

Copy link
Copy Markdown
Collaborator

Merged after OreoFR's red/green check (check) (macOS 27.2.1, Apple M5, APFS case-insensitive, Python 3.12) and a local re-check here. Merged after local re-verification: this PR merged onto main 3515922 without conflict, and its test file(s) (tests/test_run_guest_scene_wine.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants