rbf0_index: ask report_paths for the report-path guard (RBF0-INDEX-SHARED-REPORT-PATH) #1227

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

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


Claimed in the coordination issue as: RBF0-INDEX-SHARED-REPORT-PATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143809247)

Depends on: none

Fixes: none

What and why

tools/rbf0_index.py derived report-path equality itself in same_output_path (:542, realpath + normcase +
samefile) and asked it at its three output guards: the source against out (:562), the carve folder's
index.json against out (:577) and each carved stream against out (:578). That is the answer
tools/report_paths.py exists to give, and CONTRIBUTING.md asks a report writer to call same_report_path(a, b)
rather than derive it again (the same one-topic refactor as #1162 and #1214-#1216).

The private copy also missed that helper's folding-volume probe, so on a Linux mount that ignores case (vfat,
exFAT, CIFS) --out R.json and --out r.json passed as two report paths and the second replaced the first,
including when the first was the archive or a stream being scanned.

The duplicated logic goes. The tool already puts its own folder on sys.path for file_mode, so the import is
one line; no test calls same_output_path, so the name goes with the duplication. The staging and permission
path claimed by RBF0-INDEX-STAGE-CLEANUP (#791) is not touched. No behaviour change on Windows, macOS or a
case-sensitive Linux filesystem.

Tested

  • tests/test_rbf0_index.py and tests/test_rbf0_index_short_continuation.py: 30 passed, 4 subtests passed.
  • python -I tools/rbf0_index.py --help: prints its usage (the import works under -I).
  • python -m compileall -q tools/rbf0_index.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:5479931024 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227). Originally posted by [breachato](https://github.com/breachato) on 2026-11-24T20:37:43Z. --- Claimed in the coordination issue as: RBF0-INDEX-SHARED-REPORT-PATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143809247) Depends on: none Fixes: none ### What and why `tools/rbf0_index.py` derived report-path equality itself in `same_output_path` (`:542`, realpath + normcase + samefile) and asked it at its three output guards: the source against `out` (`:562`), the carve folder's `index.json` against `out` (`:577`) and each carved stream against `out` (`:578`). That is the answer `tools/report_paths.py` exists to give, and CONTRIBUTING.md asks a report writer to call `same_report_path(a, b)` rather than derive it again (the same one-topic refactor as #1162 and #1214-#1216). The private copy also missed that helper's folding-volume probe, so on a Linux mount that ignores case (vfat, exFAT, CIFS) `--out R.json` and `--out r.json` passed as two report paths and the second replaced the first, including when the first was the archive or a stream being scanned. The duplicated logic goes. The tool already puts its own folder on `sys.path` for `file_mode`, so the import is one line; no test calls `same_output_path`, so the name goes with the duplication. The staging and permission path claimed by RBF0-INDEX-STAGE-CLEANUP (#791) is not touched. No behaviour change on Windows, macOS or a case-sensitive Linux filesystem. ### Tested - `tests/test_rbf0_index.py` and `tests/test_rbf0_index_short_continuation.py`: **30 passed**, 4 subtests passed. - `python -I tools/rbf0_index.py --help`: prints its usage (the import works under `-I`). - `python -m compileall -q tools/rbf0_index.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 07:14:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T07:14:17Z.


Reviewed 7d5fb85e0: cleanly replaces rbf0_index.py's private same_output_path (no other callers) with the shared report_paths.same_report_path at all three refusal sites (source, carve index.json, carved streams) and merges cleanly into main. Verified in the sandbox on both PR and origin/main: all 11 rbf0/report-path suites (128 tests, 7 pre-existing skips), test_text_write_line_endings (3), and scripts/check_no_game_data.py pass; CLI probes confirm identical refusals on Linux (source, ../ spelling, hard link, symlink, carve manifest/stream) and mocked macOS/folding-volume checks confirm rbf0_index.main() now refuses case-only aliases (SRC.RPF, INDEX.JSON, rc=2). Optional non-blocking follow-up: "rbf0_index" could be added to SHARED in tests/test_report_paths.py (though 60 of 72 same_report_path tools are not listed there).
AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7155638575 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1227#issuecomment-7155638575). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T07:14:17Z. --- Reviewed 7d5fb85e0: cleanly replaces `rbf0_index.py`'s private `same_output_path` (no other callers) with the shared `report_paths.same_report_path` at all three refusal sites (`source`, carve `index.json`, carved streams) and merges cleanly into `main`. Verified in the sandbox on both PR and `origin/main`: all 11 rbf0/report-path suites (128 tests, 7 pre-existing skips), `test_text_write_line_endings` (3), and `scripts/check_no_game_data.py` pass; CLI probes confirm identical refusals on Linux (`source`, `../` spelling, hard link, symlink, carve manifest/stream) and mocked macOS/folding-volume checks confirm `rbf0_index.main()` now refuses case-only aliases (`SRC.RPF`, `INDEX.JSON`, rc=2). Optional non-blocking follow-up: `"rbf0_index"` could be added to `SHARED` in `tests/test_report_paths.py` (though 60 of 72 `same_report_path` tools are not listed there). AI-assisted review. **Recommendation:** Merge
zmasi commented 2026-11-28 22:20:22 +00:00 (Migrated from github.com)

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


Native Windows 11 NTFS Verification (7d5fb85e0a)

Verified 7d5fb85e0a08ef437ebc243a12f5ff0f9a3e3a87 merged cleanly onto origin/main (c7753ed98a56677f10e34078b37eab0540e190ec, git merge-tree --write-tree rc=0) on native Windows 11 (26200) + NTFS:

  • Red (origin/main c7753ed98a): Enabled real Windows 11 per-directory NTFS case sensitivity (fsutil.exe file setCaseSensitiveInfo <dir> enable) and probed rbf0_index.same_output_path on src.rpf vs SRC.RPF: origin/main returned True (false collision) because os.path.normcase lowercased both paths before os.path.samefile.
  • Green (origin/main + 7d5fb85e0a): Using report_paths.same_report_path returned False on the live case-sensitive NTFS directory while still returning True on a standard case-insensitive NTFS directory; tests/test_rbf0_index.py (30/30 OK) and tests/test_rbf0_index_short_continuation.py (2/2 OK) passed.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246665927 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227#issuecomment-7246665927). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:20:22Z. --- ### Native Windows 11 NTFS Verification (`7d5fb85e0a`) Verified `7d5fb85e0a08ef437ebc243a12f5ff0f9a3e3a87` merged cleanly onto `origin/main` (`c7753ed98a56677f10e34078b37eab0540e190ec`, `git merge-tree --write-tree` `rc=0`) on native **Windows 11 (`26200`) + NTFS**: - **Red (`origin/main` `c7753ed98a`)**: Enabled real Windows 11 per-directory NTFS case sensitivity (`fsutil.exe file setCaseSensitiveInfo <dir> enable`) and probed `rbf0_index.same_output_path` on `src.rpf` vs `SRC.RPF`: `origin/main` returned `True` (false collision) because `os.path.normcase` lowercased both paths before `os.path.samefile`. - **Green (`origin/main + 7d5fb85e0a`)**: Using `report_paths.same_report_path` returned `False` on the live case-sensitive NTFS directory while still returning `True` on a standard case-insensitive NTFS directory; `tests/test_rbf0_index.py` (`30/30 OK`) and `tests/test_rbf0_index_short_continuation.py` (`2/2 OK`) passed. AI-assisted.
TheGeogeo commented 2026-11-29 01:12:55 +00:00 (Migrated from github.com)

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


Checked 7d5fb85e0 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_rbf0_index.py 30 OK, test_rbf0_tree.py 38 OK, test_report_source_collision.py 8 OK and 5 more).
  • 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:7248636587 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227#issuecomment-7248636587). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T01:12:55Z. --- Checked `7d5fb85e0` 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_rbf0_index.py` 30 OK, `test_rbf0_tree.py` 38 OK, `test_report_source_collision.py` 8 OK and 5 more). - 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:31 +00:00 (Migrated from github.com)

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


Tested 7d5fb85e0 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 "rbf0_index" 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 rbf0_index ("'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:7259508769 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227#issuecomment-7259508769). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T17:12:31Z. --- Tested 7d5fb85e0 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 `"rbf0_index"` 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 `rbf0_index` ("'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:25 +00:00 (Migrated from github.com)

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


Added: rbf0_index is now in SHARED in tests/test_report_paths.py in this PR (commit 58a187f2).

  • python -I tests/test_report_paths.py — OK (1 skipped), with the entry in place.
  • python -I tests/test_rbf0_index.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:7260160704 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227#issuecomment-7260160704). Originally posted by [breachato](https://github.com/breachato) on 2026-11-29T18:02:25Z. --- Added: `rbf0_index` is now in `SHARED` in `tests/test_report_paths.py` in this PR (commit `58a187f2`). - `python -I tests/test_report_paths.py` — OK (1 skipped), with the entry in place. - `python -I tests/test_rbf0_index.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:26 +00:00 (Migrated from github.com)

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


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_rbf0_index.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:7289313011 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227#issuecomment-7289313011). Originally posted by [breachato](https://github.com/breachato) on 2026-11-30T19:23:26Z. --- 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_rbf0_index.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:00 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Reviewed the diff against main: delegating the report-path guard in tools/rbf0_index.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:6130641265 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227#pullrequestreview-6130641265). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:49:00Z. **Review:** CHANGES_REQUESTED --- Reviewed the diff against `main`: delegating the report-path guard in `tools/rbf0_index.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:25 +00:00 (Migrated from github.com)

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


Thank you @breachato! Both commits from this PR (rbf0_index) 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:7335656726 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1227#issuecomment-7335656726). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-02T05:10:25Z. --- Thank you @breachato! Both commits from this PR (`rbf0_index`) 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!1227
No description provided.