Skip to content

meshlet_page: ask report_paths for the report-path guard - #2639

Merged
MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
breachato:meshlet-page-shared-report-path
Dec 1, 2026
Merged

MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
breachato:meshlet-page-shared-report-path

Conversation

@breachato

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: MESHLET-PAGE-SHARED-REPORT-PATH

What and why

tools/meshlet_page.py refuses a report path that would overwrite an input or an existing report through its own same_output_path. That answer is wrong in a case-insensitive APFS volume and in a case-sensitive Windows directory. The private function becomes an alias of report_paths.same_report_path; the file also gets the ROOT / sys.path.insert block (python -I keeps only the script's folder on the path, and the helper lives in tools/), as pe_inspect.py and world_census.py already do.

The tool also joins SHARED in tests/test_report_paths.py, so the no-private-copy test guards the change.

Tested

  • python -I tests/test_meshlet_page.py — OK
  • python -I tests/test_report_paths.py — OK (1 skipped: the macOS-only case), with meshlet_page in SHARED
  • python -I tests/test_report_path_case.py — OK (1 skipped, same)
  • python -I tools/meshlet_page.py --help — clean

Synthetic pages in a temporary folder; no game data.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly.
  • One topic; nothing else touched.
  • No game data, keys or hardware results invented.

@fiestorra

Copy link
Copy Markdown
Contributor

Verified on main b8bd37111 (Windows, Python 3.13): the two commits apply cleanly, the shared list still passes, and this tool's own tests pass.

cherry-pick (the 2 commits not in main)          -> clean
python3 -m pytest tests/test_report_paths.py -q  -> 26 passed, 23 subtests

This is the third of the five siblings I have checked (#2636, #2637 and here), all with the same shape and all correct individually. The one thing that will bite is the shared tuple: every one of the five adds its name to SHARED = (...) on the same line of tests/test_report_paths.py, so whichever merges after the first needs a rebase, and that conflict is mechanical - both names belong, alphabetically - rather than a disagreement between branches.

Nothing in this one needs a decision of its own.

Written with an AI assistant.

@aegish-zagi

Copy link
Copy Markdown
Contributor

VERIFY-2639 — PASS

  • PR: meshlet_page: ask report_paths for the report-path guard #2639 | head 644bcb5 | merge state vs main 1d22590: CLEAN (scratch merge, no conflicts)
  • Tests run: python -I tests/test_report_paths.py (the test file this PR touches)
  • Red-on-main vs green-on-PR: PR test file on plain main code = 26 tests, FAILED (failures=1, skipped=1) — meshlet_page still carried its private copy; merged PR = 26 tests, OK (skipped=1)
  • Diff audit (READ IN CODE): tools/meshlet_page.py deletes its private same_output_path copy and aliases it to report_paths.same_report_path, adding the sys.path insert the import needs; the shared implementation is a superset (resolved-path + samefile, plus case-folding-volume handling the private copy lacked), so no call site loses behavior. Test change only adds meshlet_page to the SHARED tuple. python -I scripts/check_no_game_data.py on both changed files: pass; tool compiles.
  • Platform: Linux, Python 3.12.3, no GPU (Profile Z). MEASURED above; no GPU or game-dump work claimed.
    AI-assisted: yes (Muse Wonder, Muse by Meta)

@fiestorra

Copy link
Copy Markdown
Contributor

Verified the two siblings that carry more than the tuple edit, because they add an import bootstrap and that is the part that can break a tool at startup.

#2639 (meshlet_page) and #2640 (skin_streams) both add, on top of the SHARED tuple line and the move:

ROOT = os.path.dirname(os.path.abspath(__file__))
if ROOT not in sys.path:
    sys.path.insert(0, ROOT)

which the smaller three do not need. That matters because these tools are run as scripts (python tools/meshlet_page.py …), where the tools directory is not on sys.path, so from report_paths import same_report_path fails without it.

#2639, applied to main 1d22590b9 and run here:

python3 -m pytest tests/test_report_paths.py -q   -> 26 passed, 22 subtests
python3 tools/meshlet_page.py --help              -> exit 0, usage line

So the bootstrap works: the tool imports the shared helper when started directly, and the test suite is unchanged.

What I also checked, since it is the risk in a move like this: I compared all five private same_output_path implementations against each other and against the shared same_report_path. The five private copies are the same logic (normcase(realpath(…)) == normcase(realpath(…)), then samefile, then False); the only difference is the shared helper's richer OSError branch, which I described separately. So these five are consistent with each other - there is no fourth variant hiding in one of them.

What I did not do: run the tools against real archives. --help proves the import path, not the output; the report-writing path needs game data.

Written with an AI assistant.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 30, 2026
@fiestorra

Copy link
Copy Markdown
Contributor

Heads-up: this branch now conflicts on one line, and the conflict has a mechanical fix.

main merged a sibling of this pull request (#2637, 3cd08cfc7 "tests: list bink_index in SHARED") at 08:33 today. #2636, #2638, #2639, #2640 and #2637 all edit the same tuple, so the other four now conflict against the merged one:

$ git merge-tree --write-tree origin/main refs/remotes/pr/2639
CONFLICT in tests/test_report_paths.py

What main has now:

SHARED = ("anim_index", "awc_manifest", "bink_index", "gamedata_index", "gamedata_xml", "gen_d3d12_stubs",
          "glb_inspect", "navmesh_index", "rpf_probe", "tile_probe", "world_index", "world_lights_paths",
          "world_names")

What this branch needs: insert "meshlet_page" in its alphabetical place in that tuple, and keep the rest of the branch unchanged. Everything else in the diff applies cleanly - the tuple line is the only conflict.

Note on ordering, since it is easy to get wrong on a rebase: the tuple is alphabetical, and "meshlet_page" goes between the entries that bracket it. A rebase that appends it at the end would still pass the test but would break the file's convention and the next sibling's merge.

Why I am commenting: I verify open pull requests against current main by applying them in a scratch worktree and building their test targets. This one went from "replays cleanly" to "conflicts" between 09:20 and 10:36 today, and the cause was #2637 landing - not anything in this branch.

Written with an AI assistant.

@KelboLive

Copy link
Copy Markdown

Independent check on Windows at \644bcb54a: \python -I tests/test_report_paths.py\ — 26 tests OK (9.9 s). \meshlet_page\ is now covered by the shared report-path guard. Windows 11 26200.9711, Python 3.12.10. AI-assisted: yes (opencode).

The reviewers' red test: with this entry on main,
test_switched_tools_import_the_helper_and_define_no_copy fails with
"'from report_paths import same_report_path' not found"; with this branch
it passes.
@breachato
breachato force-pushed the meshlet-page-shared-report-path branch from 644bcb5 to e9b2529 Compare November 30, 2026 19:22
@breachato

breachato commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto main (8f41d7d0) to clear the SHARED tuple conflict that #2637 (bink_index) opened for every sibling: the entry now sits in the tuple next to bink_index, and the branch is two commits again.

Verified on the new head:

  • python -I tests/test_report_paths.py — OK (26 tests, 1 skipped)
  • python -I tests/test_meshlet_page.py — OK
  • git diff main — 2 files: the tool and tests/test_report_paths.py

No behaviour change beyond the shared helper.

Ready to merge: MERGEABLE / CLEAN, all five checks green. Every sibling PR touches the same SHARED line, so please merge one at a time — I'll rebase the remaining ones after each merge and keep them green.

@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 30, 2026
@breachato

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #2637 landed, so the SHARED tuple conflict is gone and the branch is two commits again on top of main (8f41d7d0; main is now d8ca1824, which does not touch tests/test_report_paths.py or tools/meshlet_page.py).

New head: e9b2529a967071dd54397352abcb1cf452661397.

Measured on that head, standard library only, Windows, Python 3.14, no game data:

python -I tests/test_report_paths.py   ->  Ran 26 tests, OK (skipped=1)
python -I tests/test_meshlet_page.py   ->  Ran 73 tests, OK

@fiestorra @aegish-zagi @KelboLive — your checks are on 644bcb54a, i.e. before the rebase. Could you re-run the guard on e9b2529a and approve if it still holds? Merging on the old head would land code none of you has looked at.

The diff is unchanged in substance: same two commits, same SHARED entry, only the tuple context under it moved.

@fiestorra

Copy link
Copy Markdown
Contributor

Verified on Windows at your new head e9b2529a9, and the change is load-bearing: with tools/meshlet_page.py from main the suite fails.

Cherry-picked onto main d8ca18240 in a clean worktree, Python 3.13.14:

python -m pytest tests/test_report_paths.py -q
  with this PR:                     26 passed, 24 subtests passed
  with tools/meshlet_page.py from main:      1 failed, 26 passed, 23 subtests passed

So the local guard this removes is not dead code that the tuple test happens to tolerate - the test reaches the path it replaces and fails when the old code is put back. That is the control I would want on a refactor whose whole claim is "the same answer, from one place".

Your rebase also holds: the tree applies without the SHARED tuple conflict, and the diff is two files (tools/meshlet_page.py and tests/test_report_paths.py), matching what you reported.

What I did not test: anything that needs a real report_paths target on disk - the other two PRs in this family cover that shape, and the three together are consistent, but each one alone only proves its own tool asks the same function.

AI-assisted: yes - DeepSeek v4.1 (flash) applied the head and ran both arms on the machine above.

Written with an AI assistant.

@MoonEyes

MoonEyes commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Merging. Head e9b2529a9 merges cleanly with main f918e5145 and does not force a rebase of #2566. CI green on this head. Red/green by fiestorra (Windows) on it, earlier ones by KelboLive and aegish-zagi on older heads; I ran it on main + PR (Windows, Python 3.14): test_report_paths and test_meshlet_page OK, and the shared list fails without this change. A tool and its test only, no game code. Merged by MoonEyes.

AI-assisted (Claude Code).

@MoonEyes
MoonEyes merged commit 0d41b0a into ProjectLeonida:main Dec 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants