Linux: enable scoped copy and descriptor tracking defaults #2700

Merged
snesan821 merged 2 commits from upstream-pr/2700 into main 2026-12-01 10:52:20 +00:00
snesan821 commented 2026-11-30 06:44:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by snesan821 on 2026-11-30T06:44:05Z.


Claimed in the coordination issue as: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7270942341

What and why

Set LEONIDA_COPY_SCOPED=1 and LEONIDA_PORT_DESCRIPTORS=1 in scripts/play-linux.sh when unset, matching the existing Windows launcher defaults. Explicit 0 remains an opt-out for either setting. No runtime code or other defaults change.

Related: #2577 also edits this launcher. Its current launcher change merged cleanly with this patch in a local three-way check, and the regression tests passed against the combined script.

Tested

  • sh -n scripts/play-linux.sh.
  • python3 -I tests/test_play_linux_defaults.py: the defaults test fails on unpatched main and both tests pass with this patch. The mock receives the correct environment without running Wine or game code.
  • Upstream no-game-data checker passed for both changed files.
  • No runtime, rendering-correctness, GPU or frame-rate claims; those still need a real run.

GPUs tested: n/a (shell and mocked process tests only).

AI-assisted: yes.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.
  • No new translator rule.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5560415374 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2700). Originally posted by [snesan821](https://github.com/snesan821) on 2026-11-30T06:44:05Z. --- Claimed in the coordination issue as: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7270942341 ### What and why Set `LEONIDA_COPY_SCOPED=1` and `LEONIDA_PORT_DESCRIPTORS=1` in `scripts/play-linux.sh` when unset, matching the existing Windows launcher defaults. Explicit `0` remains an opt-out for either setting. No runtime code or other defaults change. Related: #2577 also edits this launcher. Its current launcher change merged cleanly with this patch in a local three-way check, and the regression tests passed against the combined script. ### Tested - `sh -n scripts/play-linux.sh`. - `python3 -I tests/test_play_linux_defaults.py`: the defaults test fails on unpatched main and both tests pass with this patch. The mock receives the correct environment without running Wine or game code. - Upstream no-game-data checker passed for both changed files. - No runtime, rendering-correctness, GPU or frame-rate claims; those still need a real run. GPUs tested: n/a (shell and mocked process tests only). AI-assisted: yes. ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys or decryption. - No new translator rule.
OreoFR commented 2026-11-30 06:44:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T06:44:55Z.


Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16 -I, main bbd45f5cc, PR head 856028dd4. MEASURED:

  • red (main + only tests/test_play_linux_defaults.py): Ran 2, FAILED (failures=1), test_unset_flags_default_to_enabled.
  • green (main + this PR, merge --no-ff): Ran 2, OK.
  • Merges cleanly with main and with #2566.

One thing to check against the description ("matching the existing Windows launcher defaults"): d3d12/scripts/play-nvidia.ps1 sets three of these on main, LEONIDA_QUICK_FIND_WINDOWS = '1' (line 231), LEONIDA_PORT_DESCRIPTORS = '1' (237) and LEONIDA_COPY_SCOPED = '1' (244). This PR adds the last two to play-linux.sh but not LEONIDA_QUICK_FIND_WINDOWS. If that is on purpose (e.g. it was only measured on Windows), saying so in the comment line would help; otherwise it is missing.

Not covered: any run under Linux/Proton.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7270969655 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2700#issuecomment-7270969655). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-30T06:44:55Z. --- Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16 `-I`, main bbd45f5cc, PR head 856028dd4. MEASURED: - red (main + only `tests/test_play_linux_defaults.py`): **Ran 2, FAILED (failures=1)**, `test_unset_flags_default_to_enabled`. - green (main + this PR, `merge --no-ff`): **Ran 2, OK**. - Merges cleanly with main and with #2566. One thing to check against the description ("matching the existing Windows launcher defaults"): `d3d12/scripts/play-nvidia.ps1` sets **three** of these on main, `LEONIDA_QUICK_FIND_WINDOWS = '1'` (line 231), `LEONIDA_PORT_DESCRIPTORS = '1'` (237) and `LEONIDA_COPY_SCOPED = '1'` (244). This PR adds the last two to `play-linux.sh` but not `LEONIDA_QUICK_FIND_WINDOWS`. If that is on purpose (e.g. it was only measured on Windows), saying so in the comment line would help; otherwise it is missing. Not covered: any run under Linux/Proton. AI-assisted: Claude Code
lixonik commented 2026-11-30 08:04:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T08:04:30Z.


Independent local Ubuntu-on-WSL2 check of 856028dd495b61a60220b01a3e0c6e59a5b4d09e on e1fe82f6381d51679493cb5c0ae9953e2b66565a. Ryzen 9 5950X, WSL2 kernel 6.18.58.1, /bin/sh, Python 3.10.12. Wine was replaced with a shell stub. All files and paths were synthetic.

  • Red/green: with the PR test and main's launcher, the unset case received unset/unset and failed. After applying the launcher change, both checked-in tests passed. sh -n scripts/play-linux.sh and the no-game-data check also passed.
  • An additional 14-case matrix checked both console profiles, paths with spaces, unset/empty values, and independent 0 overrides. All 14 cases preserved the intended values and passed the expected runtime, title placeholder and console arguments to the stub.
  • The same 14 cases passed for the clean three-way launcher merge with #2577 at 9a737660b95ac5999dad6ddd775efda834f5ba95. That covers the combined launcher path through its explicit Wine override. Rendering, real Wine/Proton and performance remain outside this test.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7272451781 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2700#issuecomment-7272451781). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-30T08:04:30Z. --- Independent local Ubuntu-on-WSL2 check of `856028dd495b61a60220b01a3e0c6e59a5b4d09e` on `e1fe82f6381d51679493cb5c0ae9953e2b66565a`. Ryzen 9 5950X, WSL2 kernel 6.18.58.1, `/bin/sh`, Python 3.10.12. Wine was replaced with a shell stub. All files and paths were synthetic. - Red/green: with the PR test and main's launcher, the unset case received `unset/unset` and failed. After applying the launcher change, both checked-in tests passed. `sh -n scripts/play-linux.sh` and the no-game-data check also passed. - An additional 14-case matrix checked both console profiles, paths with spaces, unset/empty values, and independent `0` overrides. All 14 cases preserved the intended values and passed the expected runtime, title placeholder and console arguments to the stub. - The same 14 cases passed for the clean three-way launcher merge with #2577 at `9a737660b95ac5999dad6ddd775efda834f5ba95`. That covers the combined launcher path through its explicit Wine override. Rendering, real Wine/Proton and performance remain outside this test. AI-assisted.
fiestorra commented 2026-11-30 12:06:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T12:06:04Z.


Verified as far as this machine allows: the change applies and its tests are the right shape, but they skip here, so I cannot give you a control.

What I did:

git cherry-pick <the PR onto main d367675c7>   -> 3aaee1fca, clean
python3 -m pytest tests/test_play_linux_defaults.py -q
2 skipped in 0.25s

Why they skip: tests/test_play_linux_defaults.py:16 is

@unittest.skipUnless(SH, "POSIX shell required")

and this is a Windows host, so the two cases that check scripts/play-linux.sh's defaults never run. A skip counted as a pass would be the "does not bite" result I have mistakenly published twice today (stale binary, stale manifest), so I am not going to report one here.

What a Linux host would show, and what I would ask: with the change, the two cases assert the scoped-copy and descriptor-tracking defaults on play-linux.sh; reverting scripts/play-linux.sh and keeping the test should make them fail. That is the control, and it needs a POSIX shell - the linux-python-and-viewer job is the one that runs it.

What I could check without one: the change touches two files, a shell script and its test, and no runtime source - so the blast radius is a launch script's defaults, not the shim layer. The test file's name matches the script it checks, which is the pairing a reviewer wants to see.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7277946325 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2700#issuecomment-7277946325). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T12:06:04Z. --- **Verified as far as this machine allows: the change applies and its tests are the right shape, but they skip here, so I cannot give you a control.** **What I did:** ``` git cherry-pick <the PR onto main d367675c7> -> 3aaee1fca, clean python3 -m pytest tests/test_play_linux_defaults.py -q 2 skipped in 0.25s ``` **Why they skip:** `tests/test_play_linux_defaults.py:16` is ```python @unittest.skipUnless(SH, "POSIX shell required") ``` and this is a **Windows** host, so the two cases that check `scripts/play-linux.sh`'s defaults never run. **A skip counted as a pass would be the "does not bite" result I have mistakenly published twice today** (stale binary, stale manifest), so I am not going to report one here. **What a Linux host would show, and what I would ask:** with the change, the two cases assert the scoped-copy and descriptor-tracking defaults on `play-linux.sh`; reverting `scripts/play-linux.sh` and keeping the test should make them fail. **That is the control, and it needs a POSIX shell** - the `linux-python-and-viewer` job is the one that runs it. **What I could check without one:** the change touches **two files, a shell script and its test**, and **no runtime source** - so the blast radius is a launch script's defaults, not the shim layer. **The test file's name matches the script it checks**, which is the pairing a reviewer wants to see. Written with an AI assistant.
aslan2142 commented 2026-12-01 10:30:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:30:21Z.

Review: APPROVED


Verified against current main: both LEONIDA_COPY_SCOPED (d3d12/crates/leonida-gpu/src/host.rs) and LEONIDA_PORT_DESCRIPTORS (d3d12/apps/leonida/src/run.rs, with safe fallback to the changed-page scan if patching fails) exist and are GPU-vendor agnostic. tests/test_play_linux_defaults.py is clean-room stdlib-only and passed in linux-python-and-viewer.

  • Minor non-blocking comment nit: scripts/play-linux.sh:69 (# Match the Windows launcher defaults;) is slightly broader than the two flags set here (e.g. LEONIDA_QUICK_FIND_WINDOWS is not set).
  • Note: semantic-tests failed with an unrelated failure (UNSTABLE); please re-run CI to green before merging.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6129443576 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2700#pullrequestreview-6129443576). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:30:21Z. **Review:** APPROVED --- Verified against current `main`: both `LEONIDA_COPY_SCOPED` (`d3d12/crates/leonida-gpu/src/host.rs`) and `LEONIDA_PORT_DESCRIPTORS` (`d3d12/apps/leonida/src/run.rs`, with safe fallback to the changed-page scan if patching fails) exist and are GPU-vendor agnostic. `tests/test_play_linux_defaults.py` is clean-room stdlib-only and passed in `linux-python-and-viewer`. - Minor non-blocking comment nit: `scripts/play-linux.sh:69` (`# Match the Windows launcher defaults;`) is slightly broader than the two flags set here (e.g. `LEONIDA_QUICK_FIND_WINDOWS` is not set). - Note: `semantic-tests` failed with an unrelated failure (`UNSTABLE`); please re-run CI to green before merging. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 10:52:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:52:18Z.


Verified the semantic-tests failure on this run was an unrelated base-branch 1-ULP failure in tests/semantic/test_interp_computed_ij_fallback.py (already green on newer main), while all checks covering scripts/play-linux.sh and tests/test_play_linux_defaults.py (linux-python-and-viewer, no-game-data, change-scope, check, windows, linux-gpu-tools) passed. Squash-merging now.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7308845837 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2700#issuecomment-7308845837). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:52:18Z. --- Verified the `semantic-tests` failure on this run was an unrelated base-branch 1-ULP failure in `tests/semantic/test_interp_computed_ij_fallback.py` (already green on newer `main`), while all checks covering `scripts/play-linux.sh` and `tests/test_play_linux_defaults.py` (`linux-python-and-viewer`, `no-game-data`, `change-scope`, `check`, `windows`, `linux-gpu-tools`) passed. Squash-merging now. *(AI-assisted review.)*
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2700
No description provided.