gdk_runtime_calls: protect runtime-source directory files from collision (OLD-8468) #702

Merged
abnalstlll-byte merged 1 commit from upstream-pr/702 into main 2026-11-28 10:58:11 +00:00
abnalstlll-byte commented 2026-11-24 12:24:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:24:01Z.


Summary

Restores old upstream PR 8468 (OLD-8468).

When --runtime-source\ is a directory of \xgameruntime*.cpp\ (such as the default
untime/shims), \main()\ checked only \if os.path.isfile(a.runtime_source): inputs.append(a.runtime_source). This left all scanned shim C++ files omitted from collision detection, allowing --out\ to overwrite them.

This change extracts
untime_source_paths()\ to properly enumerate the scanned shim files and include them in the collision check against .json\ and .txt\ output paths.

Verification

  • Ran standard-library test suite: \python -I tests/test_gdk_runtime_calls.py\ (25/25 PASS).
  • Clean-room verification: \python -I scripts/check_no_game_data.py\ clean.
  • Zero dependencies outside the Python standard library. No game files, retail binaries, or keys.
  • AI-assisted (Claude Code).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5472082860 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/702). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:24:01Z. --- ### Summary Restores old upstream PR 8468 (OLD-8468). When \--runtime-source\ is a directory of \xgameruntime*.cpp\ (such as the default \ untime/shims\), \main()\ checked only \if os.path.isfile(a.runtime_source): inputs.append(a.runtime_source)\. This left all scanned shim C++ files omitted from collision detection, allowing \--out\ to overwrite them. This change extracts \ untime_source_paths()\ to properly enumerate the scanned shim files and include them in the collision check against \.json\ and \.txt\ output paths. ### Verification - Ran standard-library test suite: \python -I tests/test_gdk_runtime_calls.py\ (25/25 PASS). - Clean-room verification: \python -I scripts/check_no_game_data.py\ clean. - Zero dependencies outside the Python standard library. No game files, retail binaries, or keys. - AI-assisted (Claude Code).
PierreEbele commented 2026-11-25 01:17:06 +00:00 (Migrated from github.com)

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


Reviewed a008a756. I read the diff and ran the tests in a Linux sandbox:

  • tests/test_gdk_runtime_calls.py: 25 tests OK on this branch.
  • The PR's test file copied onto a main worktree: both new tests fail. test_main_refuses_out_that_overwrites_runtime_source_folder_file fails because main exits 0, and test_runtime_source_paths_directory_and_file errors because the helper is missing.
  • check_no_game_data.py on both changed files: clean.
  • The branch merges cleanly into current main (b4b7756e).

Before this change, the collision check only added --runtime-source when it was a single file. With the default folder source, a shim .cpp reached by the output path was not protected. runtime_source_paths() now feeds every scanned xgameruntime*.cpp into the check. read_runtime_source() is moved onto the same helper and behaves the same: an empty folder still raises FileNotFoundError. No findings.

AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7149391007 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/702#issuecomment-7149391007). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T01:17:06Z. --- Reviewed a008a756. I read the diff and ran the tests in a Linux sandbox: - `tests/test_gdk_runtime_calls.py`: 25 tests OK on this branch. - The PR's test file copied onto a main worktree: both new tests fail. `test_main_refuses_out_that_overwrites_runtime_source_folder_file` fails because main exits 0, and `test_runtime_source_paths_directory_and_file` errors because the helper is missing. - `check_no_game_data.py` on both changed files: clean. - The branch merges cleanly into current main (b4b7756e). Before this change, the collision check only added `--runtime-source` when it was a single file. With the default folder source, a shim `.cpp` reached by the output path was not protected. `runtime_source_paths()` now feeds every scanned `xgameruntime*.cpp` into the check. `read_runtime_source()` is moved onto the same helper and behaves the same: an empty folder still raises `FileNotFoundError`. No findings. AI-assisted review. **Recommendation:** Merge
abnalstlll-byte commented 2026-11-25 21:33:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T21:33:39Z.


Rebased cleanly onto latest \main\ (\e34ff17e9), resolving the stale base CI failure. Verified: all 25 tests in \ est_gdk_runtime_calls.py\ pass.

AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175239208 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/702#issuecomment-7175239208). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-25T21:33:39Z. --- Rebased cleanly onto latest \main\ (\e34ff17e9\), resolving the stale base CI failure. Verified: all 25 tests in \ est_gdk_runtime_calls.py\ pass. AI-assisted (Claude Code)
MoonEyes commented 2026-11-28 10:58:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:58:05Z.


Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238237986 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/702#issuecomment-7238237986). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T10:58:05Z. --- Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18). Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13. AI-assisted (Claude Code, Claude Opus 5.5)
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!702
No description provided.