tests: the mod-pack alias test compares resolved names, as same_report_path does (TEST-MOD-PACK-ALIAS-MACOS) #1412
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1412"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by milk4sale on 2026-11-24T23:42:11Z.
Claimed in the coordination issue as: TEST-MOD-PACK-ALIAS-MACOS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7147669112)
What and why
tests/test_mod_pack_output_alias.py, added by #1057 (onmainsincebe195981e), fails on macOS and on Windows.test_alias_preflight_precedes_output_truncationends inAssertionError: ModsError not raisedfor both of its cases. It passes on Linux.On macOS this is worse than one red file: the
macos-pythonjob stops at the first failing file, so every test file after this one goes unrun there. On Windows thecheckjob 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.samefilewith a function that compares the two paths astempfilespelled them.report_paths.same_report_pathhandssamefilethe namesos.path.realpathgave it, and those are spelled differently where the temporary folder is reached through a link or a short name:tempfile.gettempdir()os.path.realpathof it/var/folders/…/T/private/var/folders/…/TC:\Users\RUNNER~1\AppData\Local\TempC:\Users\runneradmin\AppData\Local\Temp/tmp/tmpSo the stand-in never recognises the pair, and
pack_modgoes on to write the package. The stand-in now compares resolved names.tools/leonida_mods.pyandtools/report_paths.pyare 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.pymacos-26windows-latestubuntu-24.04mainThe two failures are
ModsError not raisedforrelative='mod.json'andrelative='nested/notes.txt', the same as in themacos-pythonjob of a run ofmain3a0af1f15(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.TMPDIRpointing 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.pyandgit diff --check.GPUs tested: n/a (one Python test file)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T09:31:48Z.
Reviewed
09970b7: test-only fix; ran the file withpython -Iin 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_pathrealpaths beforesamefile). No findings —tools/are indeed unchanged. AI-assisted review.Recommendation: Merge
Imported from ubiquitarianism/leonida. Originally posted by OguzSoykan on 2026-11-25T20:14:15Z.
Verified on native Windows at head
09970b753:tests/test_mod_pack_output_alias.pyfails onmain(ModsError not raised, both subtests: the mockedsamefilecompared 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 aliasC:\Users\OUZ~1\...). No game files.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by kevincommits on 2026-11-26T05:18:26Z.
Independent run on macOS. Apple M5 Pro, macOS 27.2.1 (26B131), Python 3.14.2. I merged
mainata73a57e13into 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.
python -I tests/test_mod_pack_output_alias.pymainata73a57e13AssertionError: ModsError not raised, both subtests oftest_alias_preflight_precedes_output_truncation)mainThe cause on this machine is the one the description gives:
tempfilehands out/var/folders/...,realpathturns that into/private/var/folders/..., and the test's fakesamefilecompared the unresolved spellings. I have been running the full suite onmainabout once an hour tonight while reviewing the x64_recomp PRs, and this file has failed in every run; for the last several runs (sincetest_image_load_typedwas fixed onmain) it has been the only failure.Not tested: Windows and Linux. No game files used. AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:17:05Z.
Verified independently on
mainbd6ba97ab(macOS 27.2.1 arm64, Python 3.15.2, no numpy): the diff applies cleanly, and with itpython3 -I tests/test_mod_pack_output_alias.pygivesRan 3 tests ... OK. On unmodified main the same file gives the twoModsError not raisedfailures forrelative='mod.json'andrelative='nested/notes.txt'. With thesame_report_pathpreflight removed frompack_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~1vsrunneradmin) with runner measurements, so it is the one I would land; I left a duplicate note on #2175.AI-assisted (verification only).
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T23:51:29Z.
Confirmed on an Apple M3 (macOS 26.5.1, Python 3.15.2):
tests/test_mod_pack_output_alias.pyfails twice onmain(/varvs/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.
Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-27T06:24:44Z.
I reproduced this on native Windows by putting
TEMPandTMPbehind an NTFS junction. Onmaind1dff7949the suite passed with a direct temp path, then failed both alias preflight cases through the junction. With09970b753in the local integration, all three tests passed through the same junction.AI-assisted testing.