rtti_scan: ask report_paths for the report-path guard (RTTI-SCAN-SHARED-REPORT-PATH) #1229

Open
github-bot wants to merge 1 commit from github-bot/gh-1229 into main AGit
Owner

@⁠breachato on GitHub · 2026-11-24 20:37 UTC · original
breachato:rtti-scan-shared-report-path → main · +2 −6 · 1 files · 1 commits · open

Claimed in the coordination issue as: RTTI-SCAN-SHARED-REPORT-PATH (#14)

Depends on: none

Fixes: none

What and why

tools/rtti_scan.py derived the report-path answer inline in main (:518-524): realpath + normcase compared
by hand, then os.path.samefile inside a bare except OSError: pass, to refuse an --out that would overwrite
the image being scanned. That is the answer tools/report_paths.same_report_path exists to give, and
CONTRIBUTING.md asks a report writer to call it rather than derive it again.

The inline copy also missed that helper's folding-volume probe, so on a Linux mount that ignores case (vfat,
exFAT, CIFS) --out IMAGE.rtti.json beside an existing image.rtti.json was not refused and the report replaced
the previous one.

The five lines become one call. The tool already puts its own folder on sys.path for file_mode, so the import
is one line, and nothing else references the inline name. Different topic from RTTI-SCAN-STAGE-CLEANUP (#798,
staged-file permissions). No behaviour change on Windows, macOS or a case-sensitive Linux filesystem.

Tested

  • tests/test_rtti_scan.py: 29 passed, 1 skipped, 47 subtests passed.
  • python -I tools/rtti_scan.py --help: prints its usage (the import works under -I).
  • python -m compileall -q tools/rtti_scan.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)
**@⁠breachato** on GitHub · 2026-11-24 20:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1229) `breachato:rtti-scan-shared-report-path` → `main` · +2 −6 · 1 files · 1 commits · open Claimed in the coordination issue as: RTTI-SCAN-SHARED-REPORT-PATH (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) Depends on: none Fixes: none ### What and why `tools/rtti_scan.py` derived the report-path answer inline in `main` (`:518-524`): realpath + normcase compared by hand, then `os.path.samefile` inside a bare `except OSError: pass`, to refuse an `--out` that would overwrite the image being scanned. That is the answer `tools/report_paths.same_report_path` exists to give, and CONTRIBUTING.md asks a report writer to call it rather than derive it again. The inline copy also missed that helper's folding-volume probe, so on a Linux mount that ignores case (vfat, exFAT, CIFS) `--out IMAGE.rtti.json` beside an existing `image.rtti.json` was not refused and the report replaced the previous one. The five lines become one call. The tool already puts its own folder on `sys.path` for `file_mode`, so the import is one line, and nothing else references the inline name. Different topic from RTTI-SCAN-STAGE-CLEANUP (#798, staged-file permissions). No behaviour change on Windows, macOS or a case-sensitive Linux filesystem. ### Tested - `tests/test_rtti_scan.py`: **29 passed, 1 skipped**, 47 subtests passed. - `python -I tools/rtti_scan.py --help`: prints its usage (the import works under `-I`). - `python -m compileall -q tools/rtti_scan.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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:43:45 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 07:16 UTC · original

Reviewed 8bde265: verified in the arm64 Linux sandbox against origin/main and PR head. test_rtti_scan (30 ok), test_report_paths (22 ok), test_report_path_case (3 ok, 1 macOS skip), test_missing_input_exit_codes (2 ok), test_file_mode (5 ok), compileall, and check_no_game_data.py tools/rtti_scan.py all pass on both trees, and git merge-tree against origin/main is clean. Synthetic-PE probes (identical path, ./-spelling, hard link, default name, distinct --out, case-alias on case-sensitive Linux, and simulated folding-volume os.stat alias) match main with no regressions, while patching report_paths.case_insensitive_volume confirms the guard now delegates to report_paths.same_report_path per CONTRIBUTING.md (note main's os.path.samefile already caught existing-image case aliases on real folding volumes, so this is a clean deduplication refactor). Optional follow-up: add "rtti_scan" to SHARED in tests/test_report_paths.py. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 07:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1229#issuecomment-7155683064) Reviewed 8bde265: verified in the arm64 Linux sandbox against `origin/main` and PR head. `test_rtti_scan` (30 ok), `test_report_paths` (22 ok), `test_report_path_case` (3 ok, 1 macOS skip), `test_missing_input_exit_codes` (2 ok), `test_file_mode` (5 ok), `compileall`, and `check_no_game_data.py tools/rtti_scan.py` all pass on both trees, and `git merge-tree` against `origin/main` is clean. Synthetic-PE probes (identical path, `./`-spelling, hard link, default name, distinct `--out`, case-alias on case-sensitive Linux, and simulated folding-volume `os.stat` alias) match `main` with no regressions, while patching `report_paths.case_insensitive_volume` confirms the guard now delegates to `report_paths.same_report_path` per `CONTRIBUTING.md` (note `main`'s `os.path.samefile` already caught existing-image case aliases on real folding volumes, so this is a clean deduplication refactor). Optional follow-up: add `"rtti_scan"` to `SHARED` in `tests/test_report_paths.py`. AI-assisted review. **Recommendation:** Merge
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1229/head:github-bot/gh-1229'
git switch 'github-bot/gh-1229'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1229'
git switch 'github-bot/gh-1229'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1229'
git switch 'github-bot/gh-1229'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1229'
git switch 'main'
git merge --squash 'github-bot/gh-1229'
git switch 'main'
git merge --ff-only 'github-bot/gh-1229'
git switch 'main'
git merge 'github-bot/gh-1229'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.