meshlet_page: ask report_paths for the report-path guard (carry of #1431) #3086

Merged
MoonEyes merged 4 commits from upstream-pr/3086 into main 2026-12-02 12:58:44 +00:00
MoonEyes commented 2026-12-02 10:29:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T10:29:22Z.


Claimed in the coordination issue as: MESHLET-PAGE-SHARED-REPORT-PATH (the item ID the original author, Dashhhhhhhh, gave in the description of #1431)

What and why

Carry of #1431 (Dashhhhhhhh), unchanged since 2026-11-25 (last commit; no author push or comment after that). Branch = main + the author's head ba4e7ef65 (both commits kept) + conflict resolution + no further commits of mine.

is_scanned_input in tools/meshlet_page.py decided whether a report path is inside the carve folder with os.path.normcase(os.path.abspath()), which keeps the typed case on macOS. A page report under CARVE/ for a folder created as carve was not seen as inside the folder. This branch compares the two with report_paths.path_key, which folds case on a case-insensitive volume, and adds the author's two regression tests (test_json_cannot_create_the_manifest_under_another_case, test_json_cannot_replace_a_page_under_another_case_of_the_folder).

The first half of #1431 (same_output_path delegating to report_paths.same_report_path) landed in main through #2639, which is what conflicted. The resolution keeps main's import header and its same_output_path = same_report_path alias and adds only path_key, as the review on #1431 asked. The import is a separate line, from report_paths import path_key, because tests/test_report_paths.py (NoPrivateCopiesTests) asserts the exact text from report_paths import same_report_path in each shared tool. Review defects: none found still present beyond that rebase request.

Tested

Windows 11, no GPU, no game files, on main a917c54d6 plus this branch.

  • python -I tests/test_meshlet_page.py: 75 tests, OK (both new tests ran, NTFS ignores case).
  • python -I tests/test_report_paths.py: 26 tests, OK (1 skipped). A first merge that imported path_key in the same line as same_report_path failed NoPrivateCopiesTests here; the split import fixes it.
  • Red: not reachable on this machine. With main's tools/meshlet_page.py and the branch's tests, python -I tests/test_meshlet_page.py gives 75 tests, OK, because Windows realpath/normcase already fold case. Simulated instead with a throw-away script outside the repository (not part of this PR) that makes os.path.normcase keep case, os.path.realpath equal abspath and case_insensitive_volume return True, then calls is_scanned_input for a folder carve containing 0000.bin: on main, CARVE/0000.bin is not refused (False); on this branch it is refused (True). CARVE/index.json is refused on both in that simulation. OreoFR measured a real red on APFS for the manifest test in a comment on #1431; I did not reproduce that.
  • python -I scripts/check_no_game_data.py tools/meshlet_page.py tests/test_meshlet_page.py: clean.

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

  • Based on current main and merges cleanly (merged with main a917c54d6; main may have moved since).
  • 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 (not a translator change).

Supersedes #1431 once merged; the original stays open until a maintainer decides.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5604591550 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3086). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T10:29:22Z. --- Claimed in the coordination issue as: MESHLET-PAGE-SHARED-REPORT-PATH (the item ID the original author, Dashhhhhhhh, gave in the description of #1431) ### What and why Carry of #1431 (Dashhhhhhhh), unchanged since 2026-11-25 (last commit; no author push or comment after that). Branch = main + the author's head `ba4e7ef65` (both commits kept) + conflict resolution + no further commits of mine. `is_scanned_input` in `tools/meshlet_page.py` decided whether a report path is inside the carve folder with `os.path.normcase(os.path.abspath())`, which keeps the typed case on macOS. A page report under `CARVE/` for a folder created as `carve` was not seen as inside the folder. This branch compares the two with `report_paths.path_key`, which folds case on a case-insensitive volume, and adds the author's two regression tests (`test_json_cannot_create_the_manifest_under_another_case`, `test_json_cannot_replace_a_page_under_another_case_of_the_folder`). The first half of #1431 (`same_output_path` delegating to `report_paths.same_report_path`) landed in main through #2639, which is what conflicted. The resolution keeps main's import header and its `same_output_path = same_report_path` alias and adds only `path_key`, as the review on #1431 asked. The import is a separate line, `from report_paths import path_key`, because `tests/test_report_paths.py` (`NoPrivateCopiesTests`) asserts the exact text `from report_paths import same_report_path` in each shared tool. Review defects: none found still present beyond that rebase request. ### Tested Windows 11, no GPU, no game files, on main a917c54d6 plus this branch. - `python -I tests/test_meshlet_page.py`: 75 tests, OK (both new tests ran, NTFS ignores case). - `python -I tests/test_report_paths.py`: 26 tests, OK (1 skipped). A first merge that imported `path_key` in the same line as `same_report_path` failed `NoPrivateCopiesTests` here; the split import fixes it. - Red: not reachable on this machine. With main's `tools/meshlet_page.py` and the branch's tests, `python -I tests/test_meshlet_page.py` gives 75 tests, OK, because Windows `realpath`/`normcase` already fold case. Simulated instead with a throw-away script outside the repository (not part of this PR) that makes `os.path.normcase` keep case, `os.path.realpath` equal `abspath` and `case_insensitive_volume` return True, then calls `is_scanned_input` for a folder `carve` containing `0000.bin`: on main, `CARVE/0000.bin` is not refused (False); on this branch it is refused (True). `CARVE/index.json` is refused on both in that simulation. OreoFR measured a real red on APFS for the manifest test in a comment on #1431; I did not reproduce that. - `python -I scripts/check_no_game_data.py tools/meshlet_page.py tests/test_meshlet_page.py`: clean. 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 - [x] Based on current `main` and merges cleanly (merged with main a917c54d6; main may have moved since). - [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 (not a translator change). Supersedes #1431 once merged; the original stays open until a maintainer decides. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
enlight3d commented 2026-12-02 12:25:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T12:25:00Z.


RUN (independent run on Windows, #3086 head ec005f54a, merged locally into main 9b4d71899 with git merge --no-ff, no conflicts. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)

  • History: #1431's head ba4e7ef65 is an ancestor of the head through the merge b0e288218. Both of Dashhhhhhhh's commits (9cc9fded7, ba4e7ef65) are kept under their author's name.
  • Merge resolution: main's from report_paths import same_report_path line and same_output_path alias stay, and path_key comes in on its own import line. python -I tests/test_report_paths.py on the merge gives 26 tests OK, including NoPrivateCopiesTests.
  • python -I tests/test_meshlet_page.py -v: main 73 tests OK; merge 75 tests OK. Both new tests ran here, since NTFS ignores case and neither skipped.
  • python -m pytest tests/test_meshlet_page.py tests/test_report_paths.py tests/test_tool_stdout_encoding.py -q: main 103 passed; merge 105 passed.
  • Red on Windows: not reachable, as the body says. With main's tools/meshlet_page.py, the pull request's 75 tests pass, because on Windows ntpath.normcase already folds case.
  • macOS simulation, with a probe outside the repository. It patches os.path.normcase to keep case, os.path.realpath to abspath, and report_paths.case_insensitive_volume to True. It then calls is_scanned_input for a folder carve holding 0000.bin:
    • main: CARVE/0000.bin not refused (False). CARVE/index.json refused. carve/0000.bin refused.
    • merge: all three refused. This is the fix the body describes. CARVE/index.json is refused on both, so in this simulation the first new test would pass on main too. The body mentions a real APFS red for it, which I could not check here.
  • Mutations of the merge's tools/meshlet_page.py, each run with the test file and the simulation, and restored afterwards (git status clean):
    • path_key replaced by main's normcase(abspath()) in is_scanned_input: survives the test file on Windows. The simulation catches it: CARVE/0000.bin is not refused again.
    • "Is it a .bin or .rpf" test replaced by True: killed (test_json_inside_carve_dir_can_be_written_and_replaced).
    • "Inside the carve folder" test removed (if target != root and not target.startswith(prefix): return False): survives both. With this mutation, any existing .bin anywhere would be refused as an input. That is an over-refusal, not a loss of data.
    • Prefix without the separator (prefix = root): survives both. A sibling folder like carve2/ would count as inside carve, which is also an over-refusal. No test writes a report next to the carve folder under a name that shares its prefix.

Not covered here: a real macOS or other case-insensitive, case-keeping volume. Only that kind of volume can show this pull request's red, and CI's jobs on the head do not include macOS. Linux was not run locally.

Verdict: PARTIAL. The change is right in the macOS simulation (main misses CARVE/0000.bin, the merge refuses it), the merge keeps main's shared-guard import as NoPrivateCopiesTests requires, and both of the author's commits are kept. But on Windows the two new tests pass with main's tool and cannot catch the case-folding mutation, so the red still needs a run on APFS.

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345305508 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3086#issuecomment-7345305508). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-02T12:25:00Z. --- RUN (independent run on Windows, #3086 head ec005f54a, merged locally into `main` 9b4d71899 with `git merge --no-ff`, no conflicts. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.) - History: #1431's head ba4e7ef65 is an ancestor of the head through the merge b0e288218. Both of Dashhhhhhhh's commits (9cc9fded7, ba4e7ef65) are kept under their author's name. - Merge resolution: `main`'s `from report_paths import same_report_path` line and `same_output_path` alias stay, and `path_key` comes in on its own import line. `python -I tests/test_report_paths.py` on the merge gives 26 tests OK, including `NoPrivateCopiesTests`. - `python -I tests/test_meshlet_page.py -v`: main 73 tests OK; merge 75 tests OK. Both new tests ran here, since NTFS ignores case and neither skipped. - `python -m pytest tests/test_meshlet_page.py tests/test_report_paths.py tests/test_tool_stdout_encoding.py -q`: main 103 passed; merge 105 passed. - Red on Windows: not reachable, as the body says. With `main`'s `tools/meshlet_page.py`, the pull request's 75 tests pass, because on Windows `ntpath.normcase` already folds case. - macOS simulation, with a probe outside the repository. It patches `os.path.normcase` to keep case, `os.path.realpath` to `abspath`, and `report_paths.case_insensitive_volume` to True. It then calls `is_scanned_input` for a folder `carve` holding `0000.bin`: - `main`: `CARVE/0000.bin` not refused (False). `CARVE/index.json` refused. `carve/0000.bin` refused. - merge: all three refused. This is the fix the body describes. `CARVE/index.json` is refused on both, so in this simulation the first new test would pass on `main` too. The body mentions a real APFS red for it, which I could not check here. - Mutations of the merge's `tools/meshlet_page.py`, each run with the test file and the simulation, and restored afterwards (`git status` clean): - `path_key` replaced by `main`'s `normcase(abspath())` in `is_scanned_input`: survives the test file on Windows. The simulation catches it: `CARVE/0000.bin` is not refused again. - "Is it a `.bin` or `.rpf`" test replaced by `True`: killed (`test_json_inside_carve_dir_can_be_written_and_replaced`). - "Inside the carve folder" test removed (`if target != root and not target.startswith(prefix): return False`): survives both. With this mutation, any existing `.bin` anywhere would be refused as an input. That is an over-refusal, not a loss of data. - Prefix without the separator (`prefix = root`): survives both. A sibling folder like `carve2/` would count as inside `carve`, which is also an over-refusal. No test writes a report next to the carve folder under a name that shares its prefix. Not covered here: a real macOS or other case-insensitive, case-keeping volume. Only that kind of volume can show this pull request's red, and CI's jobs on the head do not include macOS. Linux was not run locally. Verdict: PARTIAL. The change is right in the macOS simulation (`main` misses `CARVE/0000.bin`, the merge refuses it), the merge keeps `main`'s shared-guard import as `NoPrivateCopiesTests` requires, and both of the author's commits are kept. But on Windows the two new tests pass with `main`'s tool and cannot catch the case-folding mutation, so the red still needs a run on APFS. 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.
MoonEyes commented 2026-12-02 12:45:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:45:11Z.


Merging. Head ec005f54a merges cleanly with main 23a51c494 and 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 head ec005f54a found 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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345823534 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3086#issuecomment-7345823534). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:45:11Z. --- Merging. Head `ec005f54a` merges cleanly with `main` `23a51c494` and 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 head ec005f54a found 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).
Kal0s-design commented 2026-12-02 12:55:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T12:55:28Z.


Ran natively on Windows 11, Python 3.13, head ec005f54a merged into current main (23a51c494, no conflicts). py -3.13 -I tests/test_meshlet_page.py: 75 tests OK, as already reported.

The body and the earlier run say there is no native red on Windows. There is one, just not through case: the PR also swaps abspath for realpath (inside path_key), so a carve folder named through a junction or an 8.3 short name is now recognised too. On main both spellings let --json overwrite a page file. Throwaway folders, a 13-byte dummy 0000.bin (not game data), tools/meshlet_page.py swapped between main's and the PR's in the merged tree:

input / --json main this PR
link (junction to real, mklink /J, no admin) / real/0000.bin rc 0, 0000.bin replaced by the JSON report rc 2, error: --json would overwrite the input link, file intact
CARVEP~1 (8.3 name of carve pages long) / carve pages long/0000.bin rc 0, 0000.bin replaced rc 2, error: --json would overwrite the input CARVEP~1, file intact
py -I tools/meshlet_page.py link --json real/0000.bin --quiet
py -I tools/meshlet_page.py CARVEP~1 --json "carve pages long/0000.bin" --quiet

So the change fixes real data loss on Windows as well, not only on macOS. Neither new test covers it; a junction test would give the PR a red that runs on the Windows and Linux CI (a symlinked carve folder does the same on Linux).

Not checked: a real macOS volume, Linux, symlinks (need admin here).

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

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7346087148 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3086#issuecomment-7346087148). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T12:55:28Z. --- Ran natively on Windows 11, Python 3.13, head `ec005f54a` merged into current `main` (`23a51c494`, no conflicts). `py -3.13 -I tests/test_meshlet_page.py`: 75 tests OK, as already reported. The body and the earlier run say there is no native red on Windows. There is one, just not through case: the PR also swaps `abspath` for `realpath` (inside `path_key`), so a carve folder named through a junction or an 8.3 short name is now recognised too. On `main` both spellings let `--json` overwrite a page file. Throwaway folders, a 13-byte dummy `0000.bin` (not game data), `tools/meshlet_page.py` swapped between `main`'s and the PR's in the merged tree: | input / `--json` | `main` | this PR | |---|---|---| | `link` (junction to `real`, `mklink /J`, no admin) / `real/0000.bin` | rc 0, `0000.bin` replaced by the JSON report | rc 2, `error: --json would overwrite the input link`, file intact | | `CARVEP~1` (8.3 name of `carve pages long`) / `carve pages long/0000.bin` | rc 0, `0000.bin` replaced | rc 2, `error: --json would overwrite the input CARVEP~1`, file intact | ``` py -I tools/meshlet_page.py link --json real/0000.bin --quiet py -I tools/meshlet_page.py CARVEP~1 --json "carve pages long/0000.bin" --quiet ``` So the change fixes real data loss on Windows as well, not only on macOS. Neither new test covers it; a junction test would give the PR a red that runs on the Windows and Linux CI (a symlinked carve folder does the same on Linux). Not checked: a real macOS volume, Linux, symlinks (need admin here). GPUs tested: n/a (CPU-only tests). AI-assisted: yes (Claude Code).
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!3086
No description provided.