manifest: exclude a manifest spelled with another case (carry of #1441) #3087
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3087"
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 MoonEyes on 2026-12-02T10:29:43Z.
Claimed in the coordination issue as: MANIFEST-WALK-CASE-EXCLUDE, claimed by the original author of #1441 (Dashhhhhhhh) at https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7148360501 (marked done -> #1441 at https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7148376289).
What and why
Carry of #1441 (Dashhhhhhhh), unchanged since 2026-11-25 (last commit
21227adbd; no author push or comment after that). Branch =main(a917c54d6) + the author's head with its commit kept + a merge commit with one conflict resolution. I added no commits of my own.tools/manifest.pyexcluded the manifest from the scan withnormcase(realpath()), which keeps the typed case on macOS, soGame/Manifest.jsonandgame/manifest.jsonstayed apart: the nextcreatehashed the manifest as an input andverifylisted it as new. The change compares through the sharedreport_paths.path_keyinwalk()and in a new_inside()helper used bycreate(), so a case-variant spelling is excluded from the scan and a hashed file under another spelling is still refused. Three tests are added totests/test_manifest.py.Conflict:
mainaddedfrom file_mode import published_modeat the same place the PR changed thereport_pathsimport. I kept both lines (published_modeandpath_key, same_report_path); nothing else conflicted.Review on #1441: two approvals (tiguan26, aslan2142) and test comments; no defect was raised, so there is no review-fix commit. MoonEyes asked "which case fails without the fix?": on Windows none does, see Tested. zmasi's non-blocking note (a Linux case-folding mount such as vfat/exFAT/CIFS is not detected by
report_paths.case_insensitive_volume) concerns that shared helper, not this change, and is left out of this carry.Tested
Windows 11, no GPU, no game files, on
maina917c54d6plus this branch.python -I tests/test_manifest.py: Ran 43 tests, OK (skipped=1).main'stools/manifest.pyback (git show origin/main:tools/manifest.py) and reran: Ran 43 tests, OK (skipped=1). There is no native red on Windows, as already reported on #1441:normcase(realpath())already folds case on NTFS.sys.platform = "darwin",os.pathconfreturning 0 (case-insensitive),os.path.normcaseset toposixpath.normcaseand a case-preservingos.path.realpath. Withmain'stools/manifest.py: FAILED (failures=1, errors=1 of 3):test_walk_excludes_another_case_of_the_manifestfails andtest_create_replaces_a_manifest_under_another_case_and_verify_ignores_iterrors. With this branch: 3 tests OK. This simulates macOS behaviour on NTFS; it is not a run on a Mac.tools/manifest.pywithgit checkout; the working tree is clean.python -I scripts/check_no_game_data.py tools/manifest.py tests/test_manifest.py: clean.git merge-base --is-ancestorof the author's head (21227adbd) and this branch's HEAD succeeds.Not run: the full suite, CI.
GPUs tested: n/a (unit tests only)
AI-assisted: yes. Models: Claude Opus 5.5 in Claude Code (carry, conflict resolution, fixes, tests); separate read-only reviewer agent: Claude Opus 5.5.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator rule.)Supersedes #1441 once merged; the original stays open until a maintainer decides.
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T12:29:56Z.
RUN (independent run on Windows, #3087 head
c83bf63a8, merged locally intomain9b4d71899withgit merge --no-ff, no conflicts. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)21227adbd(Dashhhhhhhh) is an ancestor of the head through the merge6e7f8d303, under its author's name.main'sfrom file_mode import published_modestays next to the pull request'sfrom report_paths import path_key, same_report_path.python -I tests/test_manifest.py -v: main 40 tests OK (1 skipped); merge 43 tests OK (the same skip, "backslashes are path separators on Windows").python -m pyteston the 7 test files that usetools/manifest.py: main 193 passed / 4 skipped; merge 196 passed / 4 skipped.main'stools/manifest.py, the pull request's 43 tests pass, becausenormcase(realpath())already folds case on NTFS.tests/test_manifest.pywithsys.platformset to"darwin",os.pathconfreturning 0 (case-insensitive volume),os.path.normcaseset toposixpath.normcaseandos.path.realpathset toabspath:main's tool: 1 failure and 1 error.test_walk_excludes_another_case_of_the_manifestfindsManifest.jsonin the scan.test_create_replaces_a_manifest_under_another_case_and_verify_ignores_iterrors with "--out would overwrite the input", because the old manifest is hashed as an input. This matches the body's simulated red.tools/manifest.py, each run with the whole test file and the simulation, and restored afterwards (git statusclean):walk()exclusion back tonormcase(realpath()): survives on Windows, killed in the simulation (the same failure and error asmain)._inside()back tonormcase(realpath()): survives on Windows, killed in the simulation (test_create_refuses_another_case_of_a_hashed_file)._inside()always False: killed on Windows (test_create_cannot_overwrite_a_file_it_hashesand the new refusal test) and in the simulation.walk()exclusion removed: killed on Windows (3 tests) and in the simulation._inside()prefix without the separator: survives both. A sibling folder whose name starts with the scanned folder's name would count as inside, which is an over-refusal, not a loss of data.Not covered here: a real macOS volume (the red above is a simulation on NTFS), and Linux case-folding mounts (zmasi's note on #1441 is about
report_paths.case_insensitive_volume, outside this change).Verdict: PASS. The change does what the body says. In the macOS simulation, the pull request's own tests fail with
main's tool for the stated reasons and pass with the merge's, and they catch both case mutations there. On Windows nothing regresses, and the author's commit is kept. A real APFS run would still be welcome.Machine: Windows 11 Pro 26300 (NTFS), i9-13900K, 64 GB, CPython 3.13.12 (CI uses 3.12); unit tests only, no GPU or game files used.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:46:44Z.
Merging. Head
c83bf63a8merges cleanly withmain23a51c494and does not force a rebase of #2566. Moon's own pull request, merged on green CI at his instruction. An independent read-only check by a separate agent on headc83bf63a8found every CI check green including no-game-data, no conflict with current main, no open review or unanswered question, and for a carry the original author's commits kept as ancestors. Merged by MoonEyes.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T12:55:26Z.
Ran natively on Windows 11, Python 3.13, head
c83bf63a8merged into currentmain(23a51c494, no conflicts).py -3.13 -I tests/test_manifest.py: 43 tests OK (skipped=1), same as already reported. I didn't repeat the macOS simulation; two Windows things the existing runs don't cover:1. A case-sensitive NTFS folder: a real input named like the manifest in another case is still left out of the hash list.
NTFS can turn case sensitivity on per folder (
fsutil file setCaseSensitiveInfo <dir> enable, no admin; folders created from WSL get it by default). In such a folderManifest.jsonandmanifest.jsonare two files, butpath_keyfolds them becausentpath.normcaselowercases unconditionally:main's tool does exactly the same (normcase(name) == normcase(excluded)also folds), so this is not a regression, just a case the new helper doesn't fix either. The shared module already knows about it: in that folderreport_paths.same_report_path("Manifest.json", "manifest.json")returnsFalsewhilepath_key(...)compares equal. Skipping a file only when it really is the--outfile (os.path.exists(exclude) and os.path.samefile(p, exclude), falling back topath_keywhen the manifest doesn't exist yet) would cover both this and the macOS case. Fine as a follow-up if you'd rather keep this one small.2.
walk()now resolves every file instead of every folder.The old code called
realpathonce per directory; the new one callspath_key(p), sorealpath, for each file. On Windowsrealpathopens a handle per call. Throwaway tree of 20,000 empty files in 200 folders, plusmanifest.json, timing onlywalk(data, exclude=data/manifest.json)(2 runs each, both yield 20,000 files):mainAbout 0.2 ms more per file, ~12x on the walk itself. On a real install hashing dominates, so this is minor, but it is cheap to avoid: only call
path_key(p)whenname.casefold()(NFD-normalised, for the macOS branch) matches the manifest's basename, which skips the realpath for nearly every file.Not checked: a real macOS volume, Linux case-folding mounts, the full test suite.
GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).