restofworld_model_join: ask report_paths for the report-path guard (RESTOFWORLD-MODEL-JOIN-SHARED-REPORT-PATH) #1244

Closed
breachato wants to merge 2 commits from upstream-pr/1244 into main
breachato commented 2026-11-24 20:44:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by breachato on 2026-11-24T20:44:53Z.


Claimed in the coordination issue as: RESTOFWORLD-MODEL-JOIN-SHARED-REPORT-PATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143975647)

Depends on: none

Fixes: none

What and why

tools/restofworld_model_join.py derived the report-path answer itself inside _aliases_input (:1236-1257):
realpath + normcase compared by hand twice (the source, then the carve folder's index.json) and
os.path.samefile twice, to refuse an --out that would overwrite the archive, the folder manifest or a carved
stream. CONTRIBUTING.md asks a report writer to call report_paths.same_report_path instead of deriving it again,
and the private copy missed that helper's folding-volume probe: on a Linux mount that ignores case (vfat, exFAT,
CIFS) --out INDEX.json beside an existing index.json was not refused and replaced the manifest.

The equalities now go through same_report_path; the last branch of _aliases_input is untouched because it is a
containment rule, not an equality (an output inside the carve folder with a .bin/.bk2 name), and
tests/test_carve_short_system_pages.py asserts it. The tool had no tools/ entry on sys.path, so one is added
for the import, as tex_headers does. Different topic from OLD-7750 (#886, page-map slots and index.json load).
No behaviour change on Windows, macOS or a case-sensitive Linux filesystem.

Tested

  • tests/test_restofworld_model_join.py, tests/test_carve_short_system_pages.py and
    tests/test_report_path_case.py: 23 passed, 1 skipped, 44 subtests passed.
  • python -I tools/restofworld_model_join.py --help: prints its usage (the import works under -I).
  • python -m compileall -q tools/restofworld_model_join.py: clean.
  • Not tested: the folding-volume case this fixes, which needs a case-folding mount (vfat/exFAT/CIFS); this
    machine is NTFS, where normcase already folds case. tests/test_report_paths.py covers the helper's own
    folding-volume answer.
  • No game files, no GPU; nothing was built.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • 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. (n/a: no translator change)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480028760 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244). Originally posted by [breachato](https://github.com/breachato) on 2026-11-24T20:44:53Z. --- Claimed in the coordination issue as: RESTOFWORLD-MODEL-JOIN-SHARED-REPORT-PATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143975647) Depends on: none Fixes: none ### What and why `tools/restofworld_model_join.py` derived the report-path answer itself inside `_aliases_input` (`:1236-1257`): realpath + normcase compared by hand twice (the source, then the carve folder's `index.json`) and `os.path.samefile` twice, to refuse an `--out` that would overwrite the archive, the folder manifest or a carved stream. CONTRIBUTING.md asks a report writer to call `report_paths.same_report_path` instead of deriving it again, and the private copy missed that helper's folding-volume probe: on a Linux mount that ignores case (vfat, exFAT, CIFS) `--out INDEX.json` beside an existing `index.json` was not refused and replaced the manifest. The equalities now go through `same_report_path`; the last branch of `_aliases_input` is untouched because it is a containment rule, not an equality (an output inside the carve folder with a `.bin`/`.bk2` name), and `tests/test_carve_short_system_pages.py` asserts it. The tool had no `tools/` entry on `sys.path`, so one is added for the import, as `tex_headers` does. Different topic from OLD-7750 (#886, page-map slots and `index.json` load). No behaviour change on Windows, macOS or a case-sensitive Linux filesystem. ### Tested - `tests/test_restofworld_model_join.py`, `tests/test_carve_short_system_pages.py` and `tests/test_report_path_case.py`: **23 passed, 1 skipped**, 44 subtests passed. - `python -I tools/restofworld_model_join.py --help`: prints its usage (the import works under `-I`). - `python -m compileall -q tools/restofworld_model_join.py`: clean. - **Not tested:** the folding-volume case this fixes, which needs a case-folding mount (vfat/exFAT/CIFS); this machine is NTFS, where `normcase` already folds case. `tests/test_report_paths.py` covers the helper's own folding-volume answer. - No game files, no GPU; nothing was built. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
PierreEbele commented 2026-11-25 14:35:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T14:35:03Z.


Reviewed 9638d91: restofworld_model_join's overwrite guard now calls same_report_path from tools/report_paths.py instead of its own normcase/realpath/samefile code. Ran on this branch and on main: tests/test_restofworld_model_join.py (9 OK), tests/test_carve_short_system_pages.py (11 OK, including the direct _aliases_input assertions), tests/test_report_paths.py (22 OK), tests/test_report_path_case.py (4 OK, 1 skipped), --help clean. A 16-case probe (index.json via hard link, symlink, dangling symlink; case twins of index.json and .bk2 names; carved *.bin siblings; subfolders; .. spellings; archive sources) gives identical verdicts on main and here; on folding volumes it additionally refuses a case-twin of index.json, as intended. No finding. Suggestion: add restofworld_model_join to SHARED in tests/test_report_paths.py so the import stays pinned; nothing fails as-is. AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165500912 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1244#issuecomment-7165500912). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T14:35:03Z. --- Reviewed 9638d91: restofworld_model_join's overwrite guard now calls `same_report_path` from tools/report_paths.py instead of its own normcase/realpath/samefile code. Ran on this branch and on main: tests/test_restofworld_model_join.py (9 OK), tests/test_carve_short_system_pages.py (11 OK, including the direct `_aliases_input` assertions), tests/test_report_paths.py (22 OK), tests/test_report_path_case.py (4 OK, 1 skipped), `--help` clean. A 16-case probe (index.json via hard link, symlink, dangling symlink; case twins of index.json and .bk2 names; carved *.bin siblings; subfolders; `..` spellings; archive sources) gives identical verdicts on main and here; on folding volumes it additionally refuses a case-twin of index.json, as intended. No finding. Suggestion: add restofworld_model_join to SHARED in tests/test_report_paths.py so the import stays pinned; nothing fails as-is. AI-assisted review. **Recommendation:** Merge
breachato commented 2026-11-28 08:57:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by breachato on 2026-11-28T08:57:06Z.


Thanks for the review and for the SHARED suggestion — agreed, and that is the plan, with one caveat on timing.

NoPrivateCopiesTests.test_switched_tools_import_the_helper_and_define_no_copy asserts that every tool listed in SHARED already contains from report_paths import same_report_path. These tools are landing one per pull request (#1162, #1170–#1173, #1214, #1215, #1227–#1229, #1243, this one), so naming any of them in SHARED before its own pull request is merged would turn tests/test_report_paths.py red on main.

So I would rather do it as a single follow-up pull request once the series is in: add rbf0_tree, odrp_7a, rbf0_index, text_tables, rtti_scan, navmesh_decode and restofworld_model_join to SHARED, and drop navmesh_decode from LEGACY_COPIES (its private copy goes away with #1243). One pull request for all seven keeps the same tuple from being edited seven times — seven pull requests touching that one line would only conflict with each other — and it is a single topic: the list of tools the helper is pinned to.

If you would rather have it split per tool anyway, say so and I will do that instead.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236916031 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#issuecomment-7236916031). Originally posted by [breachato](https://github.com/breachato) on 2026-11-28T08:57:06Z. --- Thanks for the review and for the `SHARED` suggestion — agreed, and that is the plan, with one caveat on timing. `NoPrivateCopiesTests.test_switched_tools_import_the_helper_and_define_no_copy` asserts that every tool listed in `SHARED` already contains `from report_paths import same_report_path`. These tools are landing one per pull request (`#1162`, `#1170`–`#1173`, `#1214`, `#1215`, `#1227`–`#1229`, `#1243`, this one), so naming any of them in `SHARED` before its own pull request is merged would turn `tests/test_report_paths.py` red on `main`. So I would rather do it as a single follow-up pull request once the series is in: add `rbf0_tree`, `odrp_7a`, `rbf0_index`, `text_tables`, `rtti_scan`, `navmesh_decode` and `restofworld_model_join` to `SHARED`, and drop `navmesh_decode` from `LEGACY_COPIES` (its private copy goes away with `#1243`). One pull request for all seven keeps the same tuple from being edited seven times — seven pull requests touching that one line would only conflict with each other — and it is a single topic: the list of tools the helper is pinned to. If you would rather have it split per tool anyway, say so and I will do that instead. AI-assisted.
zmasi commented 2026-11-28 22:21:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:21:51Z.


#1244 | head 9638d9108e (merged cleanly with main c7753ed98a) | live NTFS fsutil file setCaseSensitiveInfo <dir> enable probe + python -I tests/test_restofworld_model_join.py + python -I tests/test_carve_short_system_pages.py + python -I tests/test_report_paths.py | red on main: restofworld_model_join._aliases_input falsely returned True inside a case-sensitive Windows NTFS directory (OUT.json vs out.json, two distinct existing files Existing.bin vs existing.bin, and INDEX.json vs <dir>/index.json, because os.path.normcase(os.path.realpath(...)) folded case unconditionally before os.path.samefile) | green on PR+main: False across all 3 case-sensitive NTFS pairs, True on standard case-insensitive NTFS, 12 ran, OK (test_restofworld_model_join.py), 11 ran, OK (test_carve_short_system_pages.py), 26 ran, OK (skipped=1) (test_report_paths.py) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited 9638d9108e (tools/restofworld_model_join.py) on Windows 11, confirming _aliases_input delegates both direct source-path and <source_dir>/index.json comparisons to report_paths.same_report_path while preserving the carved-directory .bin / .bk2 overwrite guard. Also verified tests/test_report_path_case.py, tests/test_ci_registration.py, tests/test_text_write_line_endings.py, and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246683139 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#issuecomment-7246683139). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:21:51Z. --- #1244 | head 9638d9108e62d51dac0e4715180011c140fce9d0 (merged cleanly with main c7753ed98a) | live NTFS `fsutil file setCaseSensitiveInfo <dir> enable` probe + `python -I tests/test_restofworld_model_join.py` + `python -I tests/test_carve_short_system_pages.py` + `python -I tests/test_report_paths.py` | red on main: `restofworld_model_join._aliases_input` falsely returned `True` inside a case-sensitive Windows NTFS directory (`OUT.json` vs `out.json`, two distinct existing files `Existing.bin` vs `existing.bin`, and `INDEX.json` vs `<dir>/index.json`, because `os.path.normcase(os.path.realpath(...))` folded case unconditionally before `os.path.samefile`) | green on PR+main: `False` across all 3 case-sensitive NTFS pairs, `True` on standard case-insensitive NTFS, `12 ran, OK` (`test_restofworld_model_join.py`), `11 ran, OK` (`test_carve_short_system_pages.py`), `26 ran, OK (skipped=1)` (`test_report_paths.py`) | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `9638d9108e` (`tools/restofworld_model_join.py`) on Windows 11, confirming `_aliases_input` delegates both direct source-path and `<source_dir>/index.json` comparisons to `report_paths.same_report_path` while preserving the carved-directory `.bin` / `.bk2` overwrite guard. Also verified `tests/test_report_path_case.py`, `tests/test_ci_registration.py`, `tests/test_text_write_line_endings.py`, and `scripts/check_no_game_data.py`.
TheGeogeo commented 2026-11-29 01:12:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T01:12:47Z.


Checked 9638d9108 merged (no commit) with main 87a39df94: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

  • This PR adds no test, so there is no red/green to show.
  • No regression: the existing tests that cover the tool give the same result on main and on the merge (test_restofworld_model_join.py 12 OK, test_carve_short_system_pages.py 11 OK).
  • The same pattern runs through #1162, #1170-#1173, #1214, #1215, #1227-#1229, #1243 and #1244. Each one replaces its tool's own copy of the same-path check with report_paths.same_report_path (tools/report_paths.py:117 on main). They share that one helper and touch one different tool each, so they do not depend on each other. Only #1228 conflicts with main.

No blocker from my side.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248635095 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#issuecomment-7248635095). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T01:12:47Z. --- Checked `9638d9108` merged (no commit) with `main` `87a39df94`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. - This PR adds no test, so there is no red/green to show. - No regression: the existing tests that cover the tool give the same result on `main` and on the merge (`test_restofworld_model_join.py` 12 OK, `test_carve_short_system_pages.py` 11 OK). - The same pattern runs through #1162, #1170-#1173, #1214, #1215, #1227-#1229, #1243 and #1244. Each one replaces its tool's own copy of the same-path check with `report_paths.same_report_path` (`tools/report_paths.py:117` on `main`). They share that one helper and touch one different tool each, so they do not depend on each other. Only #1228 conflicts with `main`. No blocker from my side. AI-assisted (Claude Code).
TheGeogeo commented 2026-11-29 17:12:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T17:12:33Z.


Tested 9638d9108 merged (no commit) with main 0bc6e21a1: Python 3.12.4, Windows 11 10.0.26300, CPU only.

  • This PR adds no test. The test that covers it: add "restofworld_model_join" to SHARED in tests/test_report_paths.py.
  • Red: with that line on main, test_switched_tools_import_the_helper_and_define_no_copy fails for restofworld_model_join ("'from report_paths import same_report_path' not found").
  • Green: with that line on the merge, all 26 tests pass.
  • Without the line, main and the merge both pass (26 OK), so nothing guards the change yet. Please add the tool to SHARED in this PR.
  • No game data check passes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259509225 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#issuecomment-7259509225). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T17:12:33Z. --- Tested 9638d9108 merged (no commit) with main 0bc6e21a1: Python 3.12.4, Windows 11 10.0.26300, CPU only. - This PR adds no test. The test that covers it: add `"restofworld_model_join"` to `SHARED` in `tests/test_report_paths.py`. - Red: with that line on main, `test_switched_tools_import_the_helper_and_define_no_copy` fails for `restofworld_model_join` ("'from report_paths import same_report_path' not found"). - Green: with that line on the merge, all 26 tests pass. - Without the line, main and the merge both pass (26 OK), so nothing guards the change yet. Please add the tool to `SHARED` in this PR. - No game data check passes. AI-assisted (Claude Code).
breachato commented 2026-11-29 18:02:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by breachato on 2026-11-29T18:02:30Z.


Added: restofworld_model_join is now in SHARED in tests/test_report_paths.py in this PR (commit 81d6c7b1).

  • python -I tests/test_report_paths.py — OK (1 skipped), with the entry in place.
  • python -I tests/test_restofworld_model_join.py — OK.
  • The red is the one you described: the same entry without this branch fails with 'from report_paths import same_report_path' not found.

Every PR in this series now touches that SHARED line, so I expect to rebase the rest as merges land; say the word if you would rather keep the list to a single follow-up.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260161940 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#issuecomment-7260161940). Originally posted by [breachato](https://github.com/breachato) on 2026-11-29T18:02:30Z. --- Added: `restofworld_model_join` is now in `SHARED` in `tests/test_report_paths.py` in this PR (commit `81d6c7b1`). - `python -I tests/test_report_paths.py` — OK (1 skipped), with the entry in place. - `python -I tests/test_restofworld_model_join.py` — OK. - The red is the one you described: the same entry without this branch fails with `'from report_paths import same_report_path' not found`. Every PR in this series now touches that `SHARED` line, so I expect to rebase the rest as merges land; say the word if you would rather keep the list to a single follow-up. AI-assisted.
breachato commented 2026-11-30 19:23:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by breachato on 2026-11-30T19:23:44Z.


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_restofworld_model_join.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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7289320940 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#issuecomment-7289320940). Originally posted by [breachato](https://github.com/breachato) on 2026-11-30T19:23:44Z. --- 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_restofworld_model_join.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.
aslan2142 commented 2026-12-01 11:49:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:49:46Z.

Review: CHANGES_REQUESTED


Reviewed the diff against main: delegating the report-path guard in tools/restofworld_model_join.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.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130654739 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#pullrequestreview-6130654739). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:49:46Z. **Review:** CHANGES_REQUESTED --- Reviewed the diff against `main`: delegating the report-path guard in `tools/restofworld_model_join.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.)*
aslan2142 commented 2026-12-02 05:10:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-02T05:10:34Z.


Thank you @breachato! Both commits from this PR (restofworld_model_join) have been landed on main with full original authorship preserved in batch PR #3024 (commit 4dfd90c35), which consolidated all 15 tools/report_paths.py PRs together to avoid sequential tests/test_report_paths.py merge conflicts. Closing this PR now that it is merged!

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7335659413 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1244#issuecomment-7335659413). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-02T05:10:34Z. --- Thank you @breachato! Both commits from this PR (`restofworld_model_join`) have been landed on `main` with full original authorship preserved in batch PR #3024 (commit `4dfd90c35`), which consolidated all 15 `tools/report_paths.py` PRs together to avoid sequential `tests/test_report_paths.py` merge conflicts. Closing this PR now that it is merged!

Pull request closed

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!1244
No description provided.