PREFLIGHT-TOOL-AVAILABLE-SPACES: parse quoted paths with spaces in make_game.tool_available #482

Merged
xroneyaa merged 1 commit from upstream-pr/482 into main 2026-11-25 21:23:53 +00:00
xroneyaa commented 2026-11-24 06:10:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by xroneyaa on 2026-11-24T06:10:08Z.


Claimed in the coordination issue as: PREFLIGHT-TOOL-AVAILABLE-SPACES

What and why

make_game.tool_available() previously stripped outer quotes and split on whitespace (cmd.split()[0]). When passed a quoted path containing spaces plus arguments (such as "C:\Program Files\Python312\python.exe" -I), it split at the first space (C:\Program) and reported an available tool as missing, failing ToolchainDetectionTest.test_tool_available_command_with_arguments on Windows systems where Python is installed under Program Files.

This reuses tools/mc_command.py's split_command() so quoted paths with spaces and arguments resolve to their executable path, unquoted paths with spaces still resolve via os.path.isfile(), and unmatched quotes return False without raising SystemExit. Added space-in-path and unmatched-quote regression tests in tests/test_make_game_preflight.py.

Tested

  • python -I -m compileall -q make_game.py tests -> exit 0
  • python -I tests/test_make_game_preflight.py -> Ran 100 tests, OK (skipped=1)
  • python -I tests/test_make_game_argparse.py -> Ran 38 tests, OK
  • python -I tests/test_text_write_line_endings.py -> Ran 3 tests, OK
  • python -I scripts/check_no_game_data.py make_game.py tests/test_make_game_preflight.py -> exit 0

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed (n/a — no translator rule added).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5467085454 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/482). Originally posted by [xroneyaa](https://github.com/xroneyaa) on 2026-11-24T06:10:08Z. --- Claimed in the coordination issue as: PREFLIGHT-TOOL-AVAILABLE-SPACES ### What and why `make_game.tool_available()` previously stripped outer quotes and split on whitespace (`cmd.split()[0]`). When passed a quoted path containing spaces plus arguments (such as `"C:\Program Files\Python312\python.exe" -I`), it split at the first space (`C:\Program`) and reported an available tool as missing, failing `ToolchainDetectionTest.test_tool_available_command_with_arguments` on Windows systems where Python is installed under `Program Files`. This reuses `tools/mc_command.py`'s `split_command()` so quoted paths with spaces and arguments resolve to their executable path, unquoted paths with spaces still resolve via `os.path.isfile()`, and unmatched quotes return `False` without raising `SystemExit`. Added space-in-path and unmatched-quote regression tests in `tests/test_make_game_preflight.py`. ### Tested - `python -I -m compileall -q make_game.py tests` -> exit 0 - `python -I tests/test_make_game_preflight.py` -> Ran 100 tests, OK (skipped=1) - `python -I tests/test_make_game_argparse.py` -> Ran 38 tests, OK - `python -I tests/test_text_write_line_endings.py` -> Ran 3 tests, OK - `python -I scripts/check_no_game_data.py make_game.py tests/test_make_game_preflight.py` -> exit 0 GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed (n/a — no translator rule added).
PierreEbele commented 2026-11-24 20:56:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-24T20:56:30Z.


Reviewed 2c03f29: ran tests/test_make_game_preflight.py on the PR (Ran 100 tests, OK (skipped=1)) and copied onto main, where it fails only on the new quoted-path-with-arguments assertion (False on main, True on the PR; the unmatched-quote test passes on both and guards split_command's SystemExit). tests/test_make_game_argparse.py passes on both trees (38 tests, OK (skipped=1)). Differential probes show no regressions: on Linux, single-quoted paths and escaped spaces also flip False -> True while malformed/unclosed-quote inputs flip True -> False (matching split_command), and mocking os.name == "nt" exercises the MSVC path cleanly (native Windows still untested). tests/test_mc_command.py has 2 identical failures on plain main (sandbox /tmp noexec), unrelated to this PR. AI-assisted review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7144261837 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/482#issuecomment-7144261837). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-24T20:56:30Z. --- Reviewed 2c03f29: ran tests/test_make_game_preflight.py on the PR (`Ran 100 tests`, `OK (skipped=1)`) and copied onto main, where it fails only on the new quoted-path-with-arguments assertion (`False` on main, `True` on the PR; the unmatched-quote test passes on both and guards `split_command`'s `SystemExit`). tests/test_make_game_argparse.py passes on both trees (`38 tests`, `OK (skipped=1)`). Differential probes show no regressions: on Linux, single-quoted paths and escaped spaces also flip `False -> True` while malformed/unclosed-quote inputs flip `True -> False` (matching `split_command`), and mocking `os.name == "nt"` exercises the MSVC path cleanly (native Windows still untested). tests/test_mc_command.py has 2 identical failures on plain main (sandbox `/tmp` `noexec`), unrelated to this PR. AI-assisted review.
DeadlyChirp commented 2026-11-25 15:11:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:11:24Z.


Tested on Windows 11, Python 3.12.10 (venv under D:\GTA 6 TEMP\venv, a path with spaces). I merged 2c03f2978 onto upstream main (merge commit eab4a9f99).

  • python -I tests/test_make_game_preflight.py: 100 tests OK (2 skipped). On main, test_tool_available_command_with_arguments fails here with AssertionError: False is not true, because sys.executable has a space.
  • Direct check of make_game.tool_available(...):
command main this PR
"D:\GTA 6 TEMP\venv\Scripts\python.exe" -I False True
"D:\nope dir\x.exe" -I (missing) False False
E:/dev/mamba/llvm/Library/bin/llvm-mc.exe True True

LGTM from the Windows side.

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166445212 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/482#issuecomment-7166445212). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-25T15:11:24Z. --- Tested on Windows 11, Python 3.12.10 (venv under `D:\GTA 6 TEMP\venv`, a path with spaces). I merged 2c03f2978 onto upstream main (merge commit eab4a9f99). - `python -I tests/test_make_game_preflight.py`: 100 tests OK (2 skipped). On main, `test_tool_available_command_with_arguments` fails here with `AssertionError: False is not true`, because `sys.executable` has a space. - Direct check of `make_game.tool_available(...)`: | command | main | this PR | |---|---|---| | `"D:\GTA 6 TEMP\venv\Scripts\python.exe" -I` | False | True | | `"D:\nope dir\x.exe" -I` (missing) | False | False | | `E:/dev/mamba/llvm/Library/bin/llvm-mc.exe` | True | True | LGTM from the Windows side. (AI-assisted test run; output checked by hand.)
aslan2142 commented 2026-11-25 21:23:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T21:23:55Z.


Merged, thanks! The new test fails on main and passes with this.

  • Checked on main 2b78ecb22 + 2c03f2978: the semantic suite passes (491 files, 6,312 tests, 0 files failed); test_make_game_preflight pass; the 15 docs and writer tests pass; check_no_game_data.py is clean on the 2 changed files.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175022800 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/482#issuecomment-7175022800). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T21:23:55Z. --- Merged, thanks! The new test fails on `main` and passes with this. - **Checked on `main` `2b78ecb22` + `2c03f2978`:** the semantic suite passes (491 files, 6,312 tests, 0 files failed); `test_make_game_preflight` pass; the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 2 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
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!482
No description provided.