tests: the mod-pack alias test compares resolved names, as same_report_path does (TEST-MOD-PACK-ALIAS-MACOS) #1412

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

@⁠milk4sale on GitHub · 2026-11-24 23:42 UTC · original
milk4sale:test/mod-pack-alias-resolved-names → main · +6 −2 · 1 files · 1 commits · open

Claimed in the coordination issue as: TEST-MOD-PACK-ALIAS-MACOS (#14)

What and why

tests/test_mod_pack_output_alias.py, added by #1057 (on main since be195981e), fails on macOS and on Windows. test_alias_preflight_precedes_output_truncation ends in AssertionError: ModsError not raised for both of its cases. It passes on Linux.

On macOS this is worse than one red file: the macos-python job stops at the first failing file, so every test file after this one goes unrun there. On Windows the check job is cancelled at its time limit before it lists failed files (#1404), so nobody saw it there either.

The fault is in the test, not in the tool. The test replaces os.path.samefile with a function that compares the two paths as tempfile spelled them. report_paths.same_report_path hands samefile the names os.path.realpath gave it, and those are spelled differently where the temporary folder is reached through a link or a short name:

tempfile.gettempdir() os.path.realpath of it
macOS runner /var/folders/…/T /private/var/folders/…/T
Windows runner C:\Users\RUNNER~1\AppData\Local\Temp C:\Users\runneradmin\AppData\Local\Temp
Linux runner /tmp /tmp

So the stand-in never recognises the pair, and pack_mod goes on to write the package. The stand-in now compares resolved names. tools/leonida_mods.py and tools/report_paths.py are right and unchanged; the claim's title says macOS because that is where I first saw it.

Tested

Measured with Python 3.12 on GitHub's runners, from a scratch branch on my fork whose workflow ran only this (run 45511999132):

python -I tests/test_mod_pack_output_alias.py macos-26 windows-latest ubuntu-24.04
the file as on main FAILED (failures=2) FAILED (failures=2) OK
with this change OK OK OK

The two failures are ModsError not raised for relative='mod.json' and relative='nested/notes.txt', the same as in the macos-python job of a run of main 3a0af1f15 (run 45510568820).

Locally, on Linux with Python 3.14.10:

  • python -I tests/test_mod_pack_output_alias.py: 3 tests pass, before and after.
  • Control: with TMPDIR pointing through a symbolic link, main's file fails with the same two failures and this one passes.
  • python -I scripts/check_no_game_data.py tests/test_mod_pack_output_alias.py and git diff --check.

GPUs tested: n/a (one Python test file)

AI-assisted: yes (Claude Code)

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. (No translator change.)

🤖 Generated with Claude Code

**@⁠milk4sale** on GitHub · 2026-11-24 23:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1412) `milk4sale:test/mod-pack-alias-resolved-names` → `main` · +6 −2 · 1 files · 1 commits · open Claimed in the coordination issue as: TEST-MOD-PACK-ALIAS-MACOS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why `tests/test_mod_pack_output_alias.py`, added by #1057 (on `main` since `be195981e`), fails on macOS and on Windows. `test_alias_preflight_precedes_output_truncation` ends in `AssertionError: ModsError not raised` for both of its cases. It passes on Linux. On macOS this is worse than one red file: the `macos-python` job stops at the first failing file, so every test file after this one goes unrun there. On Windows the `check` job is cancelled at its time limit before it lists failed files (#1404), so nobody saw it there either. The fault is in the test, not in the tool. The test replaces `os.path.samefile` with a function that compares the two paths as `tempfile` spelled them. `report_paths.same_report_path` hands `samefile` the names `os.path.realpath` gave it, and those are spelled differently where the temporary folder is reached through a link or a short name: | | `tempfile.gettempdir()` | `os.path.realpath` of it | |---|---|---| | macOS runner | `/var/folders/…/T` | `/private/var/folders/…/T` | | Windows runner | `C:\Users\RUNNER~1\AppData\Local\Temp` | `C:\Users\runneradmin\AppData\Local\Temp` | | Linux runner | `/tmp` | `/tmp` | So the stand-in never recognises the pair, and `pack_mod` goes on to write the package. The stand-in now compares resolved names. `tools/leonida_mods.py` and `tools/report_paths.py` are right and unchanged; the claim's title says macOS because that is where I first saw it. ### Tested Measured with Python 3.12 on GitHub's runners, from a scratch branch on my fork whose workflow ran only this ([run 45511999132](https://github.com/milk4sale/leonida/actions/runs/45511999132)): | `python -I tests/test_mod_pack_output_alias.py` | `macos-26` | `windows-latest` | `ubuntu-24.04` | |---|---|---|---| | the file as on `main` | FAILED (failures=2) | FAILED (failures=2) | OK | | with this change | OK | OK | OK | The two failures are `ModsError not raised` for `relative='mod.json'` and `relative='nested/notes.txt'`, the same as in the `macos-python` job of a run of `main` `3a0af1f15` ([run 45510568820](https://github.com/milk4sale/leonida/actions/runs/45510568820)). Locally, on Linux with Python 3.14.10: - `python -I tests/test_mod_pack_output_alias.py`: 3 tests pass, before and after. - Control: with `TMPDIR` pointing through a symbolic link, `main`'s file fails with the same two failures and this one passes. - `python -I scripts/check_no_game_data.py tests/test_mod_pack_output_alias.py` and `git diff --check`. GPUs tested: n/a (one Python test file) AI-assisted: yes (Claude Code) ### 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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator change.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tests/test_mod_pack_output_alias.py, added by #1057, fails on macOS and on Windows:
test_alias_preflight_precedes_output_truncation ends in "AssertionError: ModsError not raised" for both of its
cases. It passes on Linux. The macos-python job stops at the first failing file, so on macOS every test file
after this one went unrun.

The test replaces os.path.samefile with a function that compares the two paths as tempfile spelled them.
report_paths.same_report_path hands samefile the names os.path.realpath gave it, and those are spelled
differently where the temporary folder is reached through a link or a short name: /var/folders/... is
/private/var/folders/... on macOS, and C:\Users\RUNNER~1\... is C:\Users\runneradmin\... on a Windows runner. The
stand-in then never recognises the pair, and pack_mod writes the package.

The stand-in now compares resolved names. tools/leonida_mods.py and tools/report_paths.py are right and unchanged.

Measured with Python 3.12 on GitHub's runners (a scratch branch on a fork): the file as on main fails on macos-26
and windows-latest with those two failures and passes on ubuntu-24.04; with this change it passes on all three.
Control on Linux: with TMPDIR pointing through a symbolic link, main's file fails the same way and this one passes.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:50:30 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 09:31 UTC · original

Reviewed 09970b7: test-only fix; ran the file with python -I in the sandbox on main, on this head,
and with this head's file copied onto main's tree. Reproduced the reported macOS/Windows flake on
Linux via TMPDIR through a symlink: main fails both cases with AssertionError: ModsError not raised, this head passes everywhere; mechanism confirmed (same_report_path realpaths before
samefile). No findings — tools/ are indeed unchanged. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 09:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1412#issuecomment-7158453170) Reviewed 09970b7: test-only fix; ran the file with `python -I` in the sandbox on main, on this head, and with this head's file copied onto main's tree. Reproduced the reported macOS/Windows flake on Linux via TMPDIR through a symlink: main fails both cases with `AssertionError: ModsError not raised`, this head passes everywhere; mechanism confirmed (`same_report_path` realpaths before `samefile`). No findings — `tools/` are indeed unchanged. AI-assisted review. **Recommendation:** Merge
Author
Owner

@⁠OguzSoykan on GitHub · 2026-11-25 20:14 UTC · original

Verified on native Windows at head 09970b753: tests/test_mod_pack_output_alias.py fails on main (ModsError not raised, both subtests: the mocked samefile compared the 8.3 name with the realpath'd one) and passes here (OK).

Native Windows 10 Pro 19045, CPython 3.12, py -3.12 -I, checkout under a non-ASCII profile path (C:\Users\Oğuz\..., TEMP is the 8.3 alias C:\Users\OUZ~1\...). No game files.

AI-assisted (Claude Code).

**@⁠OguzSoykan** on GitHub · 2026-11-25 20:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1412#issuecomment-7173376483) Verified on native Windows at head `09970b753`: `tests/test_mod_pack_output_alias.py` fails on `main` (`ModsError not raised`, both subtests: the mocked `samefile` compared the 8.3 name with the realpath'd one) and passes here (OK). Native Windows 10 Pro 19045, CPython 3.12, `py -3.12 -I`, checkout under a non-ASCII profile path (`C:\Users\Oğuz\...`, TEMP is the 8.3 alias `C:\Users\OUZ~1\...`). No game files. AI-assisted (Claude Code).
Author
Owner

@⁠kevincommits on GitHub · 2026-11-26 05:18 UTC · original

Independent run on macOS. Apple M5 Pro, macOS 27.2.1 (26B131), Python 3.14.2. I merged main at a73a57e13 into the branch locally (852 commits behind, no conflicts). Head tested: 09970b753.

With this change the standalone suite is fully green on this Mac for the first time: 513 run, 513 pass.

tree python -I tests/test_mod_pack_output_alias.py full standalone suite
main at a73a57e13 3 run, 2 failures (AssertionError: ModsError not raised, both subtests of test_alias_preflight_precedes_output_truncation) 513 run, 512 pass
this branch merged with main 3 run, 3 pass 513 run, 513 pass

The cause on this machine is the one the description gives: tempfile hands out /var/folders/..., realpath turns that into /private/var/folders/..., and the test's fake samefile compared the unresolved spellings. I have been running the full suite on main about once an hour tonight while reviewing the x64_recomp PRs, and this file has failed in every run; for the last several runs (since test_image_load_typed was fixed on main) it has been the only failure.

Not tested: Windows and Linux. No game files used. AI-assisted.

**@⁠kevincommits** on GitHub · 2026-11-26 05:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1412#issuecomment-7183368234) Independent run on macOS. Apple M5 Pro, macOS 27.2.1 (26B131), Python 3.14.2. I merged `main` at `a73a57e13` into the branch locally (852 commits behind, no conflicts). Head tested: `09970b753`. **With this change the standalone suite is fully green on this Mac for the first time: 513 run, 513 pass.** | tree | `python -I tests/test_mod_pack_output_alias.py` | full standalone suite | |---|---|---| | `main` at `a73a57e13` | 3 run, 2 failures (`AssertionError: ModsError not raised`, both subtests of `test_alias_preflight_precedes_output_truncation`) | 513 run, 512 pass | | this branch merged with `main` | 3 run, 3 pass | 513 run, 513 pass | The cause on this machine is the one the description gives: `tempfile` hands out `/var/folders/...`, `realpath` turns that into `/private/var/folders/...`, and the test's fake `samefile` compared the unresolved spellings. I have been running the full suite on `main` about once an hour tonight while reviewing the x64_recomp PRs, and this file has failed in every run; for the last several runs (since `test_image_load_typed` was fixed on `main`) it has been the only failure. Not tested: Windows and Linux. No game files used. AI-assisted.
Author
Owner

@⁠wavehs on GitHub · 2026-11-26 18:17 UTC · original

Verified independently on main bd6ba97ab (macOS 27.2.1 arm64, Python 3.15.2, no numpy): the diff applies cleanly, and with it python3 -I tests/test_mod_pack_output_alias.py gives Ran 3 tests ... OK. On unmodified main the same file gives the two ModsError not raised failures for relative='mod.json' and relative='nested/notes.txt'. With the same_report_path preflight removed from pack_mod, the fixed test fails again (4 failures), so the negative control still holds.

Note: #2175 (opened later) is the same fix for the same file. This one is earlier and also covers the Windows short-name spelling (RUNNER~1 vs runneradmin) with runner measurements, so it is the one I would land; I left a duplicate note on #2175.

AI-assisted (verification only).

**@⁠wavehs** on GitHub · 2026-11-26 18:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1412#issuecomment-7200274417) Verified independently on `main` `bd6ba97ab` (macOS 27.2.1 arm64, Python 3.15.2, no numpy): the diff applies cleanly, and with it `python3 -I tests/test_mod_pack_output_alias.py` gives `Ran 3 tests ... OK`. On unmodified main the same file gives the two `ModsError not raised` failures for `relative='mod.json'` and `relative='nested/notes.txt'`. With the `same_report_path` preflight removed from `pack_mod`, the fixed test fails again (4 failures), so the negative control still holds. Note: #2175 (opened later) is the same fix for the same file. This one is earlier and also covers the Windows short-name spelling (`RUNNER~1` vs `runneradmin`) with runner measurements, so it is the one I would land; I left a duplicate note on #2175. AI-assisted (verification only).
Author
Owner

@⁠Tauwni on GitHub · 2026-11-26 23:51 UTC · original

Confirmed on an Apple M3 (macOS 26.5.1, Python 3.15.2): tests/test_mod_pack_output_alias.py fails twice on main (/var vs /private/var) and passes on this head. I'm closing my #2175, which is the same fix opened later, in favour of this one.

AI-assisted (Claude Code). No game data.

**@⁠Tauwni** on GitHub · 2026-11-26 23:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1412#issuecomment-7205928287) Confirmed on an Apple M3 (macOS 26.5.1, Python 3.15.2): `tests/test_mod_pack_output_alias.py` fails twice on `main` (`/var` vs `/private/var`) and passes on this head. I'm closing my #2175, which is the same fix opened later, in favour of this one. AI-assisted (Claude Code). No game data.
Author
Owner

@⁠Andretuta on GitHub · 2026-11-27 06:24 UTC · original

I reproduced this on native Windows by putting TEMP and TMP behind an NTFS junction. On main d1dff7949 the suite passed with a direct temp path, then failed both alias preflight cases through the junction. With 09970b753 in the local integration, all three tests passed through the same junction.

AI-assisted testing.

**@⁠Andretuta** on GitHub · 2026-11-27 06:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1412#issuecomment-7211502790) I reproduced this on native Windows by putting `TEMP` and `TMP` behind an NTFS junction. On `main` `d1dff7949` the suite passed with a direct temp path, then failed both alias preflight cases through the junction. With `09970b753` in the local integration, all three tests passed through the same junction. AI-assisted testing.
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/1412/head:github-bot/gh-1412'
git switch 'github-bot/gh-1412'

Merge

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