tests: cover partial Windows known-folder results (TEST-WINDOWS-KNOWN-FOLDERS) #835

Open
github-bot wants to merge 1 commit from github-bot/gh-835 into main AGit
Owner

@⁠TheGeogeo on GitHub · 2026-11-24 14:22 UTC · original
TheGeogeo:test/windows-known-folders-partial → main · +23 −1 · 1 files · 1 commits · open

Claimed in the coordination issue as: TEST-WINDOWS-KNOWN-FOLDERS

What and why

known_folders() can return partial results. The live test expected all three paths and failed when the restricted Windows shell returned two. Allow the documented result count, retain the live absolute-path and repeat-call checks, and add a mock shell test that verifies partial results and buffer cleanup.

This test-only change carries forward my earlier ProjectLeonida/Leonida PR #10060, rechecked against this repository's main.

Tested

After a rebase on main 56bdd7e8 (56d42dab, same patch as 528dc900), on Windows 11, Python 3.12.4: tests/test_make_game_preflight.py 110 run, OK (1 skipped), also from a venv whose path has a space; tests/test_make_game_pipeline_preflight.py 23 run, OK (1 skipped); test_tool_stdout_encoding.py, test_docs_cli_flags.py, test_text_write_line_endings.py, test_ctest_registration.py and test_ci_registration.py OK; git diff --check and the no-game-data check clean.

  • Windows, Python 3.12.4. The focused GameDiscoveryTest.test_known_folders_from_the_shell failed on main at d0da7dad with 2 != 3 in the restricted session.
  • python -I -B tests/test_make_game_preflight.py on this branch: 98 passed and 1 skipped in both the restricted and normal Windows sessions. The skipped test requires a case-sensitive filesystem.
  • python -I -B tests/test_make_game_pipeline_preflight.py: 19 passed and 1 skipped. The skipped test requires POSIX execute permissions.
  • git diff --check and python -I -B scripts/check_no_game_data.py tests/test_make_game_preflight.py: passed.

GPUs tested: n/a. CPU-only tests.

AI-assisted: Yes, Codex.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys, or decryption.
  • Translator contract entry: not applicable.
**@⁠TheGeogeo** on GitHub · 2026-11-24 14:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/835) `TheGeogeo:test/windows-known-folders-partial` → `main` · +23 −1 · 1 files · 1 commits · open Claimed in the coordination issue as: [TEST-WINDOWS-KNOWN-FOLDERS](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why `known_folders()` can return partial results. The live test expected all three paths and failed when the restricted Windows shell returned two. Allow the documented result count, retain the live absolute-path and repeat-call checks, and add a mock shell test that verifies partial results and buffer cleanup. This test-only change carries forward my earlier `ProjectLeonida/Leonida` PR #10060, rechecked against this repository's `main`. ### Tested After a rebase on `main` `56bdd7e8` (`56d42dab`, same patch as `528dc900`), on Windows 11, Python 3.12.4: `tests/test_make_game_preflight.py` 110 run, OK (1 skipped), also from a venv whose path has a space; `tests/test_make_game_pipeline_preflight.py` 23 run, OK (1 skipped); `test_tool_stdout_encoding.py`, `test_docs_cli_flags.py`, `test_text_write_line_endings.py`, `test_ctest_registration.py` and `test_ci_registration.py` OK; `git diff --check` and the no-game-data check clean. - Windows, Python 3.12.4. The focused `GameDiscoveryTest.test_known_folders_from_the_shell` failed on `main` at `d0da7dad` with `2 != 3` in the restricted session. - `python -I -B tests/test_make_game_preflight.py` on this branch: 98 passed and 1 skipped in both the restricted and normal Windows sessions. The skipped test requires a case-sensitive filesystem. - `python -I -B tests/test_make_game_pipeline_preflight.py`: 19 passed and 1 skipped. The skipped test requires POSIX execute permissions. - `git diff --check` and `python -I -B scripts/check_no_game_data.py tests/test_make_game_preflight.py`: passed. GPUs tested: n/a. CPU-only tests. AI-assisted: Yes, Codex. ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys, or decryption. - Translator contract entry: not applicable.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:23:45 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:25 UTC · original · approved these changes

Clean-Room Peer Review for PR #835 (tests: cover partial Windows known-folder results)

Robust test hardening for Windows enterprise/redirected profile environments:

  • Resilience to Incomplete Profiles:
    • est_known_folders_from_the_shell now uses ssertLessEqual, accommodating systems where specific Windows known folders (e.g., OneDrive-redirected or roaming user profiles) are unavailable.
  • Mocked Failure Coverage:
    • Adds est_known_folders_keeps_available_paths_when_a_lookup_fails using ctypes mocks of shell32.SHGetKnownFolderPath and ole32.CoTaskMemFree.
    • Proves that make_game.known_folders() retains valid folder paths when an individual lookup returns a non-zero error, and strictly confirms CoTaskMemFree is invoked for allocated buffers.
  • Clean-room verification:
    • Standard library only (ctypes, unittest.mock), fast execution, zero external assets.

LGTM! Verified and approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/835#pullrequestreview-6040997912) · **approved these changes** ### Clean-Room Peer Review for PR #835 (tests: cover partial Windows known-folder results) Robust test hardening for Windows enterprise/redirected profile environments: - **Resilience to Incomplete Profiles**: - est_known_folders_from_the_shell now uses ssertLessEqual, accommodating systems where specific Windows known folders (e.g., OneDrive-redirected or roaming user profiles) are unavailable. - **Mocked Failure Coverage**: - Adds est_known_folders_keeps_available_paths_when_a_lookup_fails using ctypes mocks of shell32.SHGetKnownFolderPath and ole32.CoTaskMemFree. - Proves that make_game.known_folders() retains valid folder paths when an individual lookup returns a non-zero error, and strictly confirms CoTaskMemFree is invoked for allocated buffers. - **Clean-room verification**: - Standard library only (ctypes, unittest.mock), fast execution, zero external assets. LGTM! Verified and approved.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:28 UTC · original · approved these changes

Clean-room verified (zero game data). Comprehensive test coverage for partial Windows SHGetKnownFolderPath results ensuring CoTaskMemFree is called and successful paths are retained in make_game.known_folders().

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/835#pullrequestreview-6041046195) · **approved these changes** Clean-room verified (zero game data). Comprehensive test coverage for partial Windows SHGetKnownFolderPath results ensuring CoTaskMemFree is called and successful paths are retained in make_game.known_folders().
Author
Owner

@⁠TheGeogeo on GitHub · 2026-11-24 21:22 UTC · original

Rebased on main 6293c1c4: 6d329f1d -> 528dc900, same patch (git range-diff). The previous base failed tests/test_tool_stdout_encoding.py, which #948 fixed on main, and the earlier CI run never started (action_required).

  • Windows 11, Python 3.12.4, after the rebase: tests/test_make_game_preflight.py 99 run, OK (1 skipped); test_tool_stdout_encoding.py, test_docs_cli_flags.py and test_text_write_line_endings.py OK; git diff --check and the no-game-data check clean.
  • The approvals here were made before the rebase, on 6d329f1d.

No code change in this rebase. CI on the new head is still queued.

AI-assisted: yes (Claude Code).

**@⁠TheGeogeo** on GitHub · 2026-11-24 21:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/835#issuecomment-7144840057) Rebased on `main` `6293c1c4`: `6d329f1d` -> `528dc900`, same patch (`git range-diff`). The previous base failed `tests/test_tool_stdout_encoding.py`, which #948 fixed on `main`, and the earlier CI run never started (action_required). - Windows 11, Python 3.12.4, after the rebase: `tests/test_make_game_preflight.py` 99 run, OK (1 skipped); `test_tool_stdout_encoding.py`, `test_docs_cli_flags.py` and `test_text_write_line_endings.py` OK; `git diff --check` and the no-game-data check clean. - The approvals here were made before the rebase, on `6d329f1d`. No code change in this rebase. CI on the new head is still queued. AI-assisted: yes (Claude Code).
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-25 15:23 UTC · original

Tested on Windows 11, Python 3.12.10, with this PR merged onto upstream main b0f3d3998 (merge commit 151e2066e).

python -I tests/test_make_game_preflight.py:

  • PR: 99 tests, 1 failure. The new test passes.
  • main: 98 tests, 1 failure.
  • The one failure is the same on both: test_tool_available_command_with_arguments (AssertionError: False is not true). It fails because this venv's path has a space, which #482 fixes. It is not related to this PR.

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

**@⁠DeadlyChirp** on GitHub · 2026-11-25 15:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/835#issuecomment-7166777889) Tested on Windows 11, Python 3.12.10, with this PR merged onto upstream main b0f3d3998 (merge commit 151e2066e). `python -I tests/test_make_game_preflight.py`: - PR: 99 tests, 1 failure. The new test passes. - main: 98 tests, 1 failure. - The one failure is the same on both: `test_tool_available_command_with_arguments` (`AssertionError: False is not true`). It fails because this venv's path has a space, which #482 fixes. It is not related to this PR. (AI-assisted test run; output checked by hand.)
github-bot force-pushed github-bot/gh-835 from 528dc900cc to 56d42dabe8 2026-11-26 16:23:29 +00:00 Compare
Author
Owner

@⁠TheGeogeo on GitHub · 2026-11-26 16:19 UTC · original

Thanks for the run. The failing test, test_tool_available_command_with_arguments, comes from the venv path with a space, as you said, and #482 fixed it on main (merged after your run, 7b523287).

Windows 11, Python 3.12.4, with a venv in a folder whose name has a space, python -I -B tests/test_make_game_preflight.py:

  • this PR merged with main b0f3d399 (your base): 99 run, the same failure;
  • this PR merged with main 24679161: 110 run, OK (skipped=1).

The merge with main is clean and the head (528dc900) is unchanged.

AI-assisted: yes (Claude Code).

**@⁠TheGeogeo** on GitHub · 2026-11-26 16:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/835#issuecomment-7197484011) Thanks for the [run](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/835). The failing test, `test_tool_available_command_with_arguments`, comes from the venv path with a space, as you said, and #482 fixed it on `main` (merged after your run, `7b523287`). Windows 11, Python 3.12.4, with a venv in a folder whose name has a space, `python -I -B tests/test_make_game_preflight.py`: - this PR merged with `main` `b0f3d399` (your base): 99 run, the same failure; - this PR merged with `main` `24679161`: 110 run, `OK (skipped=1)`. The merge with `main` is clean and the head (`528dc900`) is unchanged. AI-assisted: yes (Claude Code).
Author
Owner

@⁠TheGeogeo on GitHub · 2026-11-26 16:22 UTC · original

Rebased from 528dc900 to 56d42dab on main 56bdd7e8, same patch (git range-diff), so the branch now includes #482.

Windows 11, Python 3.12.4, on the new head:

  • tests/test_make_game_preflight.py: 110 run, OK (skipped=1), both from the usual interpreter and from a venv whose path has a space (the case from the run above).
  • tests/test_make_game_pipeline_preflight.py: 23 run, OK (skipped=1).
  • test_tool_stdout_encoding.py 4, test_docs_cli_flags.py 4, test_text_write_line_endings.py 3, test_ctest_registration.py 6 and test_ci_registration.py 16: OK.
  • git diff --check, the no-game-data check and compileall: clean.

No code change in this rebase. The description's Tested section is updated.

AI-assisted: yes (Claude Code).

**@⁠TheGeogeo** on GitHub · 2026-11-26 16:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/835#issuecomment-7197563872) Rebased from `528dc900` to `56d42dab` on `main` `56bdd7e8`, same patch (`git range-diff`), so the branch now includes #482. Windows 11, Python 3.12.4, on the new head: - `tests/test_make_game_preflight.py`: 110 run, `OK (skipped=1)`, both from the usual interpreter and from a venv whose path has a space (the case from the run above). - `tests/test_make_game_pipeline_preflight.py`: 23 run, `OK (skipped=1)`. - `test_tool_stdout_encoding.py` 4, `test_docs_cli_flags.py` 4, `test_text_write_line_endings.py` 3, `test_ctest_registration.py` 6 and `test_ci_registration.py` 16: OK. - `git diff --check`, the no-game-data check and `compileall`: clean. No code change in this rebase. The description's Tested section is updated. AI-assisted: yes (Claude Code).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/835/head:github-bot/gh-835'
git switch 'github-bot/gh-835'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-835'
git switch 'github-bot/gh-835'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-835'
git switch 'github-bot/gh-835'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-835'
git switch 'main'
git merge --squash 'github-bot/gh-835'
git switch 'main'
git merge --ff-only 'github-bot/gh-835'
git switch 'main'
git merge 'github-bot/gh-835'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.