Skip to content

skin_streams: ask report_paths for the report-path guard - #2640

Open
breachato wants to merge 2 commits into
ProjectLeonida:mainfrom
breachato:skin-streams-shared-report-path
Open

breachato wants to merge 2 commits into
ProjectLeonida:mainfrom
breachato:skin-streams-shared-report-path

Conversation

@breachato

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: SKIN-STREAMS-SHARED-REPORT-PATH

What and why

tools/skin_streams.py compares the archive it reads with its --json report through its own same_output_path. That answer is wrong in a case-insensitive APFS volume and in a case-sensitive Windows directory, which is exactly the pair tools/report_paths.py decides. The private function becomes an alias of report_paths.same_report_path; the file also gets the ROOT / sys.path.insert block that -I needs to import the helper from tools/.

The tool also joins SHARED in tests/test_report_paths.py.

Tested

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

Synthetic archives 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.

@fiestorra

Copy link
Copy Markdown
Contributor

Verified on this machine (Windows 11, Python 3.13.14).

1. It applies. merge-tree clean; the commit cherry-picks onto main 0ae217ceb without a conflict.

2. The test suite is unchanged and passes:

python3 -m pytest tests/test_report_paths.py -q   -> 26 passed, 22 subtests

3. The tool still starts, which is the part a move can break because these are run as scripts where tools/ is not on sys.path:

python3 tools/ --help   -> exit 0, usage printed

What the tests cannot show: as with the other four in this set, it is a refactor - the private same_output_path replaced by the shared same_report_path - so passing with and without the change is the expected result, not proof of equivalence. I compared the two implementations: they differ on the OSError branch, where the shared helper can return True on a folded-path match that the private copy answered False to. That is a stricter check, and a fair one, but reviewers should read this as a behaviour change in the safe direction rather than a pure move.

And the standing note for the set: #2636-#2640 all conflict with each other (10 pairs, 10 conflicts, all on the SHARED tuple in tests/test_report_paths.py). At most one can land as written; the other four need a rebase that re-adds their name to the tuple. is orthogonal - it is the tuple line that collides.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor

Correction to the comment above: two placeholders did not expand when I posted it, so it says python3 tools/ --help and "`` is orthogonal". The intended text:

python3 tools/skin_streams.py --help   -> exit 0, usage printed

and the tool being refactored (skin_streams) is orthogonal to the SHARED tuple collision - it is the tuple line in tests/test_report_paths.py that makes all ten pairs of this set conflict.

The measurement stands as reported: tests/test_report_paths.py -> 26 passed, 22 subtests, and tools/skin_streams.py --help exits 0. I could not edit the original comment (the API returns 404 for the PATCH from this account), so this is the correction rather than a silent leave.

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/2640
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 "skin_streams" 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 "skin_streams" 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 \

@breachato
breachato force-pushed the skin-streams-shared-report-path branch from 0b2bab5 to 6a76f09 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_skin_streams.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/skin_streams.py).

New head: 6a76f0969507ad6598ca76379c375b05fb2bdc97.

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_skin_streams.py   ->  Ran 41 tests, OK

@fiestorra @KelboLive — your checks are on the pre-rebase commits (b8bd37111 and the pre-rebase head). Could you re-run the guard on 6a76f096 and approve if it still holds? Merging on the old head would land code none of you has looked at.

This is the sibling that also carries the import bootstrap, so the startup path is worth one more run: python -I tools/skin_streams.py --help still exits 0 on the new head.

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

@imShangLi

Copy link
Copy Markdown
Contributor

VERIFY-2640 — Linux, Python 3.15, CPU only, no game files

Claimed as VERIFY-2640.

tree python3 -I tests/test_report_paths.py
main 86c30fce 26 tests, OK (1 skipped)
main + this pull request 26 tests, OK (1 skipped)
main + only this pull request's test change 26 tests, FAILED (failures=1)

Row 3 is main's file with the pull request's own 15-line diff patched in, nothing else checked out. The failure there is an AssertionError, not an import or attribute error, and it names the changed file:

FAIL: test_switched_tools_import_the_helper_and_define_no_copy (tool='skin_streams')
AssertionError: 'from report_paths import same_report_path' not found in ...

tests/test_report_paths.py reads tools/skin_streams.py and asserts it imports the shared helper. Without the change the import is not there, so the test reaches the changed code rather than merely failing to load. Reverse control holds: the change is what turns it green.

The part the test does not cover

The change is two things, and the test only sees the first:

  1. tools/skin_streams.py gains from report_paths import same_report_path — this is what the test asserts.
  2. Its local same_output_path is replaced by an alias to that helper:
same_output_path = same_report_path  # True when writing the second would truncate the first

Nothing in the test executes either function, so I ran both over 14 path pairs — the same file, a hard link, a symlink, two distinct files, the same name in another directory, differing case, both paths missing, one missing, relative vs absolute, and empty strings:

14 cases, 0 behaviour differences        platform=linux

The two implementations are not equivalent in general, though. The local copy compared os.path.normcase(realpath(a)) == os.path.normcase(realpath(b)); the shared one compares the resolved names first, then samefile, and only folds in the OSError fallback (_same_windows_folded_path, _same_resolved_name). normcase is the identity function on Linux, so that difference is not measurable here — I did not run Windows. Where it does apply, the shared helper is the stricter of the two: it returns False for two distinct files whose names only fold together, which is what its comment says it is for. Both directions of a guard whose job is "refuse an --json that would overwrite an input" fail safe.

Verified. The change does what the description says, its test catches it, and it merges cleanly with main 86c30fce.

AI-assisted: yes — MiMo-V2.6-Flash (OpenCode). It built the worktrees, applied row 3 as a patch, ran the 14-case comparison and drafted this report.

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

@aslan2142 aslan2142 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff against main: delegating the report-path guard in tools/skin_streams.py to report_paths.same_report_path is clean and clean-room verified, but this branch currently conflicts with main in tests/test_report_paths.py:8-12 (SHARED tuple updated by #2639 and earlier merges). Please rebase onto current main so CI runs cleanly.

(AI-assisted review.)

@merzleckeier

Copy link
Copy Markdown
Contributor

I resolved the tuple conflict locally at 6a76f096 + b3910e5e by adding skin_streams and retaining main's meshlet_page entry. The 41 skin-stream tests and both shared path suites pass (one platform-dependent skip in each path suite).

I exercised skin_streams.main with a synthetic one-mesh archive and real filesystem identity checks. Linux provided two distinct files differing only by case, while I substituted Windows-style normcase to model a case-sensitive Windows directory. main rejects the separate report file as an alias (exit 2). The PR writes its one-mesh report (exit 0). Both reject a real hard link to the input (exit 2) and leave its bytes unchanged. The case-sensitive Windows directory rules were simulated on Linux. MEASURED, AI-assisted (Codex).

@breachato
breachato force-pushed the skin-streams-shared-report-path branch from 6a76f09 to 7ef75fb Compare December 1, 2026 17:54
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Dec 1, 2026
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 skin-streams-shared-report-path branch from 7ef75fb to fc49b79 Compare December 1, 2026 18:57
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.

6 participants