Show Smooth Motion usage before loading NVAPI #2943

Open
andrew-ai wants to merge 3 commits from upstream-pr/2943 into main
andrew-ai commented 2026-12-01 20:23:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T20:23:25Z.


Claimed in the coordination issue as: SMOOTH-MOTION-HELP

What and why

Asking the Smooth Motion script for help could reach NVAPI setup, even when the command included an explicit profile change. Both -Help and -? now print the query/on/off usage and return before the script compiles or calls its driver bindings.

Tested

  • Ran python -I tests/test_smooth_motion_help.py on Windows PowerShell 5.1 and PowerShell 7.6.9. With a guard that throws on driver setup, both help switches with -State on failed on upstream main and passed with this change.
  • Ran tests/test_leonida_launcher.py and tests/test_play_nvidia_menu_choice.py under Python isolated mode. All 30 tests passed.
  • Ran the clean-room check on both changed files and checked the diff for whitespace errors.

GPUs tested: N/A. The help tests intercept driver setup and require no NVIDIA hardware or game files.

AI-assisted: Yes. OpenAI Codex (GPT-6) implemented the change. An independent read-only GPT-6.2 Sol reviewer reviewed the diff and ran the regression test.

Checklist

  • Based on upstream main at 19d5f83cd.
  • One topic.
  • No game data, keys or decryption.
  • No translator rule changed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5593856487 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T20:23:25Z. --- Claimed in the coordination issue as: [SMOOTH-MOTION-HELP](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7324541626) ### What and why Asking the Smooth Motion script for help could reach NVAPI setup, even when the command included an explicit profile change. Both `-Help` and `-?` now print the query/on/off usage and return before the script compiles or calls its driver bindings. ### Tested - Ran `python -I tests/test_smooth_motion_help.py` on Windows PowerShell 5.1 and PowerShell 7.6.9. With a guard that throws on driver setup, both help switches with `-State on` failed on upstream main and passed with this change. - Ran `tests/test_leonida_launcher.py` and `tests/test_play_nvidia_menu_choice.py` under Python isolated mode. All 30 tests passed. - Ran the clean-room check on both changed files and checked the diff for whitespace errors. GPUs tested: N/A. The help tests intercept driver setup and require no NVIDIA hardware or game files. AI-assisted: Yes. OpenAI Codex (GPT-6) implemented the change. An independent read-only GPT-6.2 Sol reviewer reviewed the diff and ran the regression test. ### Checklist - [x] Based on upstream main at `19d5f83cd`. - [x] One topic. - [x] No game data, keys or decryption. - No translator rule changed.
merzleckeier commented 2026-12-01 20:37:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T20:37:10Z.


Independent Smooth Motion help check under Linux PowerShell 7.4.21 on 040704d2 merged into 66c79286f. With Add-Type stubbed to throw, all four cases on main reached the guard and exited 1. On the PR, -Help, -?, help with -State on and the alias with -State off all printed the usage and exited 0 without reaching the guard. The two explicit-state help cases also passed a synthetic -Exe containing a space. Ordinary -State query, on and off still reached the guard on both trees.

The stock Smooth Motion help test and all 15 launcher tests passed. The 15 Windows-only menu tests were skipped on Linux. Driver profile changes were outside this check.

MEASURED with OpenAI Codex and a separate read-only review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7324991409 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943#issuecomment-7324991409). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T20:37:10Z. --- Independent Smooth Motion help check under Linux PowerShell 7.4.21 on `040704d2` merged into `66c79286f`. With `Add-Type` stubbed to throw, all four cases on `main` reached the guard and exited 1. On the PR, `-Help`, `-?`, help with `-State on` and the alias with `-State off` all printed the usage and exited 0 without reaching the guard. The two explicit-state help cases also passed a synthetic `-Exe` containing a space. Ordinary `-State query`, `on` and `off` still reached the guard on both trees. The stock Smooth Motion help test and all 15 launcher tests passed. The 15 Windows-only menu tests were skipped on Linux. Driver profile changes were outside this check. MEASURED with OpenAI Codex and a separate read-only review.
KelboLive commented 2026-12-01 21:36:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T21:36:03Z.

Review: COMMENTED


Verified on Windows PowerShell 5.1 and pwsh 7: -Help, -?, and -Help -State on print the usage on stdout and exit 0 before Add-Type/LoadLibraryW/Run; on base 19d5f83cd the same calls reach the driver-setup guard, so this fixes a real path that could otherwise apply -State on to the profile. The -State/-Exe contract is unchanged, and the regression test catches both removing the print and removing the early return.

Merge-tree against current origin/main is clean, and the launcher suites are all green (the new test, test_win_launchers, test_leonida_launcher, test_play_nvidia_menu_choice).

Non-blocking: ValidateSet runs before the help check, so -Help -State bogus shows a binding error rather than usage — still no NVAPI, so it is only a UX nit. Adding -Help alone and -Help -Exe "a b" to the test would pin the parameter-free forms too.

Heads-up: this overlaps the smooth-motion.ps1 -Help switch on a branch I had been preparing, so I will drop that file from my branch rather than duplicate yours — no action needed on your side.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6140580158 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943#pullrequestreview-6140580158). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T21:36:03Z. **Review:** COMMENTED --- Verified on Windows PowerShell 5.1 and pwsh 7: `-Help`, `-?`, and `-Help -State on` print the usage on stdout and exit 0 before `Add-Type`/`LoadLibraryW`/`Run`; on base `19d5f83cd` the same calls reach the driver-setup guard, so this fixes a real path that could otherwise apply `-State on` to the profile. The `-State`/`-Exe` contract is unchanged, and the regression test catches both removing the print and removing the early return. Merge-tree against current `origin/main` is clean, and the launcher suites are all green (the new test, `test_win_launchers`, `test_leonida_launcher`, `test_play_nvidia_menu_choice`). Non-blocking: `ValidateSet` runs before the help check, so `-Help -State bogus` shows a binding error rather than usage — still no NVAPI, so it is only a UX nit. Adding `-Help` alone and `-Help -Exe "a b"` to the test would pin the parameter-free forms too. Heads-up: this overlaps the `smooth-motion.ps1 -Help` switch on a branch I had been preparing, so I will drop that file from my branch rather than duplicate yours — no action needed on your side.
andrew-ai commented 2026-12-01 22:09:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T22:09:50Z.


Added the two suggested help cases in b549d0e93: bare -Help and -Help with a quoted executable name. Both PowerShell editions now exercise four invocations each. All eight cases reached the driver-setup guard on the base and passed on the PR. The independent Codex reviewer repeated the red/green check and clean-room scan.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7327357742 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943#issuecomment-7327357742). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T22:09:50Z. --- Added the two suggested help cases in b549d0e93: bare -Help and -Help with a quoted executable name. Both PowerShell editions now exercise four invocations each. All eight cases reached the driver-setup guard on the base and passed on the PR. The independent Codex reviewer repeated the red/green check and clean-room scan.
andrew-ai commented 2026-12-01 23:59:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T23:59:39Z.


Could a maintainer approve the two fork workflow runs for the current head (b549d0e93)? Both concluded action_required with zero jobs, so the required checks have no results. The branch currently merges cleanly.

Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7330012212 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943#issuecomment-7330012212). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T23:59:39Z. --- Could a maintainer approve the two fork workflow runs for the current head (b549d0e93)? Both concluded action_required with zero jobs, so the required checks have no results. The branch currently merges cleanly. - [CI](https://github.com/ProjectLeonida/mandy/actions/runs/46756727307) - [No Game Data](https://github.com/ProjectLeonida/mandy/actions/runs/46756727374) Codex-assisted.
MoonEyes commented 2026-12-02 18:00:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:00:57Z.


RUN (independent run on Windows, head f9fe7b81fcaf6d8811fa8f3355fa6ddc39a635b4, merged into main 45dc41f95c1cd0dcc29c2c50582e0e9af8a77259 with git merge --no-ff)

Windows 11, Windows PowerShell 5.1 only (pwsh is not installed here, so the PowerShell 7 half of the test did not run). No GPU or game files used.

Green

  • python -I tests/test_smooth_motion_help.py: 1 test, OK (4 invocations: -Help, -Help -Exe 'a b.exe', -Help -State on, -? -State on).
  • python -I tests/test_leonida_launcher.py: 26 tests, OK.
  • python -I scripts/check_no_game_data.py on the 2 changed files: clean.
  • tests/test_play_nvidia_menu_choice.py: it printed 14 dots and then did not finish within 100 s on this machine (an in-game run is going on, and the file is not touched by this PR). I did not get a result for it, so it is not counted as green.

Red

With main's scripts/smooth-motion.ps1 swapped back (test file kept), the new test fails on all 4 invocations (FAILED (failures=4)). The script was restored afterwards.
Mutations on the PR's script:

  • Removing the return in the help block: 4 failures (killed).
  • Removing the [Alias('?')]: 1 failure, the -? -State on case (killed).

Review

  • The diff is small: a -Help switch with the ? alias, and a usage text printed before Add-Type, so no NVAPI setup is reached. The test stubs Add-Type to throw, so it proves the early return.
  • Claim: the PR cites the claim SMOOTH-MOTION-HELP in issues/2570 (comment 7324541626), which exists and matches the change.
  • The reviewer questions in the thread (add bare -Help and the quoted exe name) were answered by the head commit. The remaining open point is a request for a maintainer to approve the fork workflow runs, not a code question.

Not covered

PowerShell 7 on Windows (no pwsh here); the real NVAPI path and -State on/off were not exercised; test_play_nvidia_menu_choice.py did not complete.

Verdict

PASS (for the changed behaviour; the menu-choice test is an unfinished run unrelated to the diff).

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353862538 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943#issuecomment-7353862538). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:00:57Z. --- RUN (independent run on Windows, head `f9fe7b81fcaf6d8811fa8f3355fa6ddc39a635b4`, merged into `main` `45dc41f95c1cd0dcc29c2c50582e0e9af8a77259` with `git merge --no-ff`) Windows 11, Windows PowerShell 5.1 only (`pwsh` is not installed here, so the PowerShell 7 half of the test did not run). No GPU or game files used. ### Green - `python -I tests/test_smooth_motion_help.py`: 1 test, OK (4 invocations: `-Help`, `-Help -Exe 'a b.exe'`, `-Help -State on`, `-? -State on`). - `python -I tests/test_leonida_launcher.py`: 26 tests, OK. - `python -I scripts/check_no_game_data.py` on the 2 changed files: clean. - `tests/test_play_nvidia_menu_choice.py`: it printed 14 dots and then did not finish within 100 s on this machine (an in-game run is going on, and the file is not touched by this PR). I did not get a result for it, so it is not counted as green. ### Red With main's `scripts/smooth-motion.ps1` swapped back (test file kept), the new test fails on all 4 invocations (`FAILED (failures=4)`). The script was restored afterwards. Mutations on the PR's script: - Removing the `return` in the help block: 4 failures (killed). - Removing the `[Alias('?')]`: 1 failure, the `-? -State on` case (killed). ### Review - The diff is small: a `-Help` switch with the `?` alias, and a usage text printed before `Add-Type`, so no NVAPI setup is reached. The test stubs `Add-Type` to throw, so it proves the early return. - Claim: the PR cites the claim `SMOOTH-MOTION-HELP` in issues/2570 (comment 7324541626), which exists and matches the change. - The reviewer questions in the thread (add bare `-Help` and the quoted exe name) were answered by the head commit. The remaining open point is a request for a maintainer to approve the fork workflow runs, not a code question. ### Not covered PowerShell 7 on Windows (no `pwsh` here); the real NVAPI path and `-State on/off` were not exercised; `test_play_nvidia_menu_choice.py` did not complete. ### Verdict PASS (for the changed behaviour; the menu-choice test is an unfinished run unrelated to the diff). AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
MoonEyes commented 2026-12-02 18:19:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:19:06Z.


Verification of #2943 (third party, Linux x86_64, Python 3.13, no PowerShell, no GPU, no game files)

  • Head verified: f9fe7b81fcaf6d8811fa8f3355fa6ddc39a635b4 (2 files: scripts/smooth-motion.ps1 +10/-1, new
    tests/test_smooth_motion_help.py).
  • Merge base 393901a5b; merged with git merge --no-ff onto main 45dc41f95, no conflict.
  • CI: no check runs on this head. The fork workflows are waiting for maintainer approval (action_required), so
    the required checks have no results.

What was run

Command Result
python -I scripts/check_no_game_data.py scripts/smooth-motion.ps1 tests/test_smooth_motion_help.py exit 0
python -I tests/test_smooth_motion_help.py (merge) OK (skipped=1): neither powershell nor pwsh is on this machine

No red/green here: the test needs PowerShell. merzleckeier's Linux pwsh 7.4 run and the author's
Windows PowerShell 5.1 and 7.6 runs cover red/green. In those runs all four cases reached the Add-Type guard on
main and passed with the PR.

Review of the diff

  • smooth-motion.ps1:12-21: -Help (alias -?) returns before Add-Type, the first NVAPI-related statement.
    That is the cause of the bug, not a workaround. The usage text names -State query|on|off and -Exe, which
    match the param block.
  • The test stubs Add-Type to throw, so a help path that reaches the driver bindings fails with a clear message.
    The four argument sets cover the bare switch, a quoted -Exe, and both spellings combined with -State.
  • Nit (not blocking): a test that skips without PowerShell means Linux CI only proves that it imports. That is
    fine for a Windows script, but the body could say that the Windows CI job is what runs it.

AI disclosure (Codex GPT-6 and a read-only GPT reviewer) and the claim are in the body.

Verdict: ready on review. It is blocked only on CI that a maintainer needs to approve. Not run here:
PowerShell (no shell on this machine).

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354359056 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943#issuecomment-7354359056). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:19:06Z. --- **Verification of #2943 (third party, Linux x86_64, Python 3.13, no PowerShell, no GPU, no game files)** - Head verified: `f9fe7b81fcaf6d8811fa8f3355fa6ddc39a635b4` (2 files: `scripts/smooth-motion.ps1` +10/-1, new `tests/test_smooth_motion_help.py`). - Merge base `393901a5b`; merged with `git merge --no-ff` onto `main` `45dc41f95`, no conflict. - CI: no check runs on this head. The fork workflows are waiting for maintainer approval (`action_required`), so the required checks have no results. **What was run** | Command | Result | |---|---| | `python -I scripts/check_no_game_data.py scripts/smooth-motion.ps1 tests/test_smooth_motion_help.py` | exit 0 | | `python -I tests/test_smooth_motion_help.py` (merge) | `OK (skipped=1)`: neither `powershell` nor `pwsh` is on this machine | No red/green here: the test needs PowerShell. merzleckeier's Linux `pwsh` 7.4 run and the author's Windows PowerShell 5.1 and 7.6 runs cover red/green. In those runs all four cases reached the `Add-Type` guard on `main` and passed with the PR. **Review of the diff** - `smooth-motion.ps1:12-21`: `-Help` (alias `-?`) returns before `Add-Type`, the first NVAPI-related statement. That is the cause of the bug, not a workaround. The usage text names `-State query|on|off` and `-Exe`, which match the `param` block. - The test stubs `Add-Type` to throw, so a help path that reaches the driver bindings fails with a clear message. The four argument sets cover the bare switch, a quoted `-Exe`, and both spellings combined with `-State`. - Nit (not blocking): a test that skips without PowerShell means Linux CI only proves that it imports. That is fine for a Windows script, but the body could say that the Windows CI job is what runs it. AI disclosure (Codex GPT-6 and a read-only GPT reviewer) and the claim are in the body. **Verdict: ready on review.** It is blocked only on CI that a maintainer needs to approve. Not run here: PowerShell (no shell on this machine). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
fiestorra commented 2026-12-03 03:10:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:10:30Z.


VERIFY-2943 — Windows nativo: el control muerde, y el test lo dice con las palabras del problema

Un script y su test:

scripts/smooth-motion.ps1        | 11 +++++++++-
tests/test_smooth_motion_help.py | 34 +++++++++++++++++++++++++++++++

En el head (f9fe7b81f):

pytest tests/test_smooth_motion_help.py   1 passed, 8 subtests passed   (1.8 s)

Control (sintético): if ($Help) { → if ($false) {, que es el mismo script sin la rama nueva:

8 failed, 1 passed
E  AssertionError: 1 != 0 : help reached NVAPI setup

Y el mensaje del test es el diagnóstico entero: «help reached NVAPI setup». El -Help existe para pedir el uso de un script que antes de este cambio cargaba NVAPI para responder — así que preguntar cómo se usa un programa cargaba el driver. Los 8 subtests que fallan son las ocho formas de preguntar (-Help, -?, -h? …), todas llegando al mismo sitio.

Y la forma del cambio es la que quiero ver más: el aviso va antes de cualquier Add-Type, Import-Module o llamada al driver, con return inmediato — no "capturo el error de NVAPI", sino "no llego a NVAPI". Un script de ayuda que necesita el hardware para imprimir tres líneas es un script de ayuda que no funciona en la máquina donde más lo necesitas.

Lo que no probé: el cambio de estado de verdad (-State on|off) — necesita NVAPI y el driver, y el test sólo ejercita la rama de ayuda.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366281482 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2943#issuecomment-7366281482). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:10:30Z. --- ## VERIFY-2943 — Windows nativo: el control muerde, y el test lo dice con las palabras del problema **Un script y su test**: ``` scripts/smooth-motion.ps1 | 11 +++++++++- tests/test_smooth_motion_help.py | 34 +++++++++++++++++++++++++++++++ ``` **En el head (`f9fe7b81f`)**: ``` pytest tests/test_smooth_motion_help.py 1 passed, 8 subtests passed (1.8 s) ``` **Control (sintético)**: **`if ($Help) {` → `if ($false) {`**, **que es el mismo script sin la rama nueva**: ``` 8 failed, 1 passed E AssertionError: 1 != 0 : help reached NVAPI setup ``` **Y el mensaje del test es el diagnóstico entero**: ***«help reached NVAPI setup»***. **El `-Help` existe para pedir el uso de un script que *antes* de este cambio cargaba NVAPI para responder** — **así que preguntar cómo se usa un programa cargaba el driver.** **Los 8 subtests que fallan son las ocho formas de preguntar** (`-Help`, `-?`, `-h`? …), **todas llegando al mismo sitio.** **Y la forma del cambio es la que quiero ver más**: **el aviso va *antes* de cualquier `Add-Type`, `Import-Module` o llamada al driver**, **con `return` inmediato** — **no "capturo el error de NVAPI", sino "no llego a NVAPI".** **Un script de ayuda que necesita el hardware para imprimir tres líneas es un script de ayuda que no funciona en la máquina donde más lo necesitas.** **Lo que no probé**: **el cambio de estado de verdad** (`-State on|off`) — **necesita NVAPI y el driver**, **y el test sólo ejercita la rama de ayuda.** Written with an AI assistant.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2943:upstream-pr/2943'
git switch 'upstream-pr/2943'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2943'
git switch 'upstream-pr/2943'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2943'
git switch 'upstream-pr/2943'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2943'
git switch 'main'
git merge --squash 'upstream-pr/2943'
git switch 'main'
git merge --ff-only 'upstream-pr/2943'
git switch 'main'
git merge 'upstream-pr/2943'
git push origin 'main'
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!2943
No description provided.